Re: Redrawing CALayer subclass when super layer is scaled
Re: Redrawing CALayer subclass when super layer is scaled
- Subject: Re: Redrawing CALayer subclass when super layer is scaled
- From: David Duncan <email@hidden>
- Date: Wed, 16 Jul 2008 16:23:23 -0700
On Jul 15, 2008, at 10:42 PM, Rick Mann wrote:
However, at the time that my drawing code is called, the
CGContextRef that's handed to me is NOT scaled. So my drawing is
done small, and then only scaled afterward by some blit operation.
The result is very pixilated lines.
If you are dealing with CALayers, then the context covers the number
of pixels defined by layer.bounds.size. If you are dealing with a
CATiledLayer, then the context passed covers the number of pixels
defined by layer.tileSize. The primary difference between a CALayer
and a CATiledLayer is that the tiled layer has multiple
representations for the same content, whereas a CALayer has only one
representation (which is also why a CATiledLayer requires more
resources than a CALayer).
This is also why when you scale up a CALayer its content its content
looks interpolated - its the same number of pixels as before, just
interpolated larger. If you exceed the maximum LOD of a tiled layer,
you will see the same thing (which if you don't set a LOD bias means
if you scale a tiled layer above 1.0 it will also have its content
interpolated).
I've tried making my root layer a CATiledLayer, and I've tried
making my individual sublayers CATiledLayers (and setting levels of
detail for both). Nothing works.
I'm not certain why it would not, at least not with all your layers as
tiled layers. If just your root layer is a tiled layer, then it would
need to be transformed for its drawing code to be re-invoked, and it
would not effect any of the sublayers directly.
I don't really want to have to set the scale on each sublayer; this
seems to defeat the purpose of the drawing transform.
This wouldn't have the effect you would want anyway (both transforms
would be concatenated, which would end up with an explosion of size
unless you flattened your layer hierarchy)
The documentation says that any transform applied to a layer also
applies to its sublayers, but this is not what I'm seeing; at least,
not at draw time.
Can't really say what you are or are not seeing here, I'd probably
have to see code. If this is critical, I'd recommend filing a DTS
incident.
--
David Duncan
Apple DTS Animation and Printing
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