Jump to content

GpiSetLineWidth

From EDM2
Revision as of 20:44, 6 April 2025 by Iturbide (talk | contribs) (Created page with "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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

#define INCL_GPIPRIMITIVES /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>

HPS     hps;         /* Presentation-space handle. */
FIXED   fxLineWidth; /* Line-width multiplier. */
BOOL    rc;          /* Success indicator. */

rc = GpiSetLineWidth(hps, fxLineWidth);

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);

Related Functions