Qwt User's Guide svn
Public Types | Public Member Functions
QwtColorMap Class Reference

#include <qwt_color_map.h>

Inherited by QwtAlphaColorMap, and QwtLinearColorMap.

List of all members.

Public Types

enum  Format {
  RGB,
  Indexed
}

Public Member Functions

QColor color (const QwtInterval &, double value) const
virtual unsigned char colorIndex (const QwtInterval &interval, double value) const =0
virtual QVector< QRgb > colorTable (const QwtInterval &) const
Format format () const
 QwtColorMap (Format=QwtColorMap::RGB)
virtual QRgb rgb (const QwtInterval &interval, double value) const =0
virtual ~QwtColorMap ()

Detailed Description

QwtColorMap is used to map values into colors.

For displaying 3D data on a 2D plane the 3rd dimension is often displayed using colors, like f.e in a spectrogram.

Each color map is optimized to return colors for only one of the following image formats:

See also:
QwtPlotSpectrogram, QwtScaleWidget

Member Enumeration Documentation

Format for color mapping

See also:
rgb(), colorIndex(), colorTable()
Enumerator:
RGB 

The map is intended to map into QRgb values.

Indexed 

The map is intended to map into 8 bit values, that are indices into the color table.


Constructor & Destructor Documentation

QwtColorMap::QwtColorMap ( Format  format = QwtColorMap::RGB)

Constructor.

QwtColorMap::~QwtColorMap ( ) [virtual]

Destructor.


Member Function Documentation

QColor QwtColorMap::color ( const QwtInterval interval,
double  value 
) const [inline]

Map a value into a color

Parameters:
intervalValid interval for values
valueValue
Returns:
Color corresponding to value
Warning:
This method is slow for Indexed color maps. If it is necessary to map many values, its better to get the color table once and find the color using colorIndex().
virtual unsigned char QwtColorMap::colorIndex ( const QwtInterval interval,
double  value 
) const [pure virtual]

Map a value of a given interval into a color index

Parameters:
intervalRange for the values
valueValue
Returns:
color index, corresponding to value

Implemented in QwtLinearColorMap.

QVector< QRgb > QwtColorMap::colorTable ( const QwtInterval interval) const [virtual]

Build and return a color map of 256 colors

The color table is needed for rendering indexed images in combination with using colorIndex().

Parameters:
intervalRange for the values
Returns:
A color table, that can be used for a QImage
QwtColorMap::Format QwtColorMap::format ( ) const [inline]
Returns:
Intended format of the color map
See also:
Format
virtual QRgb QwtColorMap::rgb ( const QwtInterval interval,
double  value 
) const [pure virtual]

Map a value of a given interval into a rgb value.

Parameters:
intervalRange for the values
valueValue
Returns:
rgb value, corresponding to value

Implemented in QwtAlphaColorMap, and QwtLinearColorMap.

qmi style