Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 如何在颤振中绘制不同的图案?_Dart_Flutter - Fatal编程技术网

Dart 如何在颤振中绘制不同的图案?

Dart 如何在颤振中绘制不同的图案?,dart,flutter,Dart,Flutter,我想像这样在颤振中画出不同的图案 虽然这段代码是javascript,但在本中给出了它,我使用了ImageShader和Paint函数的used shader属性 设备变换用于获取设备像素,以便渲染效果 这是我的画法看起来像 final double devicePixelRatio = ui.window.devicePixelRatio; @override void paint(Canvas canvas, Size size) { final F

我想像这样在颤振中画出不同的图案


虽然这段代码是javascript,但在本

中给出了它,我使用了ImageShader和Paint函数的used shader属性 设备变换用于获取设备像素,以便渲染效果 这是我的画法看起来像

 final double devicePixelRatio = ui.window.devicePixelRatio;
      @override
      void paint(Canvas canvas, Size size) {
        final Float64List deviceTransform = new Float64List(16)
          ..[0] = devicePixelRatio
          ..[5] = devicePixelRatio
          ..[10] = 1.0
          ..[15] = 2.0;
        Float64List matrix = new Float64List(16);
        print('matrix is $matrix');
        print('image is coming in paint    $image');
        Paint paint = new Paint()
          ..style = PaintingStyle.stroke
          ..strokeCap = StrokeCap.round
          ..shader = ImageShader(
              image, TileMode.repeated, TileMode.repeated, deviceTransform)
          ..strokeWidth = 40.2;
        paths.forEach((path) {
          canvas.drawPath(path, paint);
        });
        repaint = false;
      }

请参见
ImageShader
officialdocumentation@pskink我试过。。。我必须在这里输入什么值
.shader=ImageShader(image,TileMode.clamp,TileMode.clamp,Float64List(16))
我使用gradient获得它,我创建了Linera gradient并将其用作,但它仍然需要一些改进
shader=gradient.createShader(myRect)
那些神奇的数字是什么样的
。[0]
.5]
.10]
.15]
?为什么不使用
Matrix4
方法更改
Matrix4
?您是否查看了官方文档?您是否查看了
Matrix4#scale()
和/或
Matrix4#scale()
方法?你为什么不用呢?使用这样的方法而不是使用[0]…[5]…[10]…[15]幻数不是更好吗?我使用它们是因为我想检查不同的设备,它们对我来说工作正常。