Jump to content

GpiSetAttrs: Difference between revisions

From EDM2
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..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
This function sets attributes for the specified primitive type.  
This function sets attributes for the specified primitive type.


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


==Parameters==
==Parameters==
;hps (HPS) - input
;hps (HPS) - input:Presentation-space handle.
:Presentation-space handle.  
;lPrimType (LONG) - input:Primitive type.
 
;lPrimType (LONG) - input
:Primitive type.
:The primitive type for which attributes are to be set:
:The primitive type for which attributes are to be set:
 
::PRIM_LINE - Line and arc primitives
:;PRIM_LINE
::PRIM_CHAR - Character primitives
        Line and arc primitives  
::PRIM_MARKER - Marker primitives
:;PRIM_CHAR
::PRIM_AREA - Area primitives
        Character primitives  
::PRIM_IMAGE - Image primitives.
:;PRIM_MARKER
;flAttrMask (ULONG) - input:Attributes mask.
        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.
: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:
:Line attributes:
 
::LBB_COLOR - Line color
:;LBB_COLOR
::LBB_BACK_COLOR - Line background color
            Line color  
::LBB_MIX_MODE - Line mix
BB_BACK_COLOR
::LBB_BACK_MIX_MODE - Line background mix
            Line background color  
::LBB_WIDTH - Line width
LBB_MIX_MODE
::LBB_GEOM_WIDTH - Geometric line width
            Line mix  
::LBB_TYPE - Line type
LBB_BACK_MIX_MODE
::LBB_END - Line end
            Line background mix  
::LBB_JOIN - Line join.
LBB_WIDTH
:Character attributes:
            Line width  
::CBB_COLOR - Character color
LBB_GEOM_WIDTH
::CBB_BACK_COLOR - Character background color
            Geometric line width  
::CBB_MIX_MODE - Character mix
LBB_TYPE
::CBB_BACK_MIX_MODE - Character background mix
            Line type  
::CBB_SET - Character set
LBB_END
::CBB_MODE - Character mode
            Line end  
::CBB_BOX - Character box
LBB_JOIN
::CBB_ANGLE - Character angle
            Line join.  
::CBB_SHEAR - Character shear
            Character attributes:
::CBB_DIRECTION - Character direction
 
::CBB_TEXT_ALIGN - Character text alignment
CBB_COLOR
::CBB_EXTRA - Character extra
            Character color  
::CBB_BREAK_EXTRA - Character break extra
CBB_BACK_COLOR
:Marker attributes:
            Character background color  
::MBB_COLOR - Marker color
CBB_MIX_MODE
::MBB_BACK_COLOR - Marker background color
            Character mix  
::MBB_MIX_MODE - Marker mix
CBB_BACK_MIX_MODE
::MBB_BACK_MIX_MODE - Marker background mix
            Character background mix  
::MBB_SET - Marker set
CBB_SET
::MBB_SYMBOL - Marker symbol
            Character set  
::MBB_BOX - Marker box.
CBB_MODE
:Pattern attributes (areas):
            Character mode  
::ABB_COLOR - Area color
CBB_BOX
::ABB_BACK_COLOR - Area background color
            Character box  
::ABB_MIX_MODE - Area mix
CBB_ANGLE
::ABB_BACK_MIX_MODE - Area background mix
            Character angle  
::ABB_SET - Pattern set
CBB_SHEAR
::ABB_SYMBOL - Pattern symbol
            Character shear  
::ABB_REF_POINT - Pattern reference point.
CBB_DIRECTION
:Image attributes:
            Character direction  
::IBB_COLOR - Image color
CBB_TEXT_ALIGN
::IBB_BACK_COLOR - Image background color
            Character text alignment  
::IBB_MIX_MODE - Image mix
CBB_EXTRA
::IBB_BACK_MIX_MODE - Image background mix.
            Character extra  
;flDefMask (ULONG) - input:Defaults mask.
CBB_BREAK_EXTRA
:Each flag set (and for which flAttrMask is also set) causes the corresponding attribute to be set to its default value.
            Character break extra Marker attributes:
;ppbunAttrs (PBUNDLE) - input: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.
: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
Primitive type
::Structure Line attributes LINEBUNDLE
Structure Line attributes
::Character attributes CHARBUNDLE
                    LINEBUNDLE  
::Marker attributes MARKERBUNDLE
Character attributes
::Pattern attributes (areas) AREABUNDLE
                    CHARBUNDLE  
::Image attributes IMAGEBUNDLE
Marker attributes
                    MARKERBUNDLE  
Pattern attributes (areas)
                    AREABUNDLE  
Image attributes
                    IMAGEBUNDLE  
 
             


==Returns==
==Returns==
; rc (BOOL) - returns
;rc (BOOL) - returns:Success indicator.
:Success indicator.
::TRUE - Successful completion
 
::FALSE - Error occurred.
:;TRUE
::Successful completion  
:;FALSE
::Error occurred.


==Errors==
==Errors==
Line 168: Line 93:


rc = GpiSetAttrs(hps, lPrimType, flAttrMask, flDefMask, ppbunAttrs);
rc = GpiSetAttrs(hps, lPrimType, flAttrMask, flDefMask, ppbunAttrs);
</pre>
<pre>
</pre>
</pre>



Revision as of 12:03, 4 April 2025

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
LBB_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.