VTK
Public Types | Public Member Functions | Static Public Member Functions
vtkQtChartColors Class Reference

The vtkQtChartColors class stores a list of colors. More...

#include <vtkQtChartColors.h>

List of all members.

Public Types

enum  ColorScheme {
  Spectrum = 0, Warm, Cool, Blues,
  WildFlower, Citrus, Custom
}

Public Member Functions

 vtkQtChartColors (ColorScheme scheme=Spectrum)
 Creates a chart colors instance.
 vtkQtChartColors (const vtkQtChartColors &other)
 Makes a copy of another chart colors instance.
 ~vtkQtChartColors ()
vtkQtChartColorsoperator= (const vtkQtChartColors &other)
 Makes a copy of another chart colors instance.
ColorScheme getColorScheme () const
 Gets the current color scheme.
void setColorScheme (ColorScheme scheme)
 Sets the color scheme.
int getNumberOfColors () const
 Gets the number of colors in the color list.
QColor getColor (int index) const
 Gets the color for the given index.
void setColor (int index, const QColor &color)
 Sets the color for the given index.
void clearColors ()
 Clears the list of colors.
void addColor (const QColor &color)
 Adds a color to the list of colors.
void insertColor (int index, const QColor &color)
 Inserts a new color into the list of colors.
void removeColor (int index)
 Removes the color for the given index.

Static Public Member Functions

static QColor lighter (const QColor &color, float factor=0.7)
 Creates a lighter color from the given color.
static QColor interpolateHsv (const QColor &color1, const QColor &color2, float fraction)
 Gets a new color between the given colors in hsv space.
static QColor interpolateRgb (const QColor &color1, const QColor &color2, float fraction)
 Gets a new color between the given colors in rgb space.

Detailed Description

The vtkQtChartColors class stores a list of colors.

Definition at line 36 of file vtkQtChartColors.h.


Member Enumeration Documentation

Enumerator:
Spectrum 

7 different hues.

Warm 

6 warm colors (red to yellow).

Cool 

7 cool colors (green to purple).

Blues 

7 different blues.

WildFlower 

7 colors from blue to magenta.

Citrus 

6 colors from green to orange.

Custom 

User specified color scheme.

Definition at line 39 of file vtkQtChartColors.h.


Constructor & Destructor Documentation

vtkQtChartColors::vtkQtChartColors ( ColorScheme  scheme = Spectrum)

Creates a chart colors instance.

Parameters:
schemeThe initial color scheme.
vtkQtChartColors::vtkQtChartColors ( const vtkQtChartColors other)

Makes a copy of another chart colors instance.

Parameters:
otherThe chart colors to copy.
vtkQtChartColors::~vtkQtChartColors ( )

Member Function Documentation

vtkQtChartColors& vtkQtChartColors::operator= ( const vtkQtChartColors other)

Makes a copy of another chart colors instance.

Parameters:
otherThe chart colors to copy.
Returns:
A reference to the object being assigned.
ColorScheme vtkQtChartColors::getColorScheme ( ) const [inline]

Gets the current color scheme.

Returns:
The current color scheme.

Definition at line 73 of file vtkQtChartColors.h.

void vtkQtChartColors::setColorScheme ( ColorScheme  scheme)

Sets the color scheme.

The color scheme will automatically be changed to Custom if the color list is modified.

Parameters:
schemeThe new color scheme.
int vtkQtChartColors::getNumberOfColors ( ) const

Gets the number of colors in the color list.

Returns:
The number of colors in the color list.
QColor vtkQtChartColors::getColor ( int  index) const

Gets the color for the given index.

Returns:
The color for the given index.
void vtkQtChartColors::setColor ( int  index,
const QColor &  color 
)

Sets the color for the given index.

This method does nothing if the index is out of range.

Parameters:
indexWhich color to modify.
colorThe new color.
void vtkQtChartColors::clearColors ( )

Clears the list of colors.

void vtkQtChartColors::addColor ( const QColor &  color)

Adds a color to the list of colors.

Parameters:
colorThe new color to add.
void vtkQtChartColors::insertColor ( int  index,
const QColor &  color 
)

Inserts a new color into the list of colors.

Parameters:
indexWhere to insert the new color.
colorThe new color to insert.
void vtkQtChartColors::removeColor ( int  index)

Removes the color for the given index.

Parameters:
indexWhich color to remove from the list.
static QColor vtkQtChartColors::lighter ( const QColor &  color,
float  factor = 0.7 
) [static]

Creates a lighter color from the given color.

The QColor::light method does not work for black. This function uses a 3D equation in rgb space to compute the lighter color, which works for all colors including black. the factor determines how light the new color will be. The factor is used to find the point between the current color and white.

Parameters:
colorThe starting color.
factorA percentage (0.0 to 1.0) of the distance from the given color to white.
Returns:
The new lighter color.
static QColor vtkQtChartColors::interpolateHsv ( const QColor &  color1,
const QColor &  color2,
float  fraction 
) [static]

Gets a new color between the given colors in hsv space.

The interpolation does not wrap around in the hue component.

Parameters:
color1The first color.
color2The last color.
fractionThe fraction (0.0 to 1.0) of the distance from color1 to color2.
Returns:
The interpolated color.
static QColor vtkQtChartColors::interpolateRgb ( const QColor &  color1,
const QColor &  color2,
float  fraction 
) [static]

Gets a new color between the given colors in rgb space.

Parameters:
color1The first color.
color2The last color.
fractionThe fraction (0.0 to 1.0) of the distance from color1 to color2.
Returns:
The interpolated color.

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