Cmap

[ XITE Reference Manual | XITE home ]

Contents


Name

GetImageColormap, cmapOfVisual, cmapOfVisualClass, RGBPixel, InitColortablePixels, InitColortableGray, InitColortableGrayPart, SpreadGray, PrintColormap, PrintWidgetColormap, ColormapCopy, ColormapStd - XITE module for initializing X11 colormaps.

Syntax

 #include <xite/Cmap.h>

 void GetImageColormap( Display* dpy,
    int screen, int planes, Visual* visual,
    Colormap* colormap );

 void ColormapCopy( Display* dpy, int screen,
    Colormap dest, Colormap source,
    int composite );

 void ColormapStd( Display* dpy, int screen,
    Colormap map, int visualClass, int nr );

 void PrintWidgetColormap( Display* dpy,
    Widget wid );

 void PrintColormap( Display* dpy, Colormap map,
    int len, int composite );

 Colormap cmapOfVisual( Visual* visual,
    int planes );

 Colormap cmapOfVisualClass(
    int visualClass, int planes );

 void InitColortableGrayPart( XColor* col,
    int min, int max, int step, int composite );

 void InitColortableGray( XColor* col, int len,
    int step, int composite );

 void InitColortablePixels( XColor* col,
    int len, int offset, int composite );

 void SpreadGray( XColor *col, int num_colors,
    int pix_min, int num_cells );

 int RGBPixel( int pix, Visual* visual );

Description

GetImageColormap returns in *colormap the XITE-initial colormap for the specified visual and planes. If *colormap is non-NULL on entry, don't change it.

For a PseudoColor visual with planes equal to 8, the XITE-initial colormap is a 256-entry grayscale map with values equally distributed in steps of 257 from 0 to 65535.

For a PseudoColor visual with planes equal to 7 (reduced-color display of images to reduce "technicolor" effect and allow overlay planes), the XITE-initial colormap consists of four parts. The first and fourth part, entries [0..63] and [224..255], are either copies of the corresponding entries in the default colormap (if the default visual is 8-bit PseudoColor) or a grayscale map with values in steps of 257 from 0 to 16191 and from 57568 to 65535. The second part, entries [64..191}, is grayscale in steps of 514 from 0 to 65278. The third part, entries [192..223], contains a predefined table for image overlays.

For a DirectColor visual with planes equal to 24, the XITE-initial colormap is similar to the colormap for the 8-bit PseudoColor case, except that each primary in the DirectColor case is a copy of the single PseudoColor map.

For a DirectColor visual with planes equal to 21, the XITE-initial colormap is similar to the colormap for the reduced-color 8-bit PseudoColor case, except that each primary in the DirectColor case is a copy of the single PseudoColor map.

For a TrueColor visual with planes equal to 24, the XITE-initial colormap equals the default colormap.

cmapOfVisual is essentially the same as GetImageColormap, but with a different interface.

cmapOfVisualClass is the same as cmapOfVisual except with visual specified with class instead of visual.

InitColortablePixels initializes the pixelvalues of entries [0..(len-1)] in colortab col. The values are in steps of 1 from offset to offset + len - 1. The values of the primaries are all set to zero. If composite is True, the pixelvalues are regarded as consisting of three 8-bit parts, each of which is initialized as described.

InitColortableGray initializes the pixelvalues of entries [0..(len-1)] the same way as InitColortablePixels. In addition, the three primaries are given values in steps of step from 0 to step * (len - 1).

InitColortableGrayPart behaves like InitColortableGray, except that it treats the entries [min..max]. The values of the primaries are as for InitColortableGray (compensated for min).

SpreadGray spreads num_colors evenly in col, starting with pixel pix_min. Only the primaries in col are changed, not the pixel or flag components. num_cells / num_colors neighbors will be equal.

PrintColormap prints to stderr the contents of map for entries [0..len-1]. The output is four-column ascii with pixelvalue (hexadecimal) and the three primary values.

PrintWidgetColormap prints to stderr the contents of the colormap presently used by wid.

RGBPixel constructs a three-part (8 bit each) composite pixelvalue if visual is of class DirectColor or TrueColor. Otherwise, pix is returned unchanged.

ColormapCopy copies the rgb values in the source colormap into the dest colormap (after "hardware-approximation").

ColormapStd "hardware-approximates" the global colortable stdcol1_s (16 elements) or stdcol2_s (32 elements) into the virtual colormap map. The choice depends on nr (stdcol1_s for nr equal to 1, stdcol2_s for nr equal to 2).

See also

Visual(3), xshow(1), ximage(3), ximageInit(3)

Author

Svein Bøe, original version by Otto Milvang.

Id

$Id: Cmap.c,v 1.14 1997/05/25 11:47:53 svein Exp $