Jump to content

GpiSetMix

From EDM2
Revision as of 23:45, 2 April 2025 by Iturbide (talk | contribs) (Created page with "This function sets the current foreground mix attribute for each individual primitive type. ==Syntax== GpiSetMix(hps, lMixMode); ==Parameters== ;hps (HPS) - input :Presentation-space handle. ;lMixMode (LONG) - input :Flag indicating the color-mixing mode. :Mixing other than FM_LEAVEALONE or FM_OVERPAINT is done on the physical color index. In general, this corresponds to the color index of the logical color table if an indexed color table has been realized. In othe...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function sets the current foreground mix attribute for each individual primitive type.

Syntax

GpiSetMix(hps, lMixMode);

Parameters

hps (HPS) - input
Presentation-space handle.
lMixMode (LONG) - input
Flag indicating the color-mixing mode.
Mixing other than FM_LEAVEALONE or FM_OVERPAINT is done on the physical color index. In general, this corresponds to the color index of the logical color table if an indexed color table has been realized. In other circumstances, the color that results from such a mix cannot be predicted. Nevertheless, if FM_XOR is supported for example, drawing the same object twice with a foreground mix of FM_XOR and a background mix of BM_LEAVEALONE with no intervening drawing in other mix modes, causes the object to be erased cleanly.
The currently associated device supports any of the mixes specified as supported in DevQueryCaps (CAPS_FOREGROUND_MIX_SUPPORT). Any other valid mixes may be supported for some primitive types, but otherwise results in FM_OVERPAINT. An error is raised only if the value specified is not one of those listed below.
Note: Mixes marked with an asterisk (*) are mandatory for all devices, except that FM_OR is only mandatory for devices capable of supporting it. FM_XOR is mandatory only on displays.
The possible values for this parameter are:

FM_DEFAULT

       Use default, the same as FM_OVERPAINT, unless changed with GpiSetDefAttrs 

FM_OR

       Logical-OR (*) 

FM_OVERPAINT

       Overpaint (*) 

FM_XOR

       Logical-XOR (*) 

FM_LEAVEALONE

       Leave alone (invisible) (*) 

FM_AND

       Logical-AND 

FM_SUBTRACT

       (Inverse source) AND destination 

FM_MASKSRCNOT

       Source AND (inverse destination) 

FM_ZERO

       All zeros 

FM_NOTMERGESRC

       Inverse (source OR destination) 

FM_NOTXORSRC

       Inverse (source XOR destination) 

FM_INVERT

       Inverse (destination) FM_MERGESRCNOT
       Source OR (inverse destination) 

FM_NOTCOPYSRC

       Inverse (source) FM_MERGENOTSRC
       (Inverse source) OR destination 

FM_NOTMASKSRC

       Inverse (source AND destination) 

FM_ONE

       All ones. 


Returns

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

Remarks

The current values for each primitive type are updated. The attribute mode (see GpiSetAttrMode) determines whether the current value of the mix attribute is preserved.

Note: There are restrictions on the use of this function when creating SAA-conforming metafiles; see "MetaFile Resolutions" in the Presentation Manager Programming Reference for more information.

Example Code

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

HPS     hps;       /*  Presentation-space handle. */
LONG    lMixMode;  /*  Flag indicating the color-mixing mode. */
BOOL    rc;        /*  Success indicator. */

rc = GpiSetMix(hps, lMixMode);

This function sets the current foreground mix attribute for each individual primitive type.

 
#define INCL_GPIPRIMITIVES
#include <OS2.H>

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

GpiSetMix(hps,
          FM_LEAVEALONE);

Related Functions

  • GpiBeginArea
  • GpiBox
  • GpiCharString
  • GpiCharStringAt
  • GpiCharStringPos
  • GpiCharStringPosAt
  • GpiEndArea
  • GpiFullArc
  • GpiLine
  • GpiMarker
  • GpiMove
  • GpiPartialArc
  • GpiPointArc
  • GpiPolyFillet
  • GpiPolyFilletSharp
  • GpiPolyLine
  • GpiPolyMarker
  • GpiPolySpline
  • GpiQueryCharStringPos
  • GpiQueryCharStringPosAt
  • GpiQueryMix
  • GpiSetAttrMode
  • GpiSetAttrs
  • GpiSetBackColor
  • GpiSetBackMix
  • GpiSetColor
  • GpiSetDefAttrs

Graphic Elements and Orders

Element Type
OCODE_GSMX
This element type is generated if the attribute mode (see GpiSetAttrMode) is set to AM_NOPRESERVE.
Order: Set Mix
Element Type
OCODE_GPSMX
This element type is generated if the attribute mode is set to AM_PRESERVE.
Order: Push and Set Mix