Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Working out the four points of a sublayerTransform



Um. Actually, yes.

(sits and screen staring blankly .... wondering why he didn't try that in the first place).


--
Regards,
Neil Clayton,  http://shinywhitebox.com







On 19/03/2008, at 4:33 PM, Simon Fraser wrote:

On Mar 18, 2008, at 2:45 am, Neil Clayton wrote:
I'm wanting to draw a polygon around a layer.  I want the polygon to be 1 pixel wide regardless of the transformations applied to the layer.    As such a border/borderWidth solution won't work because it'll be scaled if the layer is scaled.  So I've computed the scaled and rotated coordinates of said layer by walking up the layer tree and applying the affine transforms top-down to each of the four points making up the original rectangle of the layer.  This gives me what I want - until I do rotation with sublayerTransforms.

Can't you achieve this by using the convertPoint: from/toLayer: methods on CALayer to map the corner points of your target layer to the coordinate space of some superlayer, rather than doing all the matrix math yourself?

The convertRect:to/FromLayer: methods may be ever simpler, if you just need to know the final bounding box.

Simon


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden

References: 
 >Working out the four points of a sublayerTransform (From: Neil Clayton <email@hidden>)
 >Re: Working out the four points of a sublayerTransform (From: Simon Fraser <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.