Re: Best Approach in displaying the Image in Core Animation Layer - During the animation
Re: Best Approach in displaying the Image in Core Animation Layer - During the animation
- Subject: Re: Best Approach in displaying the Image in Core Animation Layer - During the animation
- From: David Duncan <email@hidden>
- Date: Fri, 4 Feb 2011 08:35:20 -0800
On Feb 3, 2011, at 11:11 PM, Sasikumar JP wrote:
> During the Edit mode(Wiggle Animation), Image in Grid(Layer) is not
> displayed properly.Even though i get 60 FPS during the wiggle
> animation,image edge is not smooth.
On iOS antialiasing doesn't occur between layers, which is why you get the jagged edge (the edgeAntialiasingMask property has no effect). If you want to smooth the edge, you will have to do so yourself by drawing the image into a slightly larger layer (1 pixel border should be enough)
> What is the difference in the following 2 approaches.
> Which is the best approach to display the icon image in layer during
> Animation (Wiggle Animation).
>
> 1. Layer.content
> 2. Override drawLayer method and draw the image using [UIImage drawRect]
> method.
That depends on what exactly you are doing inside of -drawLayer:. If you are just drawing the image to the entire area of the context provided, then you are basically making a (likely unnecessary) copy of the image. If you are doing other drawing than just the image, then thats the difference.
For your specific case, making your layer 2 pixels wider and taller, then drawing the image into the center of that layer (to make a 1 pixel border) will likely give you the effect that you desire, although at the cost of additional rendering time since your layers will no longer be opaque.
--
David Duncan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden