casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Private Attributes
casa::PixelCanvasColorTable Class Reference

Abstract interface to underlying graphics library's colortable. More...

#include <PixelCanvasColorTable.h>

Inheritance diagram for casa::PixelCanvasColorTable:
casa::GLPixelCanvasColorTable casa::PSPixelCanvasColorTable casa::QtPCColorTable

List of all members.

Public Member Functions

virtual Bool staticSize ()
 Is the hardware colormap resizeable? ie.
virtual Bool resize (uInt newSize)=0
 Resize the hardware colormap.
virtual Bool resize (uInt nReds, uInt nGreens, uInt nBlues)=0
virtual Bool installRGBColors (const Vector< Float > &r, const Vector< Float > &g, const Vector< Float > &b, uInt offset=0)=0
 Install colors into the color table.
virtual uInt nColors () const =0
 Return the number of colors used to make the map.
virtual void nColors (uInt &n1, uInt &n2, uInt &n3) const =0
 Return the number of colors per component used in the map.
virtual uInt depth () const =0
 Return the depth of the map in bits.
virtual uInt nSpareColors () const =0
 Return the number of colors that are still unallocated.
virtual ~PixelCanvasColorTable ()
 Virtual destructor.
void addResizeCallback (PixelCanvasColorTableResizeCB cb, void *clientData)
 Add and remove resize callbacks PixelCanvasColorTableResizeCB is of type:
void (*)(class PixelCanvasColorTable * pcctbl, uInt newSize, void * clientData, Display::RefreshReason reason)
void removeResizeCallback (PixelCanvasColorTableResizeCB cb, void *clientData)
void doResizeCallbacks (const Display::RefreshReason &reason=Display::ColorTableChange)
 Function that issues resize callbacks.
void registerColormap (Colormap *cmap, Float weight=1.0)
 Register a colormap to be managed by the pixel canvas' color table.
void registerColormap (Colormap *cmap, Colormap *cmapToReplace)
 Register the cmap Colormap on the PixelCanvasColorTable, replacing the cmapToReplace Colormap if possible.
void unregisterColormap (Colormap *cmap)
 Unregister a data colormap reference previously added.
uInt getColormapSize (const Colormap *cmap) const
 Return the allocation size of some Colormap.
virtual void mapToColor (const Colormap *map, Array< uChar > &outArray, const Array< uChar > &inArray, Bool rangeCheck=True) const =0
 map [0,N-1] into colorpixels, where N is the current colormap size The values are returned as unsigned integers in their respective array.
virtual void mapToColor (const Colormap *map, Array< uShort > &outArray, const Array< uShort > &inArray, Bool rangeCheck=True) const =0
virtual void mapToColor (const Colormap *map, Array< uInt > &outArray, const Array< uInt > &inArray, Bool rangeCheck=True) const =0
virtual void mapToColor (const Colormap *map, Array< uLong > &outArray, const Array< uLong > &inArray, Bool rangeCheck=True) const =0
virtual void mapToColor (const Colormap *map, Array< uChar > &inOutArray, Bool rangeCheck=True) const =0
 same as above except the matrix is operated on in place.
virtual void mapToColor (const Colormap *map, Array< uShort > &inOutArray, Bool rangeCheck=True) const =0
virtual void mapToColor (const Colormap *map, Array< uInt > &inOutArray, Bool rangeCheck=True) const =0
virtual void mapToColor (const Colormap *map, Array< uLong > &inOutArray, Bool rangeCheck=True) const =0
virtual void mapToColor3 (Array< uLong > &out, const Array< Float > &chan1in, const Array< Float > &chan2in, const Array< Float > &chan3in)=0
 Functions for dealing with multi-channel mapping.
