GreSetStyleRatio
Appearance
GreSetStyleRatio sets the style ratio used by the presentation driver's line-drawing algorithm to determine which pels are turned ON to draw a sloping line.
- Simulation support
- This function is mandatory for display drivers. For other drivers, it is simulated by a handling routine in the graphics engine.
Syntax
GreSetStyleRatio(hdc, pRatio, pInstance, lFunction);
Parameters
- hdc (HDC) - input
- The device context handle.
- pRatio (PBYTE) - input
- Pointer to two unsigned bytes corresponding to the aspect of the pels on which a line is drawn. The style ratio is defined as a two-byte value. The low-order byte indicates a step in the X-direction, and the high-order byte a step in the Y-direction. Typical values for style ratios are:
- For EGA devices, X-direction equals 64 and Y-direction equals 85.
- For one-to-one devices, X-direction equals 64 and Y-direction equals 64. In this case, the style ratio steps are set to 64:64 rather than 1:1 to ensure that a single dot in a line-style pattern is a sensible length. The length of a single dot in the pattern is (256/step_value) pels.
- pInstance (PVOID) - input
- A pointer to instance data.
- lFunction (ULONG) - input
- High-order WORD=flags; low-order WORD=NGreSetStyleRatio.
Return Code
- fSuccess (BOOL) - returns
- Return codes.
- On completion, the handling routine must return BOOLEAN (fSuccess).
- TRUE Successful
- FALSE Error
- Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:
- PMERR_DEV_FUNC_NOT_INSTALLED
- PMERR_INV_HDC
Remarks
Display drivers must support this function so that a hardcopy driver (whose device can have a different style ratio) can use the display driver to draw into a bit map that the hardcopy driver can use.
Declaration
#define INCL_GRE_DEVMISC2 #include <os2.h> HDC hdc; /* The device context handle. */ PBYTE pRatio; PVOID pInstance; /* A pointer to instance data. */ ULONG lFunction; /* High-order WORD=flags; low-order WORD=NGreSetStyleRatio. */ BOOL fSuccess; /* Return codes. */ fSuccess = GreSetStyleRatio(hdc, pRatio, pInstance, lFunction);