Commit e6e2baa065fa6d8bb6c21884e205fccd7f47952d

Authored by wdn127929
1 parent c5795bf6

蒙版和限制字数

Showing 1 changed file with 17 additions and 4 deletions
... ... @@ -2125,13 +2125,26 @@ class Utils {
// ..strokeCap = StrokeCap.butt
// ..strokeWidth = 2;
final paint = Paint()
..color = Color.fromRGBO(0, 0, 0, 0.8)
..color = Color.fromRGBO(81, 81, 81, 0.4)
..style = PaintingStyle.fill;
canvas.drawRect(Rect.fromLTWH(0, 0, 500, 400), paint);
// canvas.drawRect(Rect.fromLTWH(0, 0, 500, 400), paint);
canvas.drawImage(images, Offset(0, 0), paint);
// canvas.drawImage(images, Offset(0, 0), paint);
// 定义源矩形,通常是图像的全部
final Rect source = Rect.fromLTWH(0.0, 0.0, images.width.toDouble(), images.height.toDouble());
// 定义目标矩形,即画布的大小
final Rect destination = Rect.fromLTWH(0.0, 0.0, 500, 400);
// 绘制图像
canvas.drawImageRect(images, source, destination, paint);
// 在画布上绘制图片,使用BoxFit来适配画布大小
// canvas.drawImageRect(
// images,
// Rect.fromLTWH(0, 0, images.width.toDouble(), images.height.toDouble()),
// Rect.fromLTWH(0, 0, images.width.toDouble(), images.height.toDouble()),
// paint);
// 绘制文字
ui.ParagraphBuilder pb2 = ui.ParagraphBuilder(ui.ParagraphStyle(
... ...