iOS Graphics context stack

Source: Internet
Author: User

1- (void) DrawRect: (cgrect) Rect2 {3     //Get Context4Cgcontextref CTX =Uigraphicsgetcurrentcontext ();5 6     //save a copy of the purest graphics context7     //call this method will copy a context to the stack, save a few times can be called several times cgcontextrestoregstate (CTX), if saved once, take the second time will be an error8 9 cgcontextsavegstate (CTX);Ten //cgcontextsavegstate (CTX); One      A     //First line -     //saving drawing information with a graphical context -Cgcontextmovetopoint (CTX, Max, -); theCgcontextaddlinetopoint (CTX, -, -); -      -     //set the state of the first line -Cgcontextsetlinewidth (CTX,Ten); + Cgcontextsetlinecap (CTX, kcglinecapround); -[[Uicolor Redcolor]Set]; +      A     //Rendering at Cgcontextstrokepath (CTX); -      -      -     //Restore the purest graphics context that you started to save - cgcontextrestoregstate (CTX); -      in     //Second Line -Cgcontextmovetopoint (CTX, the, -); toCgcontextaddlinetopoint (CTX, the, Max); + Cgcontextstrokepath (CTX); - cgcontextsavegstate (CTX); the  *  $     //RenderingPanax Notoginseng Cgcontextstrokepath (CTX); -      the}

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.