1.0 Quartz 2D introduction, 1.0quartz2d Introduction

Source: Internet
Author: User

1.0 Quartz 2D introduction, 1.0quartz2d Introduction

Quartz2D notes:  
(1) Quartz 2D is Apple's official two-dimensional Drawing Engine. It also supports iOS and Mac OS X systems (cross-platform, pure C language)
(2) The Quartz2D API is pure C Language
(3) The Quartz2D API comes from the Core Graphics framework.  
(4) data types and functions are basically prefixed with CG.
  • CGContextRef-graphical context (equivalent to a draft paper)
  • CGPathRef --- graph path
  • CGContextStrokePath (cox); --- Rendering
  Quartz2D api commonly used concatenation path functions:  
// Create a void CGContextMoveToPoint (CGContextRef c, CGFloat x, CGFloat y );
// Add a new line segment to a certain vertex void CGContextAddLineToPoint (CGContextRef c, CGFloat x, CGFloat y );
// Add a rectangle void CGContextAddRect (CGContextRef c, CGRect rect );
// Add an oval 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 );
Jobs that can be completed by Quartz 2D:

 

(1) drawing: lines, triangles, rectangles, circles, and Arcs
(2) Draw text: Graffiti/canvas
(3) Drawing Images/generating images (images)
(4) Reading PDF/generating PDF
(5)/crop an image
(6) gesture unlocking
(7) Report: line chart, pie chart, and bar chart (view animated gif images)
(8) custom UI controls (or custom views) Use Quartz2D to draw their own controls, inherit from the UIView, and override drawRect: The method is used to draw various content examples on the controls: you can use the custom UIView to implement the custom UIImageView. You can use the "download progress bar" control to control the lucky turntable ......
Note:
  • Cocos2D (Cocos2D-x, Cocos2D-iPhone, Cocos2D-HTML5, etc.), is a third-party open source 2D game framework
  • Sprite Kit is also used for 2D games. General 3D games use unity3D.
Quartz2D's value in iOS development:  
To facilitate the construction of a beautiful UI interface, iOS provides the UIKit framework, which has a variety of UI controls UILabel: display text UIImageView: display pictures UIButton: display pictures and text at the same time (click)... ... Using the controls provided by the UIKit framework, you can combine them to build simple and common UI interfaces. However, some UI interfaces are extremely complex and personalized, and cannot be implemented using common UI controls, in this case, the Quartz2D technology can be used to draw the internal structure of the control. In fact, most of the content of the control in iOS is drawn through Quartz2D, one important value of Quartz2D in iOS development is: Custom view (custom UI control)

If you have any questions, please send an e-mail to shorfng@126.com to contact me. By: Loto)

Related Article

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.