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.