Tag: antialiasing

反别名,UIImage和性能

我有一个UIImage加载到UIImageView 。 UIImage比UIImageView ,它已经缩小到适合。 显然缩小的UIImage显示锯齿状的边缘。 在性能方面反对这个图像的最好方法是什么? 我已经看到了使用drawInRect这个方法,但是我也读过了drawInRect并没有给出最好的性能 。 我已经阅读了几篇不同的文章,并且我自己尝试了一些方法。 但在阅读了关于使用UIViews和Core Graphics之间性能差异的更多 文章之后,我想知道哪种抗锯齿方法能够提供最佳性能?

UIImage的drawInrect:平滑图像

我试图使用UIImage的drawInRect:方法来绘制图像。 这里是代码: UIImage *image = [UIImage imageNamed:@"OrangeBadge.png"]; UIGraphicsBeginImageContext(image.size); [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)]; UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); 问题是由此产生的图像模糊。 这是最后的图像(在右侧)与源图像(在左侧)的比较: 我试过CGContextSetAllowsAntialiasing(UIGraphicsGetCurrentContext(), NO) CGContextSetShouldAntialias(UIGraphicsGetCurrentContext(), NO)但是这并没有解决问题。 有任何想法吗? 提前致谢。