我有一个蒙版(从 256 灰色 PNG 加载),我想将其应用于图像,该图像被用作绘制 a属性的过程的一部分。UITableViewCell
imageView.image
当未选择/突出显示单元格时,我CGImageCreateWithMask
使用正确颜色的正方形和蒙版,然后drawAtPoint:
将其放入我正在构建的图像中。这工作正常。
However, when the cell is selected or highlighted, I'd like to instead use the mask to instead punch through my image appropriately. 也就是说,当我的蒙版指定完全不透明度时,我希望我正在构建的图像完全透明,以便通过它绘制 tableview 的背景。在我的蒙版指定 0 不透明度的地方,我希望 alpha 通道保持不变。除了受影响的 Alpha 通道,我什么都不想要。
我想我的意思是我想在 a 上绘制 clearColor UIImage
,根据蒙版具有不同程度的不透明度。
首先,这叫什么?第二,我该怎么做?