iPhone Dev:Blurring of CALayers when rotated
Posted
by user153231
on Stack Overflow
See other posts from Stack Overflow
or by user153231
Published on 2010-04-05T10:37:00Z
Indexed on
2010/04/05
10:43 UTC
Read the original article
Hit count: 329
Hello All,
I have a CALayer with a png image as its content.When rotation is applied the layer looks blurry. I've searched for a cause for this problem and found out that the problem might be the half pixel problem, which makes the layer blurry if its frame.origin lays on fractions like 96.5, and they suggest to make the origin a whole number. Now, my layer's origin contains fractions because of the rotation i make as in:
tempLayer.anchorPoint = CGPointMake(0.5,0.5);
tempLayer.position = CGPointMake(200,100); tempLayer.bounds = CGRectMake(0,0,70,88);
tempLayer.transform = CATransform3DMakeRotation(10.f*M_PI/180.f, 0.f, 0.f, 1.f); tempLayer.contents = (id)myImage;
Basically i have three questions:
1) Is there a better way to rotate the layer?
2) The frame values are derived from the anchorPoint, position, bounds and transform values, how can i round my frame values to integer values and keep my rotation intact?
3) Can the CGRectIntegral function help me? If yes how?
Thank you all in advance.
© Stack Overflow or respective owner