NAME
vtkColorScalars - abstract class represents scalar data in color specification
SYNOPSIS
#include "/opt/vtk-c++/common/vtkColorScalars.h"
class VTK_EXPORT vtkColorScalars : public vtkScalars
vtkColorScalars() {};
const char *GetClassName() {return "vtkColorScalars";};
char *GetScalarType() {return "ColorScalar";};
char *GetDataType() {return "unsigned char";};
void GetDataTypeRange (float* range) { range[0] = VTK_UNSIGNED_CHAR_MIN;
range[1] = VTK_UNSIGNED_CHAR_MAX; return;}
float GetDataTypeMin() { return VTK_UNSIGNED_CHAR_MIN; }
float GetDataTypeMax() { return VTK_UNSIGNED_CHAR_MAX; }
float GetScalar(int i);
void SetNumberOfScalars(int number) {this->SetNumberOfColors(number);};
void SetScalar(int i, float s);
void InsertScalar(int i, float s);
int InsertNextScalar(float s);
virtual unsigned char *GetPointer(const int id) = 0;
int GetNumberOfColors() {return this->GetNumberOfScalars();};
virtual unsigned char *GetColor(int id) = 0;
virtual void GetColor(int id, unsigned char rgba[4]) = 0;
virtual void SetNumberOfColors(int number) = 0;
virtual void SetColor(int id, unsigned char rgba[4]) = 0;
virtual void InsertColor(int id, unsigned char rgba[4]) = 0;
void InsertColor(int id, float R, float G, float B, float A);
virtual int InsertNextColor(unsigned char rgba[4]) = 0;
int InsertNextColor(float R, float G, float B, float A);
virtual int Allocate(const int sz, const int ext=1000) = 0;
void GetColors(vtkIdList& ptId, vtkAPixmap& ap);
void GetComponentRange(unsigned char range[8]);
unsigned char *GetComponentRange();
virtual void SetS(vtkUnsignedCharArray *array) = 0;
virtual vtkUnsignedCharArray *GetS() = 0;
virtual void CreateDefaultLookupTable();
DESCRIPTION
vtkColorScalars is an abstract class whose subclasses represent scalar data using a color specification such as rgb, grayscale, rgba, hsv, etc.
In order to be a vtkScalars subclass, vtkColorScalars must be able to return a single value given a point id. By default, this operation is performed by computing luminance (or equivalent) as the single value. Concrete subclasses of vtkColorScalars may have additional methods to convert multi-dimensional color information into a single scalar value.
CAVEATS
Derived classes of vtkColorScalars treat colors differently. All derived classes will return a rgba (red-green-blue-alpha transparency) array in response to "GetColor()" methods. However, when setting colors, the rgba data is converted to internal form. For example, a vtkAGraymap converts rgba into a luminance value and stores that.
SEE ALSO
vtkAGraymap vtkAPixmap vtkBitmap vtkGraymap vtkPixmap
SUMMARY
virtual unsigned char *GetPointer(const int id) = 0; Get pointer to array of data starting at data position "id".
virtual unsigned char *GetColor(int id) = 0;
Return number of colors (same as number of scalars). Return an unsigned char rgba for a particular point id. No matter what internal representation of color, derived class must convert it to rgba.
virtual void GetColor(int id, unsigned char rgba[4]) = 0; Copy color components into user provided array rgba[4] for specified point id. No matter what internal representation of color, derived class must convert it to rgba form.
virtual void SetNumberOfColors(int number) = 0;
Specify the number of colors for this object to hold. Does an allocation as well as setting the MaxId ivar. Used in conjunction with SetColor() method for fast insertion.
virtual void SetColor(int id, unsigned char rgba[4]) = 0; Insert color into object. No range checking performed (fast!). Make sure you use SetNumberOfColors() to allocate memory prior to using SetColor().
virtual void InsertColor(int id, unsigned char rgba[4]) = 0; Insert color into object. Range checking performed and memory allocated as necessary.
virtual int InsertNextColor(unsigned char rgba[4]) = 0; Insert color into next available slot. Returns point id of slot.
virtual int Allocate(const int sz, const int ext=1000) = 0; Allocate space for color data.
float GetScalar(int i)
Convert internal color representation into scalar value. Uses luminance equation (see text).
void SetScalar(int i, float s)
Map through lookup table to set the color. Make sure that you've used the method SetNumberOfScalars() to allocate storage.
void InsertScalar(int i, float s)
Map through lookup table to set the color.
int InsertNextScalar(float s)
Map through lookup table to set the color.
void GetColors(vtkIdList& ptId, vtkAPixmap& p)
Given list of point id's, return colors for each point.
unsigned char *GetComponentRange ()
Compute range of color rgba data (rmin,rmax, gmin,gmax, bmin,bmax, amin,amax). Return pointer to array of length 8.
void GetComponentRange(unsigned char range[8])
Compute range of color rgba data (rmin,rmax, gmin,gmax, bmin,bmax, amin,amax). Copy result into user provided array.