学习一些常用的混合模式之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 都保留。

相关推荐
火柴就是我16 小时前
学习一些常用的混合模式之BlendMode. dstIn
android·flutter
ganshenml17 小时前
【Android】 开发四角版本全解析:AS、AGP、Gradle 与 JDK 的配套关系
android·java·开发语言
我命由我1234517 小时前
Kotlin 运算符 - == 运算符与 === 运算符
android·java·开发语言·java-ee·kotlin·android studio·android-studio
摘星编程18 小时前
【RAG+LLM实战指南】如何用检索增强生成破解AI幻觉难题?
android·人工智能
火柴就是我18 小时前
学习一些常用的混合模式之BlendMode. dst
android·flutter
遥不可及zzz18 小时前
解决 Google Play 提示的 16KB 内存页面大小对齐问题:通过升级 Android Gradle 插件(AGP)
android
前端不太难19 小时前
Sliver 为什么能天然缩小 rebuild 影响面
flutter·性能优化·状态模式
SmartRadio19 小时前
在MT8791 5G硬件平台上舍弃安卓系统-运行OpenWRT系统
android·5g·mt8791
虫小宝19 小时前
导购APP高可用数据库设计:主从分离与分库分表在返利系统中的应用
android·数据库