Greetings!
This question is rather mathematical, with the iphone SDK/quartz as example:
I am rotating an image using CGContextRotateCTM:
- Create a new context with the size of the source image
- rotate source image and draw it in context
- pass context to new rotated image.
This works fine, but the image is cut off at the edges, because it doesn't fit into the source image size. I would like to resize the context/the resulting image so that the entire rotated image is visible.
What algorithm could I use to calculate the needed size of the context before I start the rotation?
Thank you very much in advance.