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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access