学习一些常用的混合模式之BlendMode. dst_atop

Discards the destination pixels that are not covered by source pixels. Draws remaining destination pixels over source pixels.

公式:

js 复制代码
    canvas.saveLayer(Rect.fromLTWH(0, 0, width, height), Paint());
    Paint dstPaint = Paint()..color = Colors.red;
    dstPaint.style = ui.PaintingStyle.fill;
    canvas.drawImageRect(image1!, Rect.fromLTWH(0, 0, image!.width.toDouble(), image!.height.toDouble()), Rect.fromLTWH(0, 0, width/2, height/2), dstPaint);

    var srcPaint = Paint()
      ..color = Colors.red
      ..strokeWidth = 10
      ..blendMode = ui.BlendMode.dstATop; // 源颜色:蓝色; // 混合模式
    canvas.drawRect(Rect.fromLTWH(0, 0, width, height).deflate(30), srcPaint);

效果图:

重叠部分展示 dst 非重叠部分 src 跟 dst 都保留。

相关推荐
拥小抱5 小时前
Compose 知识点
android
文章永久免费只为良心5 小时前
Web应用安全与防护_第三章_日志文件包含_从一道 CTFshow 题目讲透「日志投毒型 LFI → RCE」:原理、时序陷阱与全变种攻防手册
android·网络安全·渗透测试·漏洞危害·漏洞描述·日志投毒·红队指南
AIsoft_86896 小时前
学术讲座录音如何整理?录音APP可行吗
android·iphone
Patrick在香港8 小时前
一个斜杠,把毫秒变成十几秒
android·数据库·python·性能优化·正则表达式·回溯·redos
海雅达手持终端PDA9 小时前
工业手持终端的“去手机化”演进:看海雅达如何以“同轴扫摄”终结工程妥协,重塑工业PDA新范式
android·物联网·智能手机·硬件工程·能源·制造·iot
booboosui10 小时前
删掉一个住在本机的 agent:8 处要清,顺序不能反
android
hcgeng11 小时前
Android获取崩溃日志
android
aqi0011 小时前
AI编程让鸿蒙开发电子书APP更加快捷
android·华为·harmonyos·鸿蒙·harmony
GY-9311 小时前
【Android】Android Studio 中的协程
android