This topic created in 5157 days ago, the information mentioned may be changed or developed.
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
{
UIGraphicsBeginImageContext(layer.bounds.size);
CGContextRef _ctx = UIGraphicsGetCurrentContext();
[self.view.layer renderInContext:_ctx];
CGImageRef image = CGBitmapContextCreateImage(_ctx);
UIGraphicsEndImageContext();
CGImageRef flipImage = CGImageCreateWithImageInRect(image, layer.bounds);
CGContextSaveGState(ctx);
CGContextTranslateCTM(ctx, 0, layer.bounds.size.height);
CGContextScaleCTM(ctx, 1.0f, -1.0f);
CGContextDrawImage(ctx, layer.bounds, flipImage);
CGContextRestoreGState(ctx);
LogMessage(@"drawLayer", 1, @"draw layer content");
}
上面这番处理之后,图像中的一些线条边缘出现锯齿。
1 replies • 1970-01-01 08:00:00 +08:00
 |
|
1
changx Mar 14, 2012
补充一个我做过的尝试
CGContextSetShouldAntialias(ctx, YES); CGContextSetAllowAntialiasing(ctx, YES); CGContextSetInterpolationQuality(ctx, kCGInterpolationHigh); CGContextDrawImage(ctx, layer.bounds, flipImage);
仍然有轻微锯齿,达不到原屏幕显示质量。
|