gpi12.hlp (Table of Contents; Topic list)
GpiSetColor (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_GPIPRIMITIVES
 
BOOL GpiSetColor(hps, clr)
HPS hps;     /* presentation-space handle */
LONG clr;    /* color value               */
 
The GpiSetColor function sets the current foreground color for all primitive
types. The foreground color specifies the color used to draw the foreground
of the primitive, such as the dashes in a styled line or the diagonal bars
in a diagonal shading pattern. The function sets the foreground color to the
color specified by clr. The clr parameter is either an RGB color value or a
color index value, depending on the current logical color table. The actual
color the clr parameter represents also depends on the current logical color
table.
 
If the attribute mode is AM_PRESERVE, the function saves the previous
foreground color on the attribute stack when it sets the new color. The
previous foreground color can be retrieved by using the GpiPop function.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hps        Identifies the presentation space.
 
clr        Specifies the color. The values depend on the current logical
           color table. If the logical color table has been created using
           the LCOLF_RGB, the values must be RGB color values. Otherwise,
           the values must be color-index values. If the default logical
           color table is used, the parameter can be any one of the
           following standard color-index values:
 
           Value           Meaning
           ─────────────────────────────────────────────────────────────────
           CLR_FALSE       All color planes are zeros.
 
           CLR_TRUE        All color planes are ones.
 
           CLR_DEFAULT     Default value; same as CLR_NEUTRAL.
 
           CLR_WHITE       White.
 
           CLR_BLACK       Black.
 
           CLR_BACKGROUND  Reset color (used by the GpiErase function).
 
           CLR_BLUE        Blue.
 
           CLR_RED         Red.
 
           CLR_PINK        Pink.
 
           CLR_GREEN       Green.
 
           CLR_CYAN        Cyan.
 
           CLR_YELLOW      Yellow.
 
           CLR_NEUTRAL     Neutral.
 
           CLR_DARKGRAY    Dark gray.
 
           CLR_DARKBLUE    Dark blue.
 
           CLR_DARKRED     Dark red.
 
           CLR_DARKPINK    Dark pink.
 
           CLR_DARKGREEN   Dark green.
 
           CLR_DARKCYAN    Dark cyan.
 
           CLR_BROWN       Brown.
 
           CLR_PALEGRAY    Light gray.
 
Return Value
 
The return value is GPI_OK if the function is successful or GPI_ERROR if an
error occurred.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
the following:
 
     PMERR_INV_COLOR_ATTR
     PMERR_INV_HPS
     PMERR_PS_BUSY
 
Comments
 
The CLR_BACKGROUND color for the default logical color table is the natural
background color for the device (for example, the paper color for a
printer). For the display, the CLR_BACKGROUND color is the default window
color as set by the WinSetSysColors function. The CLR_NEUTRAL color for the
default logical color table is a device-dependent color that provides a
contrasting color to CLR_BACKGROUND (for example, it is the ink color for a
one-color printer). For the display, it is the default window-text color.
 
See Also
 
GpiErase, GpiPop, GpiQueryAttrs, GpiQueryColor, GpiSetAttrMode, GpiSetAttrs,
GpiSetMix, WinSetSysColors, WinGetLastError