GpiSetLineType
This function sets the current cosmetic line-type attribute.
Syntax
GpiSetLineType(hps, lLineType)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- lLineType (LONG) - input
- Line types available.
Return Value
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion
- FALSE
- Error occurred.
Remarks
A nonsolid line type consists of a sequence of "on" and "off" runs of pels that gives the appearance of a dotted or a dashed line, for example. This attribute specifies the cosmetic line type, which is used for all line and curve drawing. It does not depend upon transforms, so that, for example, dashes do not become longer when a "zoom in" occurs. The standard line types are implemented on each device to give a good appearance on that device, taking into account the pel resolution. Their definitions cannot be changed by applications, nor may applications define additional cosmetic line types. The system maintains position within the line-type definition so that, for example, a curve may be implemented as a polyline. However, some functions cause position to be reset to the start of the definition. These are:
- GpiCallSegmentMatrix
- GpiMove
- GpiPop (or end of called segment) that pops current position or a model transform
- GpiSetCurrentPosition
- GpiSetLineType
- GpiSetModelTransformMatrix
- GpiSetPageViewport
- GpiSetSegmentTransformMatrix.
The default line-type is solid. This can be changed with GpiSetDefAttrs. The attribute mode (see GpiSetAttrMode) determines whether the current value of the line-type 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_TYPE_ATTR (0x2095)
- An invalid line type attribute value was specified or the default value was explicitly specified with GpiSetAttrs instead of using the defaults mask.
Graphic Elements and Orders
- Element Type
- OCODE_GSLT
This element type is generated if the attribute mode (see GpiSetAttrMode) is set to AM_NOPRESERVE. Order: Set Line Type
- Element Type
- OCODE_GPSLT
This element type is generated if the attribute mode is set to AM_PRESERVE. Order: Push and Set Line Type
Example Code
#define INCL_GPIPRIMITIVES /* Or use INCL_GPI, INCL_PM, */ #include <os2.h> HPS hps; /* Presentation-space handle. */ LONG lLineType; /* Line types available. */ BOOL rc; /* Success indicator. */ rc = GpiSetLineType(hps, lLineType);
This function sets the line-type to be round (as opposed to bevel or miter).
#define INCL_GPIPRIMITIVES #include <OS2.H> HPS hps; /* Presentation-space handle. */ GpiSetLineType(hps, LINETYPE_DEFAULT);