我需要将图像绘制到CALayer中,因为我需要对其执行各种效果、动画和滤镜。当我简单地将图像绘制到CGContext中时,无论我做什么,它总是呈现出像素化的效果...那么在Retina屏幕上绘制的正确方式是什么?
这是我现在正在做的事情:
这是我现在正在做的事情:
CGImageRef plateImage = [[UIImage imageNamed:@"someImage"] CGImage];
CGFloat width = CGImageGetWidth(plateImage), height = CGImageGetHeight(plateImage);
CGFloat scale = [[UIScreen mainScreen] scale];
NSLog(@"Scale: %f\nWidth: %f\nHeight: %f", scale, width, height);
CGContextTranslateCTM(_context, 0, height / scale);
CGContextScaleCTM(_context, 1.0, -1.0);
CGContextDrawImage(_context, CGRectMake(0, 0, width / scale, height / scale), plateImage);
UIGraphicsBeginImageContextWithOptions(imageSize, NO, [UIScreen mainScreen].scale);
- bplattenburg