Graphics and rendering in IOS

Source: Internet
Author: User

Http://www.cnblogs.com/appDev/archive/2011/07/08/2100607.html

Graphics and rendering in IOS

1. IOS supports OpenGL ES and quartz/uikit/coreanimation painting interfaces. Uikit painting must be completed in the main thread.

2. Quartz supports path-based rendering, reverse sampling, filling, image coloring, coordinate transformation, PDF rendering, display parsing, and other functions.

3. uikit supports line drawing, image and color operations.

4. Core animation supports animation rendering.

5. Use drawrect to draw a view. The following actions are triggered:

-Move and block a view.

-Hide and display a view.

-Drag the view.

-Display call setneeddisplay and setneeddispalyrect

6. the upper-left corner of uikit is the origin and the lower-right corner is the destination. Coreanimation is the origin, and the top right corner is the destination. Use cgcontextrotatectm, cgcontextscalectm, and cgcontexttranslatectm to change the matrix, or directly use cgaffinetransform to set the transformation matrix.

7. cgcontext: You can create different context types for bitmap and PDF.

-Transformation Matrix

-Crop range

-Line Drawing attributes

-Curve Accuracy

-Reverse sampling

-Fill attributes and stroke attributes

-Translucent Property

-Color Space

-Text

-Color Mixing Mode

8. Use uigraphicsgetcurrentcontext to obtain the current cgcontext.

9. uigraphicsbeginimagecontextwitexceptions and uigraphicsendimagecontext are used to contain the image rendering code.

Uigraphicsbegin1_contexttofile (todata) and uigraphicsend1_context are used to contain the code drawn in PDF.

10. Draw the path, that is, draw the vector. We recommend that you use uibezierpath, followed by cgpath.

11,Flip screen conversion:

CGContextTranslateCTM(graphicsContext, 0.0, drawingRect.size.height);
CGContextScaleCTM(graphicsContext, 1.0, -1.0);

12. Point is usually equal to pixel, but one point can be specified to correspond to multiple pixel.

13. Use uicolor to change the color space.

14. rendering performance:

-Minimal draw call

-Try to use an opaque View

-Reuse views and tables during screen scrolling

-You do not need to clear the result of the last painting when you scroll the screen.

-Reduces the switching of drawing status.

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.