Jump to content

DEVESC_DRAFTMODE

From EDM2

GreEscape DEVESC_DRAFTMODE sets draft (text) mode ON or OFF.

Simulation support
This function is mandatory for hardcopy drivers, but may simply return a DEVESC_NOTIMPLEMENTED code. For other drivers, it is simulated by a handling routine in the graphics engine.

Syntax

GreEscape(hdc, lEscape, cInCount, pInData, pcOutCount, pOutData, pInstance, lFunction);

Parameters

hdc (HDC) - input
Device context handle.
lEscape (LONG) - input
DEVESC_DRAFTMODE escape code.
cInCount (LONG) - input
Number of bytes pointed to by pInData. This parameter should be set to 2.
pInData (PBYTE) - input
Short integer value specifying the mode. 1 for draft mode ON, 0 for OFF.
pcOutCount (PLONG) - input
The handling routine ignores this parameter.
pOutData (PLONG) - input
The handling routine ignores this parameter.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreEscape.

Returns

rc (LONG) - returns
Return codes.
The handling routine returns:
DEV_OK
Successful
DEVESC_NOTIMPLEMENTED
Escape not implemented for specified code
DEVESC_ERROR
Error

Remarks

Setting draft mode ON tells the presentation driver that the coming page need not contain any graphics or all-points-addressable output.

This escape code is valid only at a page boundary, for example, after DEVESC_STARTDOC or DEVESC_NEWFRAME.

This escape code is implemented by old hardcopy drivers and is being phased out.

This escape code is metafiled and recorded.

When draft mode is ON, the presentation driver can choose to optimize throughput by:

  • Ignoring all graphics primitives such as lines, arcs, and areas
  • Using the fonts provided by the output device
  • Approximating positions received in calls to functions such as GreSetCurrentPosition and GreCharStringPos to the nearest character position that the output device supports for the current font.

The presentation driver must maintain current attributes such as color, mix, and transforms when draft mode is ON even though they might have no effect on the draft output. Similarly, the driver needs to track font changes and respond by setting the appropriate device font such as enlarged, condensed, or italics.

Note: For an OD_QUEUED device with PM_Q_STD data, the spooler records this escape in the buffer and does not pass it to the presentation driver.

Source Code Sample

Declaration:

#define INCL_GRE_DEVICE
#include <os2.h>

HDC      hdc;         /* Device context handle. */
LONG     lEscape;     /* DEVESC_DRAFTMODE escape code. */
LONG     cInCount;    /* Number of bytes pointed to by pInData. */
PBYTE    pInData;     /* Short integer value specifying the mode. */
PLONG    pcOutCount;  /* The handling routine ignores this parameter. */
PLONG    pOutData;    /* The handling routine ignores this parameter. */
PVOID    pInstance;   /* Pointer to instance data. */
ULONG    lFunction;   /* High-order WORD=flags; low-order WORD=NGreEscape. */
LONG     rc;          /* Return codes. */

rc = GreEscape(hdc, lEscape, cInCount, pInData,
       pcOutCount, pOutData, pInstance, lFunction);