casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
casa::PixelCanvasColorTable Class Referenceabstract

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

#include <PixelCanvasColorTable.h>

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

Public Member Functions

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

Protected Member Functions

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

Private Member Functions

casacore::uInt getColorAmount (const casacore::uInt *posMatrix, const casacore::uInt *endMatrix, int shiftAmount, int colorCount) const
 

Private Attributes

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

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 casa::PixelCanvasColorTable::~PixelCanvasColorTable ( )
virtual

Virtual destructor.

casa::PixelCanvasColorTable::PixelCanvasColorTable ( )
protected

Abstract base class.

Member Function Documentation

void casa::PixelCanvasColorTable::addResizeCallback ( PixelCanvasColorTableResizeCB  cb,
void *  clientData 
)

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

ColormapManager& casa::PixelCanvasColorTable::colormapManager ( )
inline

Return the colormapManager used by this PCCT.

Definition at line 264 of file PixelCanvasColorTable.h.

References dcmapMgr_.

virtual Display::ColorModel casa::PixelCanvasColorTable::colorModel ( ) const
pure virtual

Return the color model for multichannel color.

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

virtual casacore::Bool casa::PixelCanvasColorTable::colorSpaceMap ( Display::ColorModel  ,
const casacore::Array< casacore::Float > &  chan1in,
const casacore::Array< casacore::Float > &  chan2in,
const casacore::Array< casacore::Float > &  chan3in,
casacore::Array< casacore::Float > &  chan1out,
casacore::Array< casacore::Float > &  chan2out,
casacore::Array< casacore::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.

* Colormap* casa::PixelCanvasColorTable::defaultColormap ( )
inline

Definition at line 277 of file PixelCanvasColorTable.h.

References defaultColormap_.

virtual casacore::uInt casa::PixelCanvasColorTable::depth ( ) const
pure virtual

Return the depth of the map in bits.

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

void casa::PixelCanvasColorTable::doRefreshCallbacks ( )
void casa::PixelCanvasColorTable::doResizeCallbacks ( const Display::RefreshReason reason = Display::ColorTableChange)

casacore::Function that issues resize callbacks

casacore::uInt casa::PixelCanvasColorTable::getColorAmount ( const casacore::uInt posMatrix,
const casacore::uInt endMatrix,
int  shiftAmount,
int  colorCount 
) const
private
casacore::uInt casa::PixelCanvasColorTable::getColormapOffset ( const Colormap map) const
inlineprotected

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 286 of file PixelCanvasColorTable.h.

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

casacore::uInt casa::PixelCanvasColorTable::getColormapSize ( const Colormap cmap) const

Return the allocation size of some Colormap.

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

virtual casacore::Bool casa::PixelCanvasColorTable::installRGBColors ( const casacore::Vector< casacore::Float > &  r,
const casacore::Vector< casacore::Float > &  g,
const casacore::Vector< casacore::Float > &  b,
const casacore::Vector< casacore::Float > &  alpha,
casacore::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::PSPixelCanvasColorTable, and casa::QtPCColorTable.

virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
casacore::Array< casacore::uChar > &  outArray,
const casacore::Array< casacore::uChar > &  inArray,
casacore::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, casacore::uChar is optimal; Some systems with 12 bits per pixel with an alpha channel may require using the uLong;


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

Warning: casacore::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,
casacore::Array< casacore::uShort > &  outArray,
const casacore::Array< casacore::uShort > &  inArray,
casacore::Bool  rangeCheck = true 
) const
pure virtual
virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
casacore::Array< casacore::uInt > &  outArray,
const casacore::Array< casacore::uInt > &  inArray,
casacore::Bool  rangeCheck = true 
) const
pure virtual
virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
casacore::Array< casacore::uLong > &  outArray,
const casacore::Array< casacore::uLong > &  inArray,
casacore::Bool  rangeCheck = true 
) const
pure virtual
virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
casacore::Array< casacore::uChar > &  inOutArray,
casacore::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,
casacore::Array< casacore::uShort > &  inOutArray,
casacore::Bool  rangeCheck = true 
) const
pure virtual
virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
casacore::Array< casacore::uInt > &  inOutArray,
casacore::Bool  rangeCheck = true 
) const
pure virtual
virtual void casa::PixelCanvasColorTable::mapToColor ( const Colormap map,
casacore::Array< casacore::uLong > &  inOutArray,
casacore::Bool  rangeCheck = true 
) const
pure virtual
virtual void casa::PixelCanvasColorTable::mapToColor3 ( casacore::Array< casacore::uLong > &  out,
const casacore::Array< casacore::Float > &  chan1in,
const casacore::Array< casacore::Float > &  chan2in,
const casacore::Array< casacore::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 ( casacore::Array< casacore::uLong > &  out,
const casacore::Array< casacore::Double > &  chan1in,
const casacore::Array< casacore::Double > &  chan2in,
const casacore::Array< casacore::Double > &  chan3in 
)
pure virtual
virtual void casa::PixelCanvasColorTable::mapToColor3 ( casacore::Array< casacore::uLong > &  out,
const casacore::Array< casacore::uShort > &  chan1in,
const casacore::Array< casacore::uShort > &  chan2in,
const casacore::Array< casacore::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 ( casacore::Array< casacore::uLong > &  out,
const casacore::Array< casacore::uInt > &  chan1in,
const casacore::Array< casacore::uInt > &  chan2in,
const casacore::Array< casacore::uInt > &  chan3in 
)
pure virtual
virtual void casa::PixelCanvasColorTable::mapToColorRGB ( const Colormap map,
casacore::Array< casacore::uInt > &  outArray,
const casacore::Array< casacore::uInt > &  inArrayRed,
const casacore::Array< casacore::uInt > &  inArrayGreen,
const casacore::Array< casacore::uInt > &  inArrayBlue 
) const
virtual
casacore::Bool casa::PixelCanvasColorTable::member ( const Colormap cmap) const

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

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

virtual casacore::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 ( casacore::uInt n1,
casacore::uInt n2,
casacore::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 casacore::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,
casacore::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.

void casa::PixelCanvasColorTable::registerPixelCanvas ( const class PixelCanvas pc)
void casa::PixelCanvasColorTable::removeResizeCallback ( PixelCanvasColorTableResizeCB  cb,
void *  clientData 
)
virtual casacore::Bool casa::PixelCanvasColorTable::resize ( casacore::uInt  newSize)
pure virtual

Resize the hardware colormap.

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

virtual casacore::Bool casa::PixelCanvasColorTable::resize ( casacore::uInt  nReds,
casacore::uInt  nGreens,
casacore::uInt  nBlues 
)
pure virtual
void casa::PixelCanvasColorTable::setDefaultColormap ( const Colormap map)

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 casacore::Bool casa::PixelCanvasColorTable::staticSize ( )
inlinevirtual

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 111 of file PixelCanvasColorTable.h.

void casa::PixelCanvasColorTable::unregisterColormap ( Colormap cmap)

Unregister a data colormap reference previously added.

Member Data Documentation

std::list<void *> casa::PixelCanvasColorTable::clientDataList_
private

casacore::List of client data for resize callbacks

Definition at line 305 of file PixelCanvasColorTable.h.

ColormapManager casa::PixelCanvasColorTable::dcmapMgr_
private

The colormap manager.

Definition at line 300 of file PixelCanvasColorTable.h.

Referenced by colormapManager(), and getColormapOffset().

Colormap* casa::PixelCanvasColorTable::defaultColormap_
private

Pointer to the default colormap.

Definition at line 297 of file PixelCanvasColorTable.h.

Referenced by defaultColormap().

std::list<void *> casa::PixelCanvasColorTable::pixelCanvasList_
private

casacore::List of pixelCanvases on this color table

Definition at line 307 of file PixelCanvasColorTable.h.

std::list<void *> casa::PixelCanvasColorTable::resizeCBList_
private

casacore::List of resize callbacks

Definition at line 303 of file PixelCanvasColorTable.h.


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