Re: "Drawing" CATextLayer into a CGImageRef?
Re: "Drawing" CATextLayer into a CGImageRef?
- Subject: Re: "Drawing" CATextLayer into a CGImageRef?
- From: John Harper <email@hidden>
- Date: Thu, 09 Oct 2008 10:28:11 -0700
Hi,
the best way to address this kind of thing is by drawing the shadow
into the layer bitmap. You can do that by subclassing CATextLayer and
adding a drawInContext: method something like:
- (void)drawInContext:(CGContextRef)ctx
{
CGContextSetShadow (ctx, CGSizeMake (0, -4), 2);
[super drawInContext:ctx];
}
for performance reasons it's best to avoid using the CALayer shadow
support unless the content of the layer being shadowed is animating,
otherwise drawing the shadow into the layer (or into a dedicated
shadow layer) is usually much cheaper overall.
John
On Oct 9, 2008, at 9:25 AM, Tim Andersson wrote:
Hi there!
In my application I have a CATextLayer (timeLayer) in a CALayer
(clockLayer). If I apply a shadow to my timeLayer and then animate
clockLayer using a CATransform3D, it animates VERY slowly.
I figured I would solve this problem by creating a "snapshot" image
of the
timeLayer, setting a new CALayers contents to the snapshot image,
and then
animating the new layer containing the snapshot.
The problem is that I have no idea of how to achieve this. If you
know any
other way of solving my problem, or how I can accomplish the above, it
would be very kind of you to share your thoughts.
Kind regards,
Tim Andersson
_______________________________________________
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
_______________________________________________
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