2
我用下面的代码绘制在CATiledLayer线在CATiledLayer绘制时跨越:模糊像素的iPhone 4
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {
CGContextMoveToPoint(ctx, 130, 100.5);
CGContextAddLineToPoint(ctx, 160, 100.5);
CGContextSetRGBStrokeColor(ctx, 1, 0, 0, 1);
CGContextSetRGBFillColor(ctx, 1, 0, 0, 1);
CGContextDrawPath(ctx, kCGPathStroke);
}
我得到的是这个4PX模糊的行:
http://img837.imageshack.us/img837/5002/fuzzyline.png
如果我将CATiledLayer更改为CALayer,则该行很锐利,宽度为2px,如预期的那样。 我只在iPhone 4上得到这种行为,在3GS上,CALayer和CATiledLayer上的行都很清晰。当然,在3GS上线是1px厚。
任何想法如何克服这种行为。