这是一个创建于 4979 天前的主题,其中的信息可能已经有所发展或是发生改变。
    
    
    
        
        - (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 条回复  •  1970-01-01 08:00:00 +08:00
     
    
    
        
        
        
        
            
                |  |  |      1changx      2012-03-14 19:02:06 +08:00 补充一个我做过的尝试
 CGContextSetShouldAntialias(ctx, YES);
 CGContextSetAllowAntialiasing(ctx, YES);
 CGContextSetInterpolationQuality(ctx, kCGInterpolationHigh);
 CGContextDrawImage(ctx, layer.bounds, flipImage);
 
 仍然有轻微锯齿,达不到原屏幕显示质量。
 |