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)