1.0 Quartz 2D Introduction

Source: Internet
Author: User

Quartz2d notes:
(1) Quartz 2D is Apple's official two-dimensional drawing engine that supports both iOS and Mac OS x systems (cross-platform, pure C-language)
(2) quartz2d API is a pure C language
(3) Quartz2d API from the core graphics framework
(4) data types and functions are basically prefixed with CG
  • cgcontextref--Graphics context (equivalent to a draft paper)
  • Cgpathref ——— Graphics Path
  • Cgcontextstrokepath (cox); ——— rendering
quartz2d API Common Stitching path function:
Create a new starting point void Cgcontextmovetopoint (Cgcontextref C, CGFloat x, cgfloat y);
Add a new segment to a point void Cgcontextaddlinetopoint (Cgcontextref C, CGFloat x, cgfloat y);
Add a rectangle void Cgcontextaddrect (cgcontextref C, CGRect rect);
Add an ellipse void Cgcontextaddellipseinrect (cgcontextref context, cgrect rect);
Add an arc
void Cgcontextaddarc (Cgcontextref C, CGFloat x, cgfloat y, cgfloat radius, cgfloat startangle, CGFloat Endangle, int clockwise);
Quartz 2D can do the job:

(1) Drawing: lines/triangles/rectangles/circles/arcs, etc.
(2) Drawing text: Graffiti/artboards
(3) Draw picture/Generate picture (image)
(4) Read pdf/generate PDF
(5)/Crop picture
(6) Gesture unlock
(7) Report: Line chart/pie chart/Histogram (view animated GIF pictures)
(8) Custom UI controls (or called Custom view) draw their own controls through quartz2d, by inheriting from UIView, overriding DrawRect: Method implementations to draw various examples of content on the control: Custom Uiimageview by inheriting from UIView Implement a custom "download progress bar" Control for the lucky Carousel control ...
Attention:
    • Cocos2d (Cocos2d-x, Cocos2d-iphone, COCOS2D-HTML5, etc.), is a third party open-source 2D game Framework
    • The 2D game also has the Sprite Kit. General 3D games with Unity3d.
The value of quartz2d in iOS development:
To facilitate an aesthetically pleasing UI, iOS provides a uikit framework with a wide variety of UI controls Uilabel: Display text uiimageview: Show picture UIButton: Display pictures and text at the same time (can click) ... Use the controls provided by the Uikit framework to make a piece of the simple, common UI interface that can be built and realistic however, some UI interfaces are extremely complex and more personalized and cannot be implemented with normal UI controls, so you can use quartz2d technology to draw the structure inside the control, and customize the shape of the control. In fact, the content of most controls in iOS is drawn through quartz2d. Therefore, one of the most important values of quartz2d in iOS development is the custom view (custom UI control)

If in doubt, please send an email to [email protected] contact me. by : Lantian (Loto)

1.0 Quartz 2D Introduction

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.