REMAPALLPALETTERGB, REMAPPALETTERGB (W*32, W*64)

Graphics Functions: REMAPALLPALETTERGB remaps a set of Red-Green-Blue (RGB) color values to indexes recognized by the video hardware. REMAPPALETTERGB remaps one color index to an RGB color value.

Module: USE IFQWIN

Syntax

result = REMAPALLPALETTERGB (colors)
result = REMAPPALETTERGB (index, color)


colors
(Input) INTEGER(4). Ordered array of RGB color values to be mapped in order to indexes. Must hold 0-255 elements.


index
(Input) INTEGER(4). Color index to be reassigned an RGB color.


color
(Input) INTEGER(4). RGB color value to assign to a color index.

Results

The result type is INTEGER(4). REMAPALLPALETTERGB returns 0 if successful; otherwise, -1. REMAPPALETTERGB returns the previous color assigned to the index.

The REMAPALLPALETTERGB function remaps all of the available color indexes simultaneously (up to 236; 20 indexes are reserved by the operating system). The colors argument points to an array of RGB color values. The default mapping between the first 16 indexes and color values is shown in the following table. The 16 default colors are provided with symbolic constants in IFQWIN.F90.

Index Color Index Color
0 $BLACK 8 $GRAY
1 $BLUE 9 $LIGHTBLUE
2 $GREEN 10 $LIGHTGREEN
3 $CYAN 11 $LIGHTCYAN
4 $RED 12 $LIGHTRED
5 $MAGENTA      13 $LIGHTMAGENTA
6 $BROWN 14 $YELLOW
7 $WHITE 15 $BRIGHTWHITE

The number of colors mapped can be fewer than 236 if the number of colors supported by the current video mode is fewer, but at most 236 colors can be mapped by REMAPALLPALETTERGB. Most Windows graphics drivers support a palette of 256K colors or more, of which only a few can be mapped into the 236 palette indexes at a time. To access and use all colors on the system, bypass the palette and use direct RGB color functions such as such as SETCOLORRGB and SETPIXELSRGB.

Any RGB colors can be mapped into the 236 palette indexes. Thus, you could specify a palette with 236 shades of red. For further details on using different color procedures see Building Applications: Adding Color Overview.

In each RGB color value, each of the three colors, red, green and blue, is represented by an eight-bit value (2 hex digits). In the values you specify with REMAPALLPALETTERGB or REMAPPALETTERGB, red is the rightmost byte, followed by green and blue. The RGB value's internal structure is as follows:

Larger numbers correspond to stronger color intensity with binary 11111111 (hex FF) the maximum for each of the three components. For example, Z'008080' yields full-intensity red, Z'00FF00' full-intensity green, Z'FF0000' full-intensity blue, and Z'FFFFFF' full-intensity for all three, resulting in bright white.

Compatibility

STANDARD GRAPHICS QUICKWIN GRAPHICS LIB

See Also

SETBKCOLORRGB, SETCOLORRGB, SETBKCOLOR, SETCOLOR, Building Applications: Using Color, Building Applications: VGA Color Palette

Example

 ! Build as QuickWin or Standard Graphics App.

 USE IFQWIN
 INTEGER(4) colors(3)
 INTEGER(2) status

 colors(1) = Z'00FFFF' ! yellow
 colors(2) = Z'FFFFFF' ! bright white
 colors(3) = 0       ! black
 status = REMAPALLPALETTERGB(colors)

 status = REMAPPALETTERGB(INT2(47), Z'45A315')
 END