Immutable and mutable types for graphics paths: mathematical descriptions of shapes or lines to be drawn in a graphics context.
CGMutable define functions to draw a path. To draw a Core Graphics path to a graphics context, you add the path to the graphics context by calling
add and then call one of the context’s drawing functions—see CGContext.
Each figure in the graphics path is constructed with a connected set of lines and Bézier curves, called a subpath. A subpath has an ordered set of path elements that represent single steps in the construction of the subpath. (For example, a line segment from one corner of a rectangle to another corner is a path element. Every subpath includes a starting point, which is the first point in the subpath. The path also maintains a current point, which is the last point in the last subpath.
To append a new subpath onto a mutable path, your application typically calls
move to set the subpath’s starting point and initial current point, followed by a series of "add” calls (such as
add) to add line segments and curves to the subpath. As segments or curves are added to the subpath, the subpath’s current point is updated to point to the end of the last segment or curve to be added. The lines and curves of a subpath are always connected, but they are not required to form a closed set of lines. Your application explicitly closes a subpath by calling
close. Closing the subpath adds a line segment that terminates at the subpath’s starting point, and also changes how those lines are rendered—for more information see Paths in Quartz 2D Programming Guide.