Jump to content

GpiSetLineWidth: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
Line 53: Line 53:


==Example Code==
==Example Code==
<PRE>
#define INCL_GPIPRIMITIVES /* Or use INCL_GPI, INCL_PM, */
#include &lt;os2.h&gt;
HPS    hps;        /* Presentation-space handle. */
FIXED  fxLineWidth; /* Line-width multiplier. */
BOOL    rc;          /* Success indicator. */
rc = GpiSetLineWidth(hps, fxLineWidth);
</PRE>
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 &lt;OS2.H&gt;
#include <OS2.H>


HPS hps; /* Presentation-space handle. */
HPS hps; /* Presentation-space handle. */

Revision as of 01:55, 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);

Related Functions