Jump to content

GpiSetLineWidthGeom

From EDM2
Revision as of 20:44, 6 April 2025 by Iturbide (talk | contribs) (Created page with "This function sets the current geometric line-width attribute. ==Syntax== GpiSetLineWidthGeom(hps, lLineWidth) ==Parameters== ; hps (HPS) - input : Presentation-space handle. ; lLineWidth (LONG) - input : Geometric line width. : The geometric line width in world coordinates. It must not be negative. : A thickness of 0 results in an area of 0 width. Because filling includes the boundaries, this results in the thinnest possible lines and arcs, regardless of wha...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function sets the current geometric line-width attribute.

Syntax

GpiSetLineWidthGeom(hps, lLineWidth)

Parameters

hps (HPS) - input
Presentation-space handle.
lLineWidth (LONG) - input
Geometric line width.
The geometric line width in world coordinates. It must not be negative.
A thickness of 0 results in an area of 0 width. Because filling includes the boundaries, this results in the thinnest possible lines and arcs, regardless of what transforms are in force.
The initial default value of the geometric line width is 1. This can be changed with GpiSetDefAttrs. Note: The default line width has been 1 since version 2.0 of the operating system. Prior to that, a wider default line width was used.

Return Value

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Remarks

The geometric line-width attribute is used only in the GpiModifyPath function (with a lMode of MPATH_STROKE) or in the GpiStrokePath function. This attribute specifies the width to be used in converting the lines and arcs, of which the path is composed, into wide lines and arcs. The resulting shape is treated like an area, so the boundaries are considered to be part of its interior. This means that the width of the lines and arcs is one pel wider than the geometric line width transformed to device coordinates. The geometric line width is specified in world-coordinate units, so that, for example, the thickness varies on a zoom operation. Normal line and curve drawing uses only the cosmetic line width (see GpiSetLineWidth). This function must not be issued within an area or path bracket. The attribute mode (see GpiSetAttrMode) determines whether the current value of the geometric line width 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_GEOM_LINE_WIDTH_ATTR (0x2078)
An invalid geometric line width attribute value was specified.

Graphic Elements and Orders

Element Type: OCODE_GSSLW This element type is generated if the attribute mode (see GpiSetAttrMode) is set to AM_NOPRESERVE. Order: Set Stroke Line Width

Element Type: OCODE_GPSSLW This element type is generated if the attribute mode is set to AM_PRESERVE. Order: Push and Set Stroke Line Width

Example Code

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

HPS     hps;         /* Presentation-space handle. */
LONG    lLineWidth;  /* Geometric line width. */
BOOL    rc;          /* Success indicator. */

rc = GpiSetLineWidthGeom(hps, lLineWidth);

This function sets the line width geometry to double the default of 1.

#define INCL_GPIPRIMITIVES
#include <OS2.H>

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

GpiSetLineWidthGeom(hps, 2L);

Related Functions