virtual void mapToColor3 (Array< uLong > &out, const Array< Double > &chan1in, const Array< Double > &chan2in, const Array< Double > &chan3in)=0
virtual void mapToColor3 (Array< uLong > &out, const Array< uShort > &chan1in, const Array< uShort > &chan2in, const Array< uShort > &chan3in)=0
 This one maps values between 0 and the integer maximum value for each channel into a single output image suitable for PixelCanvas::drawImage().
virtual void mapToColor3 (Array< uLong > &out, const Array< uInt > &chan1in, const Array< uInt > &chan2in, const Array< uInt > &chan3in)=0
virtual 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)=0
 (Multichannel Color) Transform arrays from the passed color model into the colormodel of the XPCCT.
Bool member (const Colormap *cmap) const
 Return whether or not a data colormap is used by this pixel canvas.
void setDefaultColormap (const Colormap *map)
 Return the default map.
ColormapManagercolormapManager ()
 Return the colormapManager used by this PCCT.
virtual Display::ColorModel colorModel () const =0
 Return the color model for multichannel color.
void registerPixelCanvas (const class PixelCanvas *pc)
void doRefreshCallbacks ()
*ColormapdefaultColormap ()

Protected Member Functions

uInt getColormapOffset (const Colormap *map) const
 return the offset of a particular colormap.
 PixelCanvasColorTable ()
 Abstract base class.

Private Attributes

ColormapdefaultColormap_
 Pointer to the default colormap.
ColormapManager dcmapMgr_
 The colormap manager.
List< void * > resizeCBList_
 List of resize callbacks.
List< void * > clientDataList_
 List of client data for resize callbacks.
List< void * > pixelCanvasList_
 List of pixelCanvases on this color table.

Detailed Description

Abstract interface to underlying graphics library's colortable.

Prerequisite

Etymology

PixelCanvas table of available colors. Note that there is still a table of colors in RGB mode.

Synopsis

This abstract class is communicated to by the PixelCanvas to perform color operations. The information in this file should not be needed to support applications programmers, and is provided for the future maintainer of the Display library.

A Major role of the PixelCanvasColorTable is to dynamically allocate space out of its own colortable allocation from the underlying graphics library for its registered Colormap s. It talks to its ColormapManager to return the Colormap information needed to properly scale data values to color. An application must know the size of the colormap to determine the color resolution available to value-related data.

The mapToColor functions will be needed by most image drawing and colored vector display drawing calls to transform quantized values into color indices.

The PixelCanvasColorTable is distinguished from the Colormap by its functionality. There is one and only one PixelCanvasColorTable for each PixelCanvas . It controls the allocation of containers for colors. It also will set the colors in the containers if the map is in HSV or RGB mode if necessary. If the map is in INDEX mode, you can install one or more Colormap s that control banks of colors in the color table because Colormaps define the colors that go into the containers of a PixelCanvasColorTable.

Motivation

Needed to abstract the concepts involved in color resource allocation from the PixelCanvas user.

Example

see the PixelCanvas test programs

To Do

Definition at line 105 of file PixelCanvasColorTable.h.


Constructor & Destructor Documentation

Virtual destructor.

Abstract base class.


Member Function Documentation

Add and remove resize callbacks PixelCanvasColorTableResizeCB is of type:
void (*)(class PixelCanvasColorTable * pcctbl, uInt newSize, void * clientData, Display::RefreshReason reason)

    

Return the colormapManager used by this PCCT.

Definition at line 261 of file PixelCanvasColorTable.h.

References dcmapMgr_.

Return the color model for multichannel color.

Implemented in casa::GLPixelCanvasColorTable, casa::PSPixelCanvasColorTable, and casa::QtPCColorTable.

virtual Bool casa::PixelCanvasColorTable::colorSpaceMap ( Display::ColorModel  ,
const Array< Float > &  chan1in,
const Array< Float > &  chan2in,
const Array< Float > &  chan3in,
Array< Float > &  chan1out,
Array< Float > &  chan2out,
Array< Float > &  chan3out 
) [pure virtual]

(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]

Implemented in casa::PSPixelCanvasColorTable, casa::GLPixelCanvasColorTable, and casa::QtPCColorTable.

Definition at line 272 of file PixelCanvasColorTable.h.

References defaultColormap_.

virtual uInt casa::PixelCanvasColorTable::depth ( ) const [pure virtual]

Return the depth of the map in bits.

Implemented in casa::GLPixelCanvasColorTable, casa::PSPixelCanvasColorTable, and casa::QtPCColorTable.

Function that issues resize callbacks.

uInt casa::PixelCanvasColorTable::getColormapOffset ( const Colormap map) const [inline, protected]

return the offset of a particular colormap.

This information is not made available to the outside caller. Rather a function to map values to color is made available.

Definition at line 279 of file PixelCanvasColorTable.h.

References dcmapMgr_, and casa::ColormapManager::getColormapOffset().

Return the allocation size of some Colormap.

Referenced by casa::PixelCanvas::getColormapSize().

virtual Bool casa::PixelCanvasColorTable::installRGBColors ( const Vector< Float > &  r,
const Vector< Float > &  g,
const Vector< Float > &  b,
uInt  offset = 0 
) [pure virtual]

Install colors into the color table.

Offset is zero-based. Colors are installed into the PixelCanvasColorTable until the vectors run out or until the end of the colortable is reached. This has no effect if in real/pseudo RGB/HSV modes. Values are clamped to [0.0,1.0].

Implemented in casa::GLPixelCanvasColorTable, casa::PSPixelCanvasColorTable, and casa::QtPCColorTable.

virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
Array< uChar > &  outArray,
const Array< uChar > &  inArray,
Bool  rangeCheck = True 
) const [pure virtual]

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


Tip: The choice of what type to use should be guided by the number of graphics bitplanes available; For most systems with 8-bit color, uChar is optimal; Some systems with 12 bits per pixel with an alpha channel may require using the uLong;


Warning: uChar type may not have enough bits to hold the pixel index on some high-end graphics systems

Warning: uShort type may not have enough bits to hold the pixel index on some high-end graphics systems

Implemented in casa::GLPixelCanvasColorTable, casa::PSPixelCanvasColorTable, and casa::QtPCColorTable.

Referenced by casa::PixelCanvas::mapToColor().

virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
Array< uShort > &  outArray,
const Array< uShort > &  inArray,
Bool  rangeCheck = True 
) const [pure virtual]
virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
Array< uInt > &  outArray,
const Array< uInt > &  inArray,
Bool  rangeCheck = True 
) const [pure virtual]
virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
Array< uLong > &  outArray,
const Array< uLong > &  inArray,
Bool  rangeCheck = True 
) const [pure virtual]
virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
Array< uChar > &  inOutArray,
Bool  rangeCheck = True 
) const [pure virtual]

same as above except the matrix is operated on in place.

Only unsigned values make sense here. I don't really know what to include here. Maybe ask the code cop.

Implemented in casa::GLPixelCanvasColorTable, casa::PSPixelCanvasColorTable, and casa::QtPCColorTable.

virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
Array< uShort > &  inOutArray,
Bool  rangeCheck = True 
) const [pure virtual]
virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
Array< uInt > &  inOutArray,
Bool  rangeCheck = True 
) const [pure virtual]
virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
Array< uLong > &  inOutArray,
Bool  rangeCheck = True 
) const [pure virtual]
virtual void casa::PixelCanvasColorTable::mapToColor3 ( Array< uLong > &  out,
const Array< Float > &  chan1in,
const Array< Float > &  chan2in,
const Array< Float > &  chan3in 
) [pure virtual]

Functions for dealing with multi-channel mapping.

(Multichannel Color) 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().

Implemented in casa::PSPixelCanvasColorTable, casa::GLPixelCanvasColorTable, and casa::QtPCColorTable.

virtual void casa::PixelCanvasColorTable::mapToColor3 ( Array< uLong > &  out,
const Array< Double > &  chan1in,
const Array< Double > &  chan2in,
const Array< Double > &  chan3in 
) [pure virtual]
virtual void casa::PixelCanvasColorTable::mapToColor3 ( Array< uLong > &  out,
const Array< uShort > &  chan1in,
const Array< uShort > &  chan2in,
const Array< uShort > &  chan3in 
) [pure virtual]

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

Implemented in casa::PSPixelCanvasColorTable, casa::GLPixelCanvasColorTable, and casa::QtPCColorTable.

virtual void casa::PixelCanvasColorTable::mapToColor3 ( Array< uLong > &  out,
const Array< uInt > &  chan1in,
const Array< uInt > &  chan2in,
const Array< uInt > &  chan3in 
) [pure virtual]

Return whether or not a data colormap is used by this pixel canvas.

Referenced by casa::PixelCanvas::colormapRegistered().

virtual uInt casa::PixelCanvasColorTable::nColors ( ) const [pure virtual]

Return the number of colors used to make the map.

Implemented in casa::GLPixelCanvasColorTable, casa::PSPixelCanvasColorTable, and casa::QtPCColorTable.

virtual void casa::PixelCanvasColorTable::nColors ( uInt n1,
uInt n2,
uInt n3 
) const [pure virtual]

Return the number of colors per component used in the map.

Fails for non-HSV/RGB modes.

Implemented in casa::GLPixelCanvasColorTable, casa::PSPixelCanvasColorTable, and casa::QtPCColorTable.

virtual uInt casa::PixelCanvasColorTable::nSpareColors ( ) const [pure virtual]

Return the number of colors that are still unallocated.

Implemented in casa::GLPixelCanvasColorTable, casa::PSPixelCanvasColorTable, and casa::QtPCColorTable.

void casa::PixelCanvasColorTable::registerColormap ( Colormap cmap,
Float  weight = 1.0 
)

Register a colormap to be managed by the pixel canvas' color table.

void casa::PixelCanvasColorTable::registerColormap ( Colormap cmap,
Colormap cmapToReplace 
)

Register the cmap Colormap on the PixelCanvasColorTable, replacing the cmapToReplace Colormap if possible.

virtual Bool casa::PixelCanvasColorTable::resize ( uInt  newSize) [pure virtual]

Resize the hardware colormap.

Implemented in casa::GLPixelCanvasColorTable, casa::PSPixelCanvasColorTable, and casa::QtPCColorTable.

virtual Bool casa::PixelCanvasColorTable::resize ( uInt  nReds,
uInt  nGreens,
uInt  nBlues 
) [pure virtual]

Return the default map.

This map is only used if no other colormaps are registered AND if we're in INDEX mode. Colormap * defaultColormap() const { return defaultColormap_; }

Set the default colormap

virtual Bool casa::PixelCanvasColorTable::staticSize ( ) [inline, virtual]

Is the hardware colormap resizeable? ie.

is it write-only? Default is to return true, and derived classes should generally override this function.

Reimplemented in casa::GLPixelCanvasColorTable, and casa::QtPCColorTable.

Definition at line 112 of file PixelCanvasColorTable.h.

References casa::True.

Unregister a data colormap reference previously added.


Member Data Documentation

List of client data for resize callbacks.

Definition at line 296 of file PixelCanvasColorTable.h.

The colormap manager.

Definition at line 291 of file PixelCanvasColorTable.h.

Referenced by colormapManager(), and getColormapOffset().

Pointer to the default colormap.

Definition at line 288 of file PixelCanvasColorTable.h.

Referenced by defaultColormap().

List of pixelCanvases on this color table.

Definition at line 298 of file PixelCanvasColorTable.h.

List of resize callbacks.

Definition at line 294 of file PixelCanvasColorTable.h.


The documentation for this class was generated from the following file: