0 Cgcontextref context = uigraphicsgetcurrentcontext ();
1 cgcontextmovetopoint start drawing lines
2 Cgcontextaddlinetopoint Draw straight line
4 Cgcontextaddellipseinrect Draw an ellipse
4 Cgcontextsetlinecap Set line End shape
4 Cgcontextsetlinedash Draw dashed line
4 Cgcontextaddrect Draw one side box
4 Cgcontextstrokerect Specify Rectangle
4 Cgcontextstrokerectwithwidth Specify the width of the rectangle line
4 cgcontextstrokelinesegments Some straight lines
5 Cgcontextaddarc Draw already curved front two stores for center between two stores for the starting radian the last data is 0 clockwise draw 1 counterclockwise
5 Cgcontextaddarctopoint (context,0,0, 2, 9, 40);//Draw two lines from point to the Brother 1 points, from the Brother 1 point to the Brother 2 points of the line cut inside the circle
6 Cgcontextsetshadowwithcolor setting Shadows
7 Cgcontextsetrgbfillcolor This fill color
7 cgcontextsetrgbstrokecolor Brush color Settings
7 Cgcontextsetfillcolorspace color space Fill
7 Cgconextsetstrokecolorspace color space Brush Settings
8 Cgcontextfillrect complements the current fill color rect
8 Cgcontextsetalaha Transparency
9 CGCONTEXTTRANSLATECTM Changing the canvas position
Cgcontextsetlinewidth Set the width of the line
draw Multiple Lines cgcontextaddrects
Cgcontextaddquadcurvetopoint Draw Curve
cgcontextstrokepath start Drawing pictures
Cgcontextdrawpath Set Drawing mode
Cgcontextclosepath Close the current line
CGCONTEXTTRANSLATECTM (context, 0, rect.size.height); CGCONTEXTSCALECTM (Context, 1.0,-1.0); Invert Canvas
cgcontextsetinterpolationquality background Built-in color quality level
Cgimagecreatewithimageinrect take a small picture from the original image
17 writes of the string can be drawn using the NSString itself-(cgsize) Drawinrect: (cgrect) rect withfont: (Uifont *) font Linebreakmode: ( Uilinebreakmode) Linebreakmode alignment: (uitextalignment) alignment; just write it in.
18 to enlarge the function of the picture is slow point uigraphicsbeginimagecontext (newSize); uiimage* newimage = Uigraphicsgetimagefromcurrentimagecontext (); Uigraphicsendimagecontext ();
cgcolorgetcomponents () returns the individual vertical and transparency of a color available as a read-only const float to receive a number of arrays
20 Draw picture Cgimageref Image=cgimageretain (img. Cgimage); Cgcontextdrawimage (Context, CGRectMake (10.0, height-100.0, 90.0, 90.0), image);
21 Implement the variable color Fill method cgcontextclip (context); Cgcolorspaceref RGB = Cgcolorspacecreatedevicergb (); CGFloat colors[] = {204.0/255.0, 224.0/255.0, 244.0/255.0, 1.00 29.0/255.0, 156.0/255.0, 215.0/255.0, 1.00, 0 .0/255.0, 50.0/255.0, 126.0/255.0, 1.00,}; Cggradientref gradient = cggradientcreatewithcolorcomponents (RGB, colors, NULL, sizeof (colors)/(sizeof (COLORS[0)) ); Cgcolorspacerelease (RGB); Cgcontextdrawlineargradient (Context, Gradient,cgpointmake (0.0,0.0), Cgpointmake (0.0,self.frame.size.height), Kcggradientdrawsbeforestartlocation);
22 Note: After drawing, you must first use Cgcontextstrokepath to stroke the line, that is, after the shape with Cgcontextfillpath to fill the color inside the shape. When a path is filled, the paths inside the path are filled independently. If the path is overlapping, determine whether a point is filled, there are two rules 1,nonzero winding number rule: not 0, if a point is crossed from left to right, counter +1, right to left, counter 1, and finally, if the result is 0, then not filled, If nonzero, then the padding. 2,even-odd rule: Parity rules, if a point is crossed, then +1, and finally an odd number, then to be filled, even the number is not filled, and the direction is not related. Function Descriptio Cgcontexteofillpath fills the current path with a parity rule cgcontextfillpath fills the current path with a non-0-wrap rule cgcontextfillrect fills the specified rectangle Cgcontextfillrects fills the specified rectangle with some rectangles cgcontextfillellipseinrect fills the ellipse in the specified rectangle cgcontextdrawpath two parameters determine the fill rule, Kcgpathfill represents a rule with a non-0 number of rules, Kcgpatheofill is represented by a parity rule, kcgpathfillstroke represents a fill, kcgpatheofillstroke represents a stroke, not a fill setting when one color overrides another color, Two colors how to mix the default way is result = (Alpha * foreground) + (1-alpha) * Background cgcontextsetblendmode: Set blend mode. Cgcontextsavegstate: Save blend mode. Cgcontextrestoregstate: Use this function to restore the blend mode before saving. Cgcontextsetblendmode Mix Two colors
IOS Cgcontex Small Note