# E.S.O. - VLT project 
#
# "@(#) $Id: ColorMapInfo.man3,v 1.1.1.1 2009/03/31 14:11:52 cguirao Exp $" 
#
# This file is processed by the ESO/VLT docDoManPages command to
# produce a man page in nroff, TeX and MIF formats. 
# See docDoManPages(1) for a description of the input format.
# 
# who             when       what
# --------------  ---------  ----------------------------------------
# Allan Brighton  20 Jul 95  Created

NAME
ColorMapInfo - A C++ class for reading and managing color map files

SYNOPSIS
#include "ColorMapInfo.h"

enum {MAX_COLOR=256};            /* work with 8 bit color */

// one of these is used to hold colormap info for each colormap
// file read
class ColorMapInfo {
...
public:
    ColorMapInfo(char* name, ColorMapInfo* next = NULL);
    ~ColorMapInfo();

    // create and return ColorMap from a file description
    static ColorMapInfo* read(char* filename, ColorMapInfo* next = NULL);

    // member access
    char* name();
    ColorMapInfo* next();

    // set the red, green and blue values from the colormap data
    // and interpolate based on the count of available colors
    void interpolate(XColor* colorCells, int colorCount);

    // rotate the colormap by the given amount
    void rotate(int amount, XColor* src, XColor* dest, int colorCount);

    // shift the colormap by the given amount
    void shift(int amount, XColor* src, XColor* dest, int colorCount);
};

DESCRIPTION
This class is used by class ImageColor to read in and manage a single
colormap file. The constructor is not normally called from outside the
class.  To create an object of this class, the static "read" member
function reads in a colormap file (256 lines of RGB values between 0.0
and 1.0) and returns a pointer to a new ColorMapInfo instance for the
file.  Reading in the colormap only stores the values in memory, To
apply the colormap file to the default colormap, the interpolate
method is called.

Most methods take a colorCount argument, which is the number of colors
allocated in the colormap. The rotate and shift methods take an
integer "amount" argument, which is typically the difference in mouse
movements in some widget and is used to rotate (with wrap around) or
shift (without wrap around) the colormap by the given amount.

METHODS
static ColorMapInfo* read(char* filename, ColorMapInfo* next = NULL)
	Create and return a ColorMapInfo from a file description.  The
	next argument is used to build a list of loaded colormaps.

char* name()
	Return the name (file name) of the colormap loaded.

ColorMapInfo* next()
	Return a pointer to the next colormap in the list.

void interpolate(XColor* colorCells, int colorCount)
	Set the red, green and blue values in the colormap (in the
	colorCells array) from the loaded colormap data and
	interpolate based on the count of available colors.

void rotate(int amount, XColor* src, XColor* dest, int colorCount)
	Rotate the colormap by the given amount. "src" is the source
	colormap, dest is the destination colormap and colorCount
	gives the number of colors in src and dest.

void shift(int amount, XColor* src, XColor* dest, int colorCount);
	Shift the source colormap by the given amount, putting the
	result in dest. colorCount is the number of colors in src and
	dest.

FILES
$RTD_LIBRARY/../colormaps/*.lasc - MIDAS colormap files

SEE ALSO
ImageColor, ITTInfo(3C++)
--------------------------------------------------------------------
