ios – CGImageCreateWithMaskingColors在删除颜色时留下边框

ios – CGImageCreateWithMaskingColors在删除颜色时留下边框,第1张

概述我正在使用下面的代码使颜色洋红色透明: 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 我正在使用下面的代码使颜色洋红色透明:

UIImage *inputimage = [UIImage imageWithData:UIImageJPEGRepresentation(anchorWithMask,1.0)];const float colorMasking[6] = {0.0,255.0,0.0,2.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通道之前存在边框,因此它与此无关.

是否有可能摆脱这些边界?

解决方法
CGContextSetShouldAntialias(UIGraphicsGetCurrentContext(),NO);

一切都会安好的.

总结

以上是内存溢出为你收集整理的ios – CGImageCreateWithMaskingColors在删除颜色时留下边框全部内容,希望文章能够帮你解决ios – CGImageCreateWithMaskingColors在删除颜色时留下边框所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1037190.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存