00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00032 #ifndef __vtkColorTransferFunction_h
00033 #define __vtkColorTransferFunction_h
00034
00035 #include "vtkScalarsToColors.h"
00036
00037 class vtkPiecewiseFunction;
00038
00039 #define VTK_CTF_RGB 0
00040 #define VTK_CTF_HSV 1
00041
00042 class VTK_FILTERING_EXPORT vtkColorTransferFunction : public vtkScalarsToColors
00043 {
00044 public:
00045 static vtkColorTransferFunction *New();
00046 vtkTypeRevisionMacro(vtkColorTransferFunction,vtkScalarsToColors);
00047 void DeepCopy( vtkColorTransferFunction *f );
00048
00050 void PrintSelf(ostream& os, vtkIndent indent);
00051
00053 int GetSize() {return this->NumberOfPoints;};
00054
00056
00058 int AddRGBPoint( double x, double r, double g, double b );
00059 int AddHSVPoint( double x, double h, double s, double v );
00060 int RemovePoint( double x );
00062
00064
00065 void AddRGBSegment( double x1, double r1, double g1, double b1,
00066 double x2, double r2, double g2, double b2 );
00067 void AddHSVSegment( double x1, double h1, double s1, double v1,
00068 double x2, double h2, double s2, double v2 );
00070
00072 void RemoveAllPoints();
00073
00075
00076 double *GetColor(double x) {
00077 return vtkScalarsToColors::GetColor(x); }
00078 void GetColor(double x, double rgb[3]);
00080
00082
00083 double GetRedValue( double x );
00084 double GetGreenValue( double x );
00085 double GetBlueValue( double x );
00087
00089 virtual unsigned char *MapValue(double v);
00090
00092
00093 vtkGetVector2Macro( Range, double );
00095
00098 int AdjustRange(double range[2]);
00099
00101
00102 void GetTable( double x1, double x2, int n, double* table );
00103 void GetTable( double x1, double x2, int n, float* table );
00104 const unsigned char *GetTable( double x1, double x2, int n);
00106
00111 void BuildFunctionFromTable( double x1, double x2, int size, double *table);
00112
00114
00115 vtkSetClampMacro( Clamping, int, 0, 1 );
00116 vtkGetMacro( Clamping, int );
00117 vtkBooleanMacro( Clamping, int );
00119
00121
00126 vtkSetClampMacro( ColorSpace, int, VTK_CTF_RGB, VTK_CTF_HSV );
00127 void SetColorSpaceToRGB(){this->SetColorSpace(VTK_CTF_RGB);};
00128 void SetColorSpaceToHSV(){this->SetColorSpace(VTK_CTF_HSV);};
00129 vtkGetMacro( ColorSpace, int );
00130 vtkSetMacro(HSVWrap, int);
00131 vtkGetMacro(HSVWrap, int);
00132 vtkBooleanMacro(HSVWrap, int);
00133 VTK_LEGACY(void SetColorSpaceToHSVNoWrap());
00135
00137
00139 double *GetDataPointer() {return this->Function;};
00140 void FillFromDataPointer(int, double*);
00142
00144
00145 virtual void MapScalarsThroughTable2(void *input, unsigned char *output,
00146 int inputDataType, int numberOfValues,
00147 int inputIncrement, int outputIncrement);
00149
00150 protected:
00151 vtkColorTransferFunction();
00152 ~vtkColorTransferFunction();
00153
00154
00155
00156
00157
00158 int Clamping;
00159
00160
00161 int ColorSpace;
00162
00163
00164 int HSVWrap;
00165
00166
00167 double *Function;
00168 int FunctionSize;
00169 int NumberOfPoints;
00170
00171
00172 unsigned char UnsignedCharRGBAValue[4];
00173
00174
00175 double Range[2];
00176
00177
00178
00179 vtkPiecewiseFunction *Red;
00180 vtkPiecewiseFunction *Green;
00181 vtkPiecewiseFunction *Blue;
00182 vtkTimeStamp BuildTime;
00183 unsigned char *Table;
00184 int TableSize;
00185
00187
00189 virtual void SetRange(double, double) {};
00190 void SetRange(double rng[2]) {this->SetRange(rng[0],rng[1]);};
00192
00193
00194 private:
00195 vtkColorTransferFunction(const vtkColorTransferFunction&);
00196 void operator=(const vtkColorTransferFunction&);
00197 };
00198
00199 #endif
00200