GLPixelCanvasColorTable.h

Classes

GLVColorTableEntry -- Implementation of PixelCanvasColorTable for OpenGL. (full description)
GLPixelCanvasColorTable -- (full description)

class GLVColorTableEntry

Interface

Public Members
GLVColorTableEntry()
void operator=(const GLVColorTableEntry &)
void put(const float red, const float green, const float blue)
void get(float &red, float &green, float &blue)const
uInt getIndex()const
void setIndex(const uInt i)
uLong getPixel()const
void setPixel(const unsigned long p)
friend ostream &operator<<(ostream &s, const GLVColorTableEntry &x)

Description

Synopsis

GLPixelCanvasColorTable is an X11PixelCanvasColorTable that has been modified to work within the constraints of the GLPixelCanvas. (e.g. Not assuming the default visual).

Colormap values are written to a virtual colortable (an internal array). For Indexed (PseudoColor) windows, the values are sent to the hardware colormap. For RGB (TrueColor) windows, the virtual colortable is used to emulate a hardware lookup table.

Prerequisite

Etymology

Thrown Exceptions

Colormap entry for the virtual colormap.

Member Description

GLVColorTableEntry()

void operator=(const GLVColorTableEntry &)

void put(const float red, const float green, const float blue)

Store/get the values.

void get(float &red, float &green, float &blue)const

uInt getIndex()const

void setIndex(const uInt i)

uLong getPixel()const

void setPixel(const unsigned long p)

friend ostream &operator<<(ostream &s, const GLVColorTableEntry &x)


class GLPixelCanvasColorTable : public PixelCanvasColorTable

Types

enum FILLMODE

FILLRGB
FILLRBG
FILLGRB
FILLGBR
FILLBRG
FILLBGR

Interface

GLPixelCanvasColorTable()
~GLPixelCanvasColorTable()
GLPixelCanvasColorTable(::XDisplay *dpy, Display::ColorModel mapType = Display::RGB, Float percent=90.0, XVisualInfo *visInfo=NULL)
Bool allocCells(uInt nCells)
Bool deallocCells()
Bool allocColorCube()
Bool allocColorCube(uInt n1, uInt n2, uInt n3)
Bool allocColorCubeMinMax(uInt n1min, uInt n2min, uInt n3min, uInt n1max, uInt n2max, uInt n3max)
void copyColorCube(const GLPixelCanvasColorTable & mapRef)
void fillColorCubeRGB()
static void colorFillRGB( Vector<Float> &r, Vector<Float> &g, Vector<Float> &b, uInt nr, uInt ng, uInt nb, FILLMODE mode = FILLRGB)
static void colorFillRGB( Vector<Float> &r, Vector<Float> &g, Vector<Float> &b, uInt ncolors, FILLMODE mode= FILLRGB)
void fillColorCubeHSV()
void mapToColor3(Array<uLong> & out, const Array<Float> & chan1in, const Array<Float> & chan2in, const Array<Float> & chan3in)
void mapToColor3(Array<uLong> & out, const Array<Double> & chan1in, const Array<Double> & chan2in, const Array<Double> & chan3in)
void mapToColor3(Array<uLong> & out, const Array<uShort> & chan1in, const Array<uShort> & chan2in, const Array<uShort> & chan3in)
void mapToColor3(Array<uLong> & out, const Array<uInt> & chan1in, const Array<uInt> & chan2in, const Array<uInt> & chan3in)
Bool colorSpaceMap(Display::ColorModel, const Array<Float> & chan1in, const Array<Float> & chan2in, const Array<Float> & chan3in, Array<Float> & chan1out, Array<Float> & chan2out, Array<Float> & chan3out)
void mapToColor(const Colormap * map, Array<uChar> & outArray, const Array<uChar> & inArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uShort> & outArray, const Array<uShort> & inArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uInt> & outArray, const Array<uInt> & inArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uLong> & outArray, const Array<uLong> & inArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uChar> & inOutArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uShort> & inOutArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uInt> & inOutArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uLong> & inOutArray, Bool rangeCheck = True) const
friend ostream & operator << (ostream & os, const GLPixelCanvasColorTable & pcc)
virtual Bool staticSize()
Bool resize(uInt newSize)
Bool resize(uInt nReds, uInt nGreens, uInt nBlues)
Bool installRGBColors(const Vector<Float> & r, const Vector<Float> & g, const Vector<Float> & b, uInt offset = 0)
uInt nColors() const
virtual void nColors(uInt &n1, uInt &n2, uInt &n3) const
uInt depth() const
uInt nSpareColors() const
::XDisplay * display() const
Screen * screen() const
Visual * visual() const
XVisualInfo *visualInfo() const
XColormap xcmap() const
Bool indexMode() const
Bool rgbMode() const
Bool hsvMode() const
Bool rigid() const
Display::ColorModel colorModel() const
Bool readOnly()const
Bool decomposedIndex()const
uInt QueryColorsAvailable(const Bool contig)const
virtual uInt QueryHWColorsAvailable(const Bool contig)const
Bool virtualToPhysical(const unsigned long vindex, unsigned long &pindex)const
void storeColor(const uInt index, const float r, const float g, const float b)
void pixelToComponents(const uLong pixel, Float &r, Float &g, Float &b)
static XVisualInfo *getVisualInfo(::XDisplay *dpy, const XDisplay::ColorModel colormodel)
void indexToRGB(const uInt index, float &r, float &g, float &b)
Private Members
Bool isPow2(uInt n, uInt & log2n)
void setupColorCube(uLong n1, uLong n2, uLong n3, uLong n1m, uLong n2m, uLong n3m)
void setupStandardMapping(const XStandardColormap * mapInfo)
Bool initVisual(XVisualInfo *vi=NULL)
void checkVisual()
virtual void storeHWColor(const uLong pindex, const float r, const float g, const float b)
void HSV2RGB(const uLong H, const uLong S, const uLong V, uLong &R, uLong &G, uLong &B)
uInt HSV2Index(float h, float s, float v)

Description

Member Description

GLPixelCanvasColorTable()
~GLPixelCanvasColorTable()
GLPixelCanvasColorTable(::XDisplay *dpy, Display::ColorModel mapType = Display::RGB, Float percent=90.0, XVisualInfo *visInfo=NULL)

Bool allocCells(uInt nCells)

allocate cells for colormaps

Bool deallocCells()

deallocate cells for colormaps

Bool allocColorCube()

Allocate the best color cube given the map

Bool allocColorCube(uInt n1, uInt n2, uInt n3)

Allocate a color cube of a specific size

Bool allocColorCubeMinMax(uInt n1min, uInt n2min, uInt n3min, uInt n1max, uInt n2max, uInt n3max)

Allocate a color cube within the ranges of sizes

void copyColorCube(const GLPixelCanvasColorTable & mapRef)

Copy color cube info from the mapRef

void fillColorCubeRGB()

Fill a color cube with an RGB spectrum

enum FILLMODE

static void colorFillRGB( Vector<Float> &r, Vector<Float> &g, Vector<Float> &b, uInt nr, uInt ng, uInt nb, FILLMODE mode = FILLRGB)

static void colorFillRGB( Vector<Float> &r, Vector<Float> &g, Vector<Float> &b, uInt ncolors, FILLMODE mode= FILLRGB)

void fillColorCubeHSV()

Fill a color cube with an HSV spectrum

void mapToColor3(Array<uLong> & out, const Array<Float> & chan1in, const Array<Float> & chan2in, const Array<Float> & chan3in)
void mapToColor3(Array<uLong> & out, const Array<Double> & chan1in, const Array<Double> & chan2in, const Array<Double> & chan3in)

Merge separate channel data into an output image. This function maps floating values between 0 and 1 into a output image suitable for PixelCanvas::drawImage().

void mapToColor3(Array<uLong> & out, const Array<uShort> & chan1in, const Array<uShort> & chan2in, const Array<uShort> & chan3in)
void mapToColor3(Array<uLong> & out, const Array<uInt> & chan1in, const Array<uInt> & chan2in, const Array<uInt> & chan3in)

This one maps values between 0 and the integer maximum value for each channel into a single output image suitable for PixelCanvas::drawImage().

Bool colorSpaceMap(Display::ColorModel, const Array<Float> & chan1in, const Array<Float> & chan2in, const Array<Float> & chan3in, Array<Float> & chan1out, Array<Float> & chan2out, Array<Float> & chan3out)

(Multichannel Color) Transform arrays from the passed color model into the colormodel of the XPCCT. Does nothing if colorModel is Display::Index. It is assumed that input arrays are in the range of [0,1]

void mapToColor(const Colormap * map, Array<uChar> & outArray, const Array<uChar> & inArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uShort> & outArray, const Array<uShort> & inArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uInt> & outArray, const Array<uInt> & inArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uLong> & outArray, const Array<uLong> & inArray, Bool rangeCheck = True) const

map [0,N-1] into colorpixels, where N is the current colormap size The values are returned as unsigned integers in their respective array.

WarninguChar type may not have enough bits to hold the pixel index on some high-end graphics systems
WarninguShort type may not have enough bits to hold the pixel index on some high-end graphics systems

void mapToColor(const Colormap * map, Array<uChar> & inOutArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uShort> & inOutArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uInt> & inOutArray, Bool rangeCheck = True) const
void mapToColor(const Colormap * map, Array<uLong> & inOutArray, Bool rangeCheck = True) const

same as above except the matrix is operated on in place. Only unsigned values make sense here.

friend ostream & operator << (ostream & os, const GLPixelCanvasColorTable & pcc)

print details of class to ostream

virtual Bool staticSize()

Is the hardware colormap resizeable? ie. is it write-only?

Bool resize(uInt newSize)
Bool resize(uInt nReds, uInt nGreens, uInt nBlues)

resize the map if allowed. Returns True if resize was accepted

Bool installRGBColors(const Vector<Float> & r, const Vector<Float> & g, const Vector<Float> & b, uInt offset = 0)

Install colors into the color table. Offset is zero-based. Colors are installed into the PixelCanvasColorTable until the Arrays run out or until the end of the colortable is reached. This only has an effect if the ColorModel is Index. Values are clamped to [0.0,1.0].

uInt nColors() const

Return the total number of RW colors currently in use.

virtual void nColors(uInt &n1, uInt &n2, uInt &n3) const

Return the number of colors per component in the map. Throws an exception if this is not an HSV or RGB ColorTable.

uInt depth() const

Return the depth in bits of the colors

uInt nSpareColors() const

Return the number of colors that are still unallocated

::XDisplay * display() const

Return pointer to display that is being used

Screen * screen() const

Return pointer to screen that is being used

Visual * visual() const

Return pointer to visual that is being used

XVisualInfo *visualInfo() const

Return pointer to visual info that is being used

XColormap xcmap() const

Return XID of X "virtual colormap" being used

Bool indexMode() const

Return True if the table is in colorIndex mode

Bool rgbMode() const

Return True if the table is in RGB mode

Bool hsvMode() const

Return True if the table is in HSV mode

Bool rigid() const

Return True if the colortable can be resized.

Display::ColorModel colorModel() const

Return the color model for multichannel color

Bool readOnly()const

Bool decomposedIndex()const

uInt QueryColorsAvailable(const Bool contig)const

Return the number of currently unallocated cells that can be allocated RW.

virtual uInt QueryHWColorsAvailable(const Bool contig)const

Bool virtualToPhysical(const unsigned long vindex, unsigned long &pindex)const

Convert a virtual index to a physical pixel.

void storeColor(const uInt index, const float r, const float g, const float b)

Store an RGB value at index. For RGV visuals, only the virtual colormap is updated.

void pixelToComponents(const uLong pixel, Float &r, Float &g, Float &b)

Convert a pixel to color components. If decomposed index (eg TC), the pixel contains the color information. Otherwise, (eg. PseudoColor), The information is looked up in the virtual colormap.

static XVisualInfo *getVisualInfo(::XDisplay *dpy, const XDisplay::ColorModel colormodel)

Return a GL capable visual that supports the colormodel or NULL.

void indexToRGB(const uInt index, float &r, float &g, float &b)

Returns the color values for the index. (Inverse of installRGBColors()).

Bool isPow2(uInt n, uInt & log2n)

Return the log power 2 of n and return True if n is a power of two. Otherwise return false.

void setupColorCube(uLong n1, uLong n2, uLong n3, uLong n1m, uLong n2m, uLong n3m)

(Multi-Channel)

void setupStandardMapping(const XStandardColormap * mapInfo)

(Multi-Channel)

Bool initVisual(XVisualInfo *vi=NULL)

void checkVisual()

virtual void storeHWColor(const uLong pindex, const float r, const float g, const float b)

Write an RGB value to hardware colormap at physical index. (Called by storeColor()).

void HSV2RGB(const uLong H, const uLong S, const uLong V, uLong &R, uLong &G, uLong &B)

Convert from integer HSV components to RGB pixel components.

uInt HSV2Index(float h, float s, float v)