我CGImageCreateWithMaskingColors()
用来从UIImage
. 颜色去除过程工作正常,但图像中的透明区域在屏蔽过程后变黑。请参阅下面粘贴的代码。
CGImageRef imageRef = self.editedImage.CGImage;
CGImageRef myColorMaskedImage = CGImageCreateWithMaskingColors(imageRef, myMaskingColors);
UIImage *newImage = [self normalizeWithAlpha:[UIImage imageWithCGImage:myColorMaskedImage]];
CGImageRelease(myColorMaskedImage);