S2d (2)

Source: Internet
Author: User

1. quartz2d Memory Management
Objects Created using functions that contain "CREATE" or "copy" must be released after use; otherwise, memory leakage will occur.
Objects obtained using functions that do not contain "CREATE" or "copy" do not need to be released.
If you have retain an object, you need to release it when it is no longer in use.
You can use the quartz2d function to specify the retain and release objects. For example, if a cgcolorspace object is created, the cgcolorspaceretain and cgcolorspacerelease functions are used to retain and release objects.
You can also use cfretain and cfreliase of core Foundation. ** Note that null values cannot be passed to these functions **

2. Use quartz2d to add image watermarks
Core code
Enable a bitmap-based image Context
Void uigraphicsbeginimagecontextwitexceptions (cgsize size, bool opaque, cgfloat sacle)
Obtain an image (uiimage) from the context)
Uiimage * uigraphicegetimagefromcurrentimagecontext ();
Ends a bitmap-based image context.
Void uigraphiceendimagecontext ();

3. Crop Images
Sometimes you need to crop a normal image into a circle.
Core code
Void cgcontextclip (cgcontextref C)
Crop the path drawn by the current context (none beyond this cropping area can be displayed)

Sometimes you need to capture a piece of content on the screen.
Core code
-(Void) renderincontext :( cgcontextref) CTX;
Call the renderincontext of a view layer: method.

S2d (2)

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.