A path is one of the objects associated with a device context (DC). However, unlike the default objects (the pen, the brush, and the font) that are part of any new DC, there is no default path. For more information about DCs, see Device Contexts.
To create a path and select it into a DC, it is first necessary to define the points that describe it. This is done by calling the BeginPath function, specifying the appropriate drawing functions, and then by calling the EndPath function. This combination of functions (BeginPath, drawing functions, and EndPath) constitute a path bracket. The following functions can be used in a path bracket.
AngleArc | LineTo | Polyline |
Arc | MoveToEx | PolylineTo |
ArcTo | Pie | PolyPolygon |
Chord | PolyBezier | PolyPolyline |
CloseFigure | PolyBezierTo | Rectangle |
Ellipse | PolyDraw | RoundRect |
ExtTextOut | Polygon | TextOut |
When an application calls EndPath, Windows selects the associated path into the specified DC. (If another path had previously been selected into the DC, Windows deletes that path without saving it.) After Windows selects the path into the DC, an application can operate on the path in one of the following ways:
·Draw the outline of the path (using the current pen).
·Paint the interior of the path (using the current brush).
·Draw the outline and fill the interior of the path.
·Modify the path (converting curves to line segments).
·Convert the path into a clip path.
·Convert the path into a region.
·Flatten the path by converting each curve in the path into a series of line segments.
·Retrieve the coordinates of the lines and curves that compose a path.