coordinate processing for iOS drawings

Source: Internet
Author: User

In iOS, when drawing operations, it is generally called in Uiview:drawrect

uigraphicsbeginimagecontextwithoptions, such as a series of functions, sometimes direct drawing on the line, such as UIImage drawrect, and so on, sometimes need to carry out a slightly complex operation, such as color mixing, mask, etc., A CTM transformationof the cgcontextref is required to understand that thecoordinate system of the uikit and quartz plots is not the same, the original point is the top left and the latter is the lower left. If you call the drawing context Cgcontextref directly using the Uikit method, the coordinate system is automatically adjusted, and the quartz is consistent, and the coordinate system is not required to perform a series of operations through the methods in the Uikit.framework. If you need to use coregraphics.framework functions, such as cgcontextdrawimage, you need to manually adjust the coordinate system, because the mapping coordinate system is inconsistent. In other words, when calling Uikit.framework, you can use the coordinate system, but you need to pay attention when calling Coregraphics.framework. Please specify the wrong place.

coordinate processing for iOS drawings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.