【发布时间】:2021-07-26 13:18:05
【问题描述】:
我正在使用 Flutter 开发绘图应用程序。如何绘制透明颜色的路径和路径周围的纯色边缘?
【问题讨论】:
标签: flutter path draw paint transparent
我正在使用 Flutter 开发绘图应用程序。如何绘制透明颜色的路径和路径周围的纯色边缘?
【问题讨论】:
标签: flutter path draw paint transparent
我尝试了不同的混合模式,但无法达到我想要的效果,所以我按照以下方式实现。这是一项昂贵的操作,但可以按预期工作。
双 iw=20; 双 ow=25;
Path mPath1=Path;
Path mPath2=Path;
Color color_alpha=Color.fromARGB(10,255,255,255);
for(int i=0; i< points.length; i++)
{
mPath1.addOval(Rect.fromCenter(center: Offset(pt.dx, pt.dy), width: iw, height: iw));
mPath2.addOval(Rect.fromCenter(center: Offset(pt.dx, pt.dy), width: ow, height: ow));
}
canvas.drawPath(Path.combine(PathOperation.difference, mPath2, mPath1), Paint());
canvas.drawPath(mPath1, Paint..color=color_alpha);
这是结果。
【讨论】: