GpiSetLineWidth: Difference between revisions
No edit summary |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
; hps ([[HPS]]) - input | ; hps ([[HPS]]) - input: Presentation-space handle. | ||
: Presentation-space handle. | ; fxLineWidth ([[FIXED]]) - input: Line-width multiplier. | ||
::LINEWIDTH_DEFAULT: Use default; same as LINEWIDTH_NORMAL (unless changed with [[GpiSetDefAttrs]]). | |||
; fxLineWidth ([[FIXED]]) - input | ::LINEWIDTH_NORMAL: Normal width (1.0). | ||
: Line-width multiplier. | :::Any other positive value is a multiplier on the "normal" line width. | ||
: | ::LINEWIDTH_THICK: Thick. | ||
: | |||
: | |||
: | |||
:: Where only two line thicknesses, "normal" and "thick", are supported, "normal" will be used for values less than or equal to 1.0 (other than LINEWIDTH_DEFAULT), and "thick" otherwise. | :: Where only two line thicknesses, "normal" and "thick", are supported, "normal" will be used for values less than or equal to 1.0 (other than LINEWIDTH_DEFAULT), and "thick" otherwise. | ||
:: See "[[DevQueryCaps]]" in the Presentation Manager Programming Reference (CAPS_ADDITIONAL_GRAPHICS and CAPS_LINEWIDTH_THICK). | :: See "[[DevQueryCaps]]" in the Presentation Manager Programming Reference (CAPS_ADDITIONAL_GRAPHICS and CAPS_LINEWIDTH_THICK). | ||
| Line 53: | Line 47: | ||
==Example Code== | ==Example Code== | ||
This function sets the line width to the default, so that there is no multiplying factor. | This function sets the line width to the default, so that there is no multiplying factor. | ||
<pre> | <pre> | ||
#define INCL_GPIPRIMITIVES | #define INCL_GPIPRIMITIVES | ||
#include | #include <OS2.H> | ||
HPS hps; /* Presentation-space handle. */ | HPS hps; /* Presentation-space handle. */ | ||
Latest revision as of 01:56, 24 November 2025
This function sets the current cosmetic line-width attribute.
Syntax
GpiSetLineWidth(hps, fxLineWidth)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- fxLineWidth (FIXED) - input
- Line-width multiplier.
- LINEWIDTH_DEFAULT: Use default; same as LINEWIDTH_NORMAL (unless changed with GpiSetDefAttrs).
- LINEWIDTH_NORMAL: Normal width (1.0).
- Any other positive value is a multiplier on the "normal" line width.
- LINEWIDTH_THICK: Thick.
- Where only two line thicknesses, "normal" and "thick", are supported, "normal" will be used for values less than or equal to 1.0 (other than LINEWIDTH_DEFAULT), and "thick" otherwise.
- See "DevQueryCaps" in the Presentation Manager Programming Reference (CAPS_ADDITIONAL_GRAPHICS and CAPS_LINEWIDTH_THICK).
Return Value
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion
- FALSE
- Error occurred.
Remarks
The cosmetic line width specifies a multiplier on the "normal" line thickness for the device. Cosmetic thickness does not depend upon transforms, so that, for example, lines do not become thicker when a "zoom-in" occurs. The attribute mode (see GpiSetAttrMode) determines whether the current value of the line-width attribute is preserved.
Errors
Possible returns from WinGetLastError:
- PMERR_INV_HPS (0x207F)
- An invalid presentation-space handle was specified.
- PMERR_PS_BUSY (0x20F4)
- An attempt was made to access the presentation space from more than one thread simultaneously.
- PMERR_INV_LINE_WIDTH_ATTR (0x2096)
- An invalid line width attribute value was specified or the default value was explicitly specified with GpiSetAttrs instead of using the defaults mask.
- PMERR_UNSUPPORTED_ATTR_VALUE (0x210A)
- An attribute value was specified with GpiSetAttrs that is not supported.
Graphic Elements and Orders
Element Type: OCODE_GSFLW This element type is generated if the attribute mode (see GpiSetAttrMode) is set to AM_NOPRESERVE. Order: Set Fractional Line Width
Element Type: OCODE_GPSFLW This element type is generated if the attribute mode is set to AM_PRESERVE. Order: Push and Set Fractional Line Width
Example Code
This function sets the line width to the default, so that there is no multiplying factor.
#define INCL_GPIPRIMITIVES #include <OS2.H> HPS hps; /* Presentation-space handle. */ GpiSetLineWidth(hps, LINEWIDTH_NORMAL);