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厚。
任何想法如何克服這種行爲。