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