Partilhar via


Drawing Lines and Curves

The types of lines and curves included in graphic output are geometric lines, cosmetic lines, and Bezier curves.

For line and curve output, a driver can support the DrvStrokePath, DrvFillPath, and DrvStrokeAndFillPath functions. The driver must support DrvStrokePath for drawing lines if the surface is device-managed; drivers are not required to support curves.

When GDI draws a line or curve with any set of attributes, GDI can call DrvStrokePath. At a minimum, the DrvStrokePath function must support the drawing of solid and styled cosmetic lines with a solid color brush and arbitrary clipping. The GDI PATHOBJ_Xxx and CLIPOBJ_Xxx service functions make this possible by breaking down the lines into a set of lines one pixel wide with precomputed clipping. DrvStrokePath provides a pointer, plineattrs, to the LINEATTRS structure that defines the various line attributes.

When the path or clipping is too complex for the driver to process on the device, the driver can punt the callback to GDI by calling the EngStrokePath function. In this case, GDI can break the DrvStrokePath call into a set of lines one pixel wide with precomputed clipping.

By calling the CLIPOBJ_Xxx services from GDI, a driver can have GDI enumerate all the lines in the path and perform all of the line clipping calculations. In addition, a driver can use the PATHOBJ_Xxx, CLIPOBJ_Xxx, or XFORMOBJ_Xxx services to simplify the graphics operations. For example, a driver can use CLIPOBJ_cEnumStart and CLIPOBJ_bEnum to enumerate the rectangles in a clip region, send this region down to the printer, and clip to it. The driver can also use PATHOBJ_vEnumStart and PATHOBJ_bEnum to enumerate lines or curves in the path. It can then send the path to the device, and stroke it.