I'm suffering from extreme frustration with CALayers.  I obviously don't
understand the documentation available and there is a lot that is not
documented, especially since the Views guide has not been updated to include
CALayers.  Also, as others have observed, the "flipped" paremeter in
[NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:YES] simply
does not work.

    I have a view with inverted coordinates.  I have been able to use a
stack of layers to draw when the view is unmodified.  However, when I scale
the view by any means (usually by changing the frame and resetting to the
original bounds), it works without layers, but when using layers I cannot
get the layers to track and can't seem to force them into the right scale
and position.  I've simplified it to just use only the view's layer and
still can't get it to work properly.

    One source of confusion is the anchorPoint/Position relation.  Reference
says "The position is relative to anchorPoint".  Huh?  What anchorPoint? --
the layer in question, or its superLayer?  And what does this mean for the
view's layer in terms of the view's coordinates?

    Another one is "frame".  "Specifies receiver¹s frame rectangle in the
super-layer¹s coordinate space".  So ok, how does the view's layer frame
relate to the view's frame?

    Both of these questions can likely be answered by the question: How do
the view's layer coordinates relate to the view's coordinates?  Also, do
springs and struts have any meaning between view and layer?

    The questions are going to get worse when I start trying to change the
view's bounds size (drawing canvas size), but let's handle one issue at a
time and stick with scaling for now.

    Apparently, the view's layer corresponds to the view itself when
created, with the possible exception of coordinate inversion.  I can flip by
transforming the context when drawing, but I would rather transform the
layer, because the latter is also involved when changing scaling.  However,
this gets involved with the entire anchorPoint/position question because the
transform is not around thelayer's bounds origin, but around the
anchorPoint.

    What I'm trying to do is conceptually very simple, I just want to scale
the view and have its layer position and scale the same, so that drawing
into the scaled view comes out the same whether layer-backed or not.  Then,
once that works, I will try stacking individual sub-layers again.

Any insights would be appreciated.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to