在抖动中创建图像蒙版 [英] Creating image masks in flutter
问题描述
Flutter提供了几种基于路径(即剪切路径)的蒙版方法.我正在尝试找出一种方法,可以像下面的示例一样使用透明层来拍摄图像,然后使用该图像来遮罩另一幅图像/视图或用作一般遮罩.
Flutter provides several ways for masks based on paths i.e. clip paths. I am trying to figure out a way where one could take an image with transparency layer like example below and use that image to mask another image / view or as a general mask.
我的第一个直觉是看 CustomPaint类,但是我无法通过最初的想法来解决这个问题.
My first instinct was to look at CustomPaint class, but I can't figure it out past this initial idea.
推荐答案
Flutter具有 BoxDecoration类,其中包含 BlendMode枚举 .通过利用这些,您可以使用图像实现各种蒙版效果,对于我在dstIn
以上的特殊情况,这是一个解决方案.
Flutter has BoxDecoration class that takes in BlendMode enum. By utilising these you can achieve various mask effects using images, for my particular case above dstIn
was a solution.
这篇关于在抖动中创建图像蒙版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!