Cover by Joe Conway, Aaron Hillegass

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Core Graphics

The functions and types that begin with CG come from the Core Graphics framework, a C language API for 2D drawing. The hub of the Core Graphics framework is CGContextRef: all other Core Graphics functions and types interact with a drawing context in some way, and then the context creates an image.

Let’s look at the Core Graphics functions you used in the implementation of HypnosisView’s drawRect: method. You set up the drawing state with CGContextSetLineWidth and then set its color using CGContextSetRGBStrokeColor.

Next, you added a path to the context using CGContextAddArc. A path is a collection of points that forms a shape and can form anything from a square to a circle to a human outline. There are a number of Core Graphics ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required