I've been having a little success with NSAffineTransform
but have come across AffineTransform
which is presumably more Swifty. However it doesn't have a concat
method, so how do you use it? I'm aiming to draw the same little BezierPath rotated several times round the centre.
Sorry if it's obvious; I guess others might find this useful.
Here's how I see it. If you're drawing with an
NSBezierPath
you apply it to the path withmyPath.transform(using: tr)
, e.g.:As I see it, the transform affects all the elements already in the path, but not any elements subsequently added. Transforms are cumulative, in that re-applying a transform, or applying another will affect all the elements so far entered.
You can also use the
AffineTransform
's own methods to transform individual points or sizes.