END_PATH

Syntax

short Escape(hDC, END_PATH, sizeof(PATH_INFO),lpInData, NULL)

This escape ends a path. A path is a connected sequence of primitives drawn in succession to form a single polyline or polygon. Paths enable applications to draw complex borders, filled shapes, and clipping areas by supplying a collection of other primitives defining the desired shape.

Printer escapes supporting paths enable applications to render images on sophisticated devices such as PostScript printers without generating huge polygons to simulate them.

To draw a path, an application first issues the BEGIN_PATH escape. It then draws the primitives defining the border of the desired shape and issues an END_PATH escape.

The END_PATH escape takes as a parameter a pointer to a structure specifying the manner in which the path is to be rendered. The structure specifies whether or not the path is to be drawn and whether it is open or closed. Open paths define polylines, and closed paths define fillable polygons.

Parameter Type/Description  

hDC HDC Identifies the device context.  
lpInData PATH_INFO FAR * Points to a PATH_INFO data structure that defines how the path is to be rendered. See the following “Comments” section for more information on this data structure.  

Return Value

The return value specifies the current path nesting level. If the escape is successful, the return value is the number of BEGIN_PATH escape calls without a corresponding END_PATH call. Otherwise, the return value is –1.

Comments

An application may begin a subpath within another path. If the subpath is closed, it is treated exactly like a polygon. If it is open, it is treated exactly like a polyline.

An application may use the CLIP_TO_PATH escape to define a clipping area corresponding to the interior or exterior of the currently open path.

The lpInData parameter points to a PATH_INFO data structure that specifies how to render the path. This data structure has the following form:

typedef struct {

short RenderMode;

BYTE FillMode;

BYTE BkMode;

LOGPEN Pen;

LOGBRUSH Brush;

DWORD BkColor;

}PATH_INFO;

The PATH_INFO structure has the following fields:

Field Description  

RenderMode Specifies how the path is to be rendered. It may be one of the following values:  
  Value Meaning
  NO_DISPLAY (0) The path is not drawn.
  OPEN (1) The path is drawn as an open polygon.
  CLOSED (2) The path is drawn as a closed polygon.
FillMode Specifies how the path is to be filled. It can be one of the following values:  
  Value Meaning
  ALTERNATE (1) The fill is done using the alternate fill algorithm.
  WINDING (2) The fill is done using the winding fill algorithm.
BkMode Specifies the background mode for filling the path. It can be one of the following values:  
  Value Meaning
  OPAQUE The background is filled with the background color before the brush is drawn.
  TRANSPARENT The background is not changed.
Pen Specifies the pen with which the path is to be drawn. If RenderMode is set to NO_DISPLAY, the pen is ignored.  
Brush Specifies the brush with which the path is to be filled. If RenderMode is set to NO_DISPLAY or OPEN, the brush is ignored.  
BkColor Specifies the color with which the path is filled if BkMode is set to OPAQUE.