简体   繁体   English

两图相交的透明度

[英]Two images intersection transparency

There are two images. 有两个图像。 image1 and image2. image1和image2。 I have added image2 on image1. 我在image1上添加了image2。 Overall the output image must be image1 only but, the portion of the image2 must become transparent. 总体而言,输出图像必须仅是image1,但是image2的一部分必须变为透明。 I mean the alpha values on the intersection area must be in reverse order( ie, if alpha value of one pixel( say 120, 100) on image2 is 1.0 then the same pixel's alpha value on image1 must become 0. If it is 0.6 then it must become 0.4). 我的意思是交集区域上的alpha值必须是相反的顺序(即,如果image2上一个像素的alpha值(例如120、100)为1.0,则image1上相同像素的alpha值必须变为0。如果为0.6,则它必须变成0.4)。

尝试异或模式。

It sounds like you're trying to use image2 as a mask for image 1. In Quartz, you can create an image mask and then make subsequent drawing operations use the mask's alpha value as a multiplier. 听起来好像您正在尝试使用image2作为图像1的蒙版。在Quartz中,您可以创建一个图像蒙版,然后使后续的绘制操作使用该蒙版的alpha值作为乘数。 I don't think there's a straightforward XOR more, though. 不过,我认为还没有直接的XOR。

Good Luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM