GpiSetPattern: Difference between revisions
Created page with "This function sets the current value of the pattern-symbol attribute. ==Syntax== <PRE> #define INCL_GPIPRIMITIVES →Or use INCL_GPI, INCL_PM, Also in COMMON section: #incl..." |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
==Syntax== | ==Syntax== | ||
GpiSetPattern (hps, lPatternSymbol) | |||
==Parameters== | ==Parameters== | ||
; hps (HPS) - input : Presentation-space handle. | ; hps (HPS) - input : Presentation-space handle. | ||
; lPatternSymbol (LONG) - input : Pattern symbol. | ; 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. | |||
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: | Possible values if the default pattern set has been selected are shown in the following table: | ||
{|class="wikitable" width=90% | {|class="wikitable" width=90% | ||
!Symbolic name||Description||Pattern number<br/>(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. | |||
[[image:GpiSetPattern-001.png]] | |||
another base pattern. | |||
If the specified pattern is not valid, the default (device-dependent) pattern is used. | |||
==Return Code== | ==Return Code== | ||
; rc (BOOL) - returns : Success indicator. | ;rc (BOOL) - returns : Success indicator. | ||
* TRUE Successful completion | * TRUE Successful completion | ||
* FALSE Error occurred. | * FALSE Error occurred. | ||
==Errors== | ==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== | ==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== | ==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. | |||
<PRE> | <PRE> | ||
#define INCL_GPIPRIMITIVES | |||
#include <OS2.H> | |||
HPS hps; /* Presentation-space */ | |||
/* handle. */ | |||
GpiSetPattern(hps,PATSYM_HORIZ); | |||
</PRE> | </PRE> | ||
==Related Functions== | ==Related Functions== | ||
* [[GpiBeginArea]] | |||
* [[GpiEndArea]] | |||
* [[GpiQueryPattern]] | |||
* [[GpiSetAttrMode]] | |||
* [[GpiSetAttrs]] | |||
* [[GpiSetBackColor]] | |||
* [[GpiSetBackMix]] | |||
* [[GpiSetColor]] | |||
* [[GpiSetDefAttrs]] | |||
* [[GpiSetMix]] | |||
* [[GpiSetPatternRefPoint]] | |||
* [[GpiSetPatternSet]] | |||
[[Category:Gpi]] | [[Category:Gpi]] |
Latest revision as of 23:31, 7 April 2025
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.
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);