我正在使用drawImageRect在 Flutter 中绘制画布:
canvas.drawImageRect(image, sourceRect, destRect, _paint);
Run Code Online (Sandbox Code Playgroud)
我有一个不透明度值(0 到 1 之间的双精度值)。如何使用该值绘制图像(以便 0 不可见,0.5 为半不透明度)?
小智 5
只需设置颜色不透明度
final _paint = Paint();
final opacity = 0.5;
_paint.color = Color.fromRGBO(0, 0, 0, opacity);
canvas.drawImageRect(image, sourceRect, destRect, _paint);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3383 次 |
| 最近记录: |