UIKit has a coordinate system with an origin at top left.
Core Graphics has a coordinate system with an origin at bottom left.
When I accesss the CGImage of an UIImage, does this trigger an expensive operation of flipping the bitmap vertically?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are using the CGImage property on your UIImage object (documentation here) it should not be an “expensive” operation unless the CGImageRef has been released to free memory, in which case the image will be reloaded into memory.
There is additional information on managing flipped coordinates at Apple’s Quartz 2D Programming Guide. Also, you should read the Drawing and Printing Guide for iOS which talks about how to flip the default orientation of your context to make them match up. If you do that step when the image is created or loaded into memory, your coordinate systems will match.