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.
Colormap entry for the virtual colormap.
Store/get the values.
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)
Member Description
allocate cells for colormaps
deallocate cells for colormaps
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
Fill a color cube with an RGB spectrum
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)
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.
uChar type may not have enough bits
to hold the pixel index on some high-end graphics systems
uShort 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
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].
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
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
Return True if the table is in colorIndex mode
Return True if the table is in RGB mode
Return True if the table is in HSV mode
Bool rigid() const
Return True if the colortable can be resized.
Return the color model for multichannel color
Return the number of currently unallocated cells that can be allocated RW.
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)
(Multi-Channel)
Bool initVisual(XVisualInfo *vi=NULL)
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)