2D Z 2D drawing and quartz2d drawing

Source: Internet
Author: User

2D Z 2D drawing and quartz2d drawing

Quartz 2D drawing can only be rewritten to drawRect in UIView: This method is used for drawing. It is invalid in other places and an error is returned.

Drawing Process:

1. Obtain the context CGContextRef context = UIGraphicsGetCurrentContext ();

2. Add the graph CGContextAddRect (context, CGRectMake (50, 50,100,100 ));

3. Draw the graph CGContextDrawPath (context, kCGPathEOFill );

4. Disable the context CGContextClosePath (context );

 

Quartz 2D Coordinate System Transformation

1. The CGContextRotateCTM (CGContextRef c, CGFloat angle) method can rotate the context coordinate system relative to the origin.

2. The CGContextTranslateCTM (CGContextRef c, CGFloat tx, CGFloat ty) method can translate the context coordinate system relative to the origin.

3. The CGContextScaleCTM (CGContextRef c, CGFloat sx, CGFloat sy) method can scale the context coordinate system.

 

Note:

Use CGContextSaveGState (CGContextRef c) to save the current context status before converting the Coordinate System

After the coordinate system is converted, you can use CGContextRestoreGState (CGContextRef c) to restore the previously saved context status.

 

Quartz basic Plotting Method

CGContextBeginPath start a new path CGContextMoveToPoint set path start CGContextClosePath close path CGContextAddPath add path else add line CGContextAddLines add multiple lines CGContextAddRect add rectangle CGContextAddRects add multiple rectangles else add in the rectangle area elliptical CGContextAddArc add an arc CGContextAddArcToPoint add an arc CGContextAddCurveToPoint cgcgcgcontextdrawpath Add a curve CGContextDrawPath Add a solid path CGContextFillPath Add a solid rectangle CGContextFillRects multiple solid rectangles drawing a solid elliptical CGContextStrokePath path CGContextStrokeRect hollow rectangle fill draw hollow rectangle using width fill draw hollow rectangle fill draw hollow elliptical CGContextSetLineWidth Set width CGContextSetBlendMode set mixed mode fill set anti-sawtooth effect CGContextSetLineCap set Line ending point style CGContextSetLineJoin set line connection point style CGContextSetLineDash

  


What does quartz do? In what ways?

It is generally used for regular job scheduling. For example, to execute a xx operation every Sunday, it is to start a thread in the background.

What graphics software is easy to use? 2D plotting software that can be colored

To draw cartoons, use COMICSTUDIO. If you just draw a single PHOTOSHOP, PAINTER, or SAI, you can

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.