Jump to content

DEVESC_GETSCALINGFACTOR

From EDM2
Revision as of 23:47, 11 July 2025 by Martini (talk | contribs) (Created page with "{{DISPLAYTITLE:DEVESC_GETSCALINGFACTOR}} '''GreEscape DEVESC_GETSCALINGFACTOR''' gets the incremental scaling factors for the (X,Y) axes of a hardcopy device. ;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); ==Par...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GreEscape DEVESC_GETSCALINGFACTOR gets the incremental scaling factors for the (X,Y) axes of a hardcopy device.

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_GETSCALINGFACTOR escape code.
cInCount (LONG) - input
The handling routine ignores this parameter.
pInData (PBYTE) - input
The handling routine ignores this parameter.
pcOutCount (PLONG) - input
Number of bytes pointed to by pOutData.
On return, this is updated by the handling routine to the number of bytes actually returned.
pOutData (PLONG) - input
Pointer to SFACTORS data structure:
lXscale X-scaling factor, as an exponent of 2
lYscale Y-scaling factor, as an exponent of 2
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreEscape.

Returns

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

Remarks

The handling routine returns the scaling factors as an SFACTORS structure at the location addressed by pOutData, and changes the value addressed by pcOutCount to show the number of bytes in the returned structure.

This escape code is not metafiled or recorded.

Scaling factors are used for physical devices where one unit on the X axis is not equal to one unit on the Y axis. The factors show an arbitrary unit length expressed in X units and Y units. The length is chosen so that the number of X units and Y units can be expressed as an exponent of 2 and the exponents are returned in the SFACTORS structure. For example, if there are eight units of X in the arbitrary unit length, lXscale is set to 3.

Note: For an OD_QUEUED device with PM_Q_STD data, the spooler passes this escape to the presentation driver without recording it.

Sample Source Code

Declaration:

#define INCL_GRE_DEVICE
#include <os2.h>

HDC       hdc;           /* Device context handle. */
LONG      lEscape;       /* DEVESC_GETSCALINGFACTOR escape code. */
LONG      cInCount;      /* The handling routine ignores this parameter. */
PBYTE     pInData;       /* The handling routine ignores this parameter. */
PLONG     pcOutCount;    /* Number of bytes pointed to by pOutData. */
PLONG     pOutData;      /* Pointer to SFACTORS data structure: */
PVOID     pInstance;     /* Pointer to instance data. */
ULONG     lFunction;     /* High-order WORD=flags; low-order WORD=NGreEscape. */
LONG      rc;            /* Return Code. */

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