GpiSetPattern

From EDM2
Jump to: navigation, search

This function sets the current value of the pattern-symbol attribute.

Syntax

GpiSetPattern (hps, lPatternSymbol)

Parameters

hps (HPS) - input 
Presentation-space handle.
lPatternSymbol (LONG) - input 
Pattern symbol.
Identifies the shading pattern to be used to fill areas. The pattern that appears depends on the particular pattern set selected by the pattern-set attribute. A value of 0 selects the default pattern and values in the range 1 through 255 select particular patterns within the set.

Possible values if the default pattern set has been selected are shown in the following table:

Symbolic name Description Pattern number
(see Figure under Notes)
PATSYM_DEFAULT The default; same as PATSYM_SOLID (unless changed with GpiSetDefAttrs).
PATSYM_DENSE1 through PATSYM_DENSE8 Solid shading with decreasing density 1 through 8
PATSYM_VERT Vertical pattern 9 9
PATSYM_HORIZ Horizontal pattern 10
PATSYM_DIAG1 Diagonal pattern 1, bottom left to top right 11
PATSYM_DIAG2 Diagonal pattern 2, bottom left to top right 12
PATSYM_DIAG3 Diagonal pattern 3, top left to bottom right 13
PATSYM_DIAG4 Diagonal pattern 4, top left to bottom right 14
PATSYM_NOSHADE No shading 15
PATSYM_SOLID Solid shading 16
PATSYM_HALFTONE Alternate pels set on
PATSYM_BLANK Blank (same as PATSYM_NOSHADE)
Note
The pattern PATSYM_HALFTONE can be the same as PATSYM_DENSE4. On non bit-mapped devices it may be mapped to another base pattern. If the specified pattern is not valid, the default (device-dependent) pattern is used.

GpiSetPattern-001.png

Return Code

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

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_PATTERN_ATTR (0x20B0) 
An invalid pattern symbol attribute value was specified or the default value was explicitly specified with GpiSetAttrs instead of using the defaults mask.

Remarks

Any symbol from a raster font can be used as a pattern by the appropriate use of this function and the GpiSetPatternSet function.

If the current pattern set specifies a bit map (see GpiSetBitmapId and GpiSetPatternSet), the pattern attribute is ignored.

If lPatternSymbol is set or defaulted to PATSYM_SOLID, and the lSet parameter of GpiSetPatternSet is LCID_DEFAULT, pattern colors that are not available may be approximated by dithering (unless dithering has been disabled by setting the LCOL_PURECOLOR bit on the flOptions parameter of GpiCreateLogColorTable).

This function must not be issued in an area or path bracket.

The attribute mode (see GpiSetAttrMode) determines whether the current value of the pattern symbol is preserved.

Graphic Elements and Orders

Element Type: OCODE_GSPT This element type is generated if the attribute mode (see GpiSetAttrMode) is set to AM_NOPRESERVE. Order: Set Pattern Symbol

Element Type: OCODE_GPSPT This element type is generated if the attribute mode is set to AM_PRESERVE. Order: Push and Set Pattern Symbol

Example Code

This function sets the current value of the pattern-symbol to horizontal. This means that when areas are filled, they are filled with a horizontal shading pattern.

#define INCL_GPIPRIMITIVES
#include <OS2.H>

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

GpiSetPattern(hps,PATSYM_HORIZ);

Related Functions