What I am trying to do is to apply a CGAffineTransform to a CGPath.
I know, if I were drawing onto a CGContext, I would just transform the context itself.
But what I want to do is to apply a transform to the actual path itself. UIBezierPath allows me do to this with the applyTransform: method, it doesn't transform it's CGPath.
Is there any way to apply a CGAffineTransform to a CGPath itself??
You can use CGPathCreateCopyByTransformingPath
which creates a copy of your path, transformed by a given CGAffineTransform
. There's also CGPathCreateMutableCopyByTransformingPath
for creating a mutable copy.
Note that both of these functions have been introduced in iOS 5.
If you need something that works on earlier versions of iOS, you could create an empty path (CGPathCreateMutable
) and add your other path with CGPathAddPath
which optionally takes a transformation as its second parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With