Drawing on the graphic context
Thanks to the core graphics frameworks, you can access the Quartz 2D engine, an API based on interesting drawing tools such as path-based design, color management, transformations, masking, and color blending.
Note
Note that it is common to refer to core graphics and Quartz 2D interchangeably. To be precise, core graphics is the framework that contains Quartz 2D; all the functions of this API use CG as prefix. Quartz 2D is not to be confused with Quartz Core, though. The latter is in fact the framework that contains core animation and core image.
When it comes to using core graphics, the main rule of thumb is that if you want to perform any kind of drawing, you need to get access to a graphic context. The context becomes a sort of dashboard where all the drawing operations are executed.
The data type that represents a context is CGContextRef
(or just CGContext
), which is an opaque object that encapsulates all the information needed to draw, depending on the drawing...