Jump to content

GpiSetAttrs

From EDM2
Revision as of 23:12, 2 April 2025 by Iturbide (talk | contribs) (Created page with "This function sets attributes for the specified primitive type. ==Syntax== GpiSetAttrs(hps, lPrimType, flAttrMask, flDefMask, ppbunAttrs); ==Parameters== ;hps (HPS) - input :Presentation-space handle. ;lPrimType (LONG) - input :Primitive type. :The primitive type for which attributes are to be set: :;PRIM_LINE Line and arc primitives :;PRIM_CHAR Character primitives :;PRIM_MARKER Marker primitives :;PRIM_AREA Area primitives :;P...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function sets attributes for the specified primitive type.

Syntax

GpiSetAttrs(hps, lPrimType, flAttrMask, flDefMask, ppbunAttrs);

Parameters

hps (HPS) - input
Presentation-space handle.
lPrimType (LONG) - input
Primitive type.
The primitive type for which attributes are to be set:
PRIM_LINE
       Line and arc primitives 
PRIM_CHAR
       Character primitives 
PRIM_MARKER
       Marker primitives 
PRIM_AREA
       Area primitives 
PRIM_IMAGE
       Image primitives. 
flAttrMask (ULONG) - input
Attributes mask.
Each flag set indicates that either the corresponding flag in flDefMask is set, or the ppbunAttrs buffer contains data for the corresponding attribute. If all of the flags in flAttrMask are 0, the ppbunAttrs buffer address is not used.
Line attributes:
LBB_COLOR
           Line color 

BB_BACK_COLOR

           Line background color 

LBB_MIX_MODE

           Line mix 

LBB_BACK_MIX_MODE

           Line background mix 

LBB_WIDTH

           Line width 

LBB_GEOM_WIDTH

           Geometric line width 

LBB_TYPE

           Line type 

LBB_END

           Line end 

LBB_JOIN

           Line join. 
           Character attributes:
CBB_COLOR
           Character color 
CBB_BACK_COLOR
           Character background color 
CBB_MIX_MODE
           Character mix 
CBB_BACK_MIX_MODE
           Character background mix 
CBB_SET
           Character set 
CBB_MODE
           Character mode 
CBB_BOX
           Character box 
CBB_ANGLE
           Character angle 
CBB_SHEAR
           Character shear 
CBB_DIRECTION
           Character direction 
CBB_TEXT_ALIGN
           Character text alignment 
CBB_EXTRA
           Character extra 
CBB_BREAK_EXTRA
           Character break extra Marker attributes:
MBB_COLOR
           Marker color 
MBB_BACK_COLOR
           Marker background color 
MBB_MIX_MODE
           Marker mix 
MBB_BACK_MIX_MODE
           Marker background mix 
MBB_SET
           Marker set 
MBB_SYMBOL
           Marker symbol 
MBB_BOX
           Marker box. 
Pattern attributes (areas):
ABB_COLOR
           Area color 
ABB_BACK_COLOR
           Area background color 
ABB_MIX_MODE
           Area mix 
ABB_BACK_MIX_MODE
           Area background mix 
ABB_SET
           Pattern set 
ABB_SYMBOL
           Pattern symbol 
ABB_REF_POINT
           Pattern reference point. 
Image attributes:
       IBB_COLOR
           Image color 
IBB_BACK_COLOR
           Image background color 
IBB_MIX_MODE
           Image mix 
IBB_BACK_MIX_MODE
           Image background mix. 
flDefMask (ULONG) - input
Defaults mask.
Each flag set (and for which flAttrMask is also set) causes the corresponding attribute to be set to its default value.
ppbunAttrs (PBUNDLE) - input
Attributes.
This is a structure containing the attribute value of each attribute for which the flAttrMask flag is set (and which is not to be set to its default value), at the correct offset as specified below for the particular primitive type.
Primitive type
Structure Line attributes
                   LINEBUNDLE 
Character attributes
                   CHARBUNDLE 
Marker attributes
                   MARKERBUNDLE 
Pattern attributes (areas)
                   AREABUNDLE 
Image attributes
                   IMAGEBUNDLE 


Returns

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

Errors

Remarks

Example Code

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

HPS        hps;         /*  Presentation-space handle. */
LONG       lPrimType;   /*  Primitive type. */
ULONG      flAttrMask;  /*  Attributes mask. */
ULONG      flDefMask;   /*  Defaults mask. */
PBUNDLE    ppbunAttrs;  /*  Attributes. */
BOOL       rc;          /*  Success indicator. */

rc = GpiSetAttrs(hps, lPrimType, flAttrMask, flDefMask, ppbunAttrs);

Related Functions

  • GpiPop
  • GpiQueryAttrs
  • GpiSetAttrMode
  • GpiSetDefAttrs

Graphic Elements and Orders

The element type depends on the lPrimType parameter.

For each element, the "Set" orders are generated, if the attribute mode (see GpiSetAttrMode) is set to AM_NOPRESERVE, and the "Push and Set" orders if it is AM_PRESERVE. In either instance, a particular order is generated only if the corresponding attribute is being set with this function, as specified on the ppbunAttrs parameter.

   Element Type: ETYPE_LINEBUNDLE
       Generated if lPrimType is PRIM_LINE.
       Order: Set Individual Attribute
           One of these for each of LBB_COLOR and LBB_BACK_MIX_MODE, as required. Order: Set Fractional Line Width
           LBB_WIDTH, as required. Order: Set Stroke Line Width
           LBB_GEOM_WIDTH, as required. Order: Set Line Type
           LBB_TYPE, as required. Order: Set Line End
           LBB_END, as required. Order: Set Line Join
           LBB_JOIN, as required. As many as required of the following are generated if the attribute mode is AM_PRESERVE:
           Order: Push and Set Individual Attribute
               One of these for each of LBB_COLOR and LBB_MIX_MODE, as required. Order: Push and Set Fractional Line Width
               LBB_WIDTH, as required. Order: Push and Set Stroke Line Width
               LBB_GEOM_WIDTH, as required. Order: Push and Set Line Type
               LBB_TYPE, as required. Order: Push and Set Line End
               LBB_END, as required. Order: Push and Set Line Join
               LBB_JOIN, as required. Element Type: ETYPE_CHARBUNDLE
               Generated if lPrimType is PRIM_CHAR.
               Order: Set Individual Attribute
                   One of these for each of CBB_COLOR, CBB_BACK_COLOR, CBB_MIX_MODE, and CBB_BACK_MIX_MODE, as required. Order: Set Character Set
                   CBB_SET Order: Set Character Precision
                   CBB_MODE Order: Set Character Cell
                   CBB_BOX Order: Set Character Angle
                   CBB_ANGLE Order: Set Character Shear
                   CBB_SHEAR Order: Set Character Direction
                   CBB_DIRECTION As many as required of the following are generated if the attribute mode is AM_PRESERVE:
                   Order: Push and Set Individual Attribute
                       One of these for each of CBB_COLOR, CBB_BACK_COLOR, CBB_MIX_MODE, and CBB_BACK_MIX_MODE, as required. Order: Push and Set Character Set
                       CBB_SET Order: Push and Set Character Precision
                       CBB_MODE Order: Set Character Cell
                       CBB_BOX Order: Set Character Angle
                       CBB_ANGLE Order: Push and Set Character Shear
                       CBB_SHEAR Order: Push and Set Character Direction
                       CBB_DIRECTION Element Type: ETYPE_MARKERBUNDLE
                       Generated if lPrimType is PRIM_MARKER.
                       Order: Set Individual Attribute
                           One of these for each of MBB_COLOR, MBB_BACK_COLOR, MBB_MIX_MODE, and MBB_BACK_MIX_MODE, as required. Order: Set Marker Set
                           MBB_SET Order: Set Marker Symbol
                           MBB_SYMBOL Order: Set Marker Cell
                           MBB_BOX As many as required of the following are generated if the attribute mode is AM_PRESERVE:
                           Order: Push and Set Individual Attribute
                               One of these for each of MBB_COLOR, MBB_BACK_COLOR, MBB_MIX_MODE, and MBB_BACK_MIX_MODE, as required. Order: Push and Set Marker Set
                               MBB_SET Order: Push and Set Marker Symbol
                               MBB_SYMBOL Order: Push and Set Marker Cell
                               MBB_BOX Element Type: ETYPE_AREABUNDLE
                               Generated if lPrimType is PRIM_AREA.
                               Order: Set Individual Attribute
                                   One of these for each of ABB_COLOR, ABB_BACK_COLOR, ABB_MIX_MODE, and ABB_BACK_MIX_MODE, as required. Order: Set Pattern Set
                                   ABB_SET Order: Set Pattern Symbol
                                   ABB_SYMBOL Order: Set Pattern Reference Point
                                   ABB_REF_POINT As many as required of the following are generated if the attribute mode is AM_PRESERVE:
                                   Order: Push and Set Individual Attribute
                                       One of these for each of ABB_COLOR, ABB_BACK_COLOR, ABB_MIX_MODE, and ABB_BACK_MIX_MODE, as required. Order: Push and Set Pattern Set
                                       ABB_SET Order: Push and Set Pattern Symbol
                                       ABB_SYMBOL Order: Push and Set Pattern Reference Point
                                       ABB_REF_POINT Element Type: ETYPE_IMAGEBUNDLE
                                       Generated if lPrimType is PRIM_IMAGE.
                                       Order: Set Individual Attribute
                                           One of these for each of IBB_COLOR, IBB_BACK_COLOR, IBB_MIX_MODE, and IBB_BACK_MIX_MODE, as required. As many as required of the following are generated if the attribute mode is AM_PRESERVE:
                                           Order: Push and Set Individual Attribute
                                               One of these for each of IBB_COLOR, IBB_BACK_COLOR, IBB_MIX_MODE, and IBB_BACK_MIX_MODE, as required.