我正在使用下面的代码使洋红色透明:
UIImage *inputImage = [UIImage imageWithData:UIImageJPEGRepresentation(anchorWithMask, 1.0)];
const float colorMasking[6] = {0.0, 255.0, 0.0, 2.0, 0.0, 255.0};
CGImageRef imageRef = CGImageCreateWithMaskingColors(inputImage.CGImage, colorMasking);
UIImage *image = [UIImage imageWithCGImage:imageRef];
// add an alpha channel to the image.
结果是一张带有洋红色边框的图像:http://i.imgur.com/4g6lM.png .边框在添加 alpha channel 之前就已存在,因此与此无关。
是否有可能摆脱这些边界?
最佳答案
CGContextSetShouldAntialias(UIGraphicsGetCurrentContext(), NO);
会好的。
关于ios - CGImageCreateWithMaskingColors 删除颜色时离开边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8320735/