GreSetStyleRatio: Difference between revisions
Appearance
Created page with "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 supp..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
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. | 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. | ;Simulation support: This function is mandatory for display drivers. For other drivers, it is simulated by a handling routine in the graphics engine. | ||
==Syntax== | ==Syntax== | ||
GreSetStyleRatio(hdc, pRatio, pInstance, lFunction) | GreSetStyleRatio(hdc, pRatio, pInstance, lFunction) | ||
==Parameters== | ==Parameters== | ||
;hdc (HDC) - input | ;hdc (HDC) - input:The device context handle. | ||
: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. | |||
;pRatio (PBYTE) - input | :*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. | ||
: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: | ;pInstance (PVOID) - input:A pointer to instance data. | ||
;lFunction (ULONG) - input:High-order WORD=flags; low-order WORD=NGreSetStyleRatio. | |||
:*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== | ==Return Code== | ||
;fSuccess (BOOL) - returns | ;fSuccess (BOOL) - returns:Return codes. | ||
:Return codes. | :On completion, the handling routine must return BOOLEAN (fSuccess). | ||
:*TRUE Successful | |||
:On completion, the handling routine must return BOOLEAN (fSuccess). | :*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: | |||
:*TRUE Successful | :*PMERR_DEV_FUNC_NOT_INSTALLED | ||
:*FALSE Error | :*PMERR_INV_HDC | ||
: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== | ==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. | |||
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== | ==Declaration== | ||
Line 51: | Line 37: | ||
BOOL fSuccess; /* Return codes. */ | BOOL fSuccess; /* Return codes. */ | ||
fSuccess = GreSetStyleRatio(hdc, pRatio, pInstance, | fSuccess = GreSetStyleRatio(hdc, pRatio, pInstance, lFunction); | ||
</PRE> | </PRE> | ||
[[Category:Gre]] | [[Category:Gre]] |
Latest revision as of 09:35, 5 April 2025
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);