IOS Graphics Context Stack

Source: Internet
Author: User

- (void) DrawRect: (cgrect) rect{//Get ContextCgcontextref CTX =Uigraphicsgetcurrentcontext (); //save a copy of the purest graphics context//called once the method copies a context into the stackcgcontextsavegstate (CTX);//cgcontextsavegstate (CTX); //First line//saving drawing information with a graphical contextCgcontextmovetopoint (CTX, Max, -); Cgcontextaddlinetopoint (CTX, -, -); //set the state of the first lineCgcontextsetlinewidth (CTX,Ten);    Cgcontextsetlinecap (CTX, Kcglinecapround); [[Uicolor Redcolor]Set]; //RenderingCgcontextstrokepath (CTX); //Restore the purest graphics context that you started to savecgcontextrestoregstate (CTX); //Second LineCgcontextmovetopoint (CTX, the, -); Cgcontextaddlinetopoint (CTX, the, Max); /*//emptying status Cgcontextsetlinewidth (CTX, 5);    Cgcontextsetlinecap (CTX, Kcglinecapbutt);    [[Uicolor Greencolor] set]; */       //Restore the purest graphics context that you started to savecgcontextrestoregstate (CTX); /*//3rd line Cgcontextmovetopoint (CTX, 200, 30);    Cgcontextaddlinetopoint (CTX, 80, 150); */    //RenderingCgcontextstrokepath (CTX); }

IOS Graphics Context Stack

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.