VTK
dox/Rendering/vtkTexture.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkTexture.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00051 #ifndef __vtkTexture_h
00052 #define __vtkTexture_h
00053 
00054 #include "vtkImageAlgorithm.h"
00055 
00056 class vtkImageData;
00057 class vtkScalarsToColors;
00058 class vtkRenderer;
00059 class vtkUnsignedCharArray;
00060 class vtkWindow;
00061 class vtkDataArray;
00062 class vtkTransform;
00063 
00064 #define VTK_TEXTURE_QUALITY_DEFAULT 0
00065 #define VTK_TEXTURE_QUALITY_16BIT   16
00066 #define VTK_TEXTURE_QUALITY_32BIT   32
00067 
00068 class VTK_RENDERING_EXPORT vtkTexture : public vtkImageAlgorithm
00069 {
00070 public:
00071   static vtkTexture *New();
00072   vtkTypeMacro(vtkTexture,vtkImageAlgorithm);
00073   void PrintSelf(ostream& os, vtkIndent indent);
00074 
00078   virtual void Render(vtkRenderer *ren);
00079 
00082   virtual void PostRender(vtkRenderer *) {};
00083 
00087   virtual void ReleaseGraphicsResources(vtkWindow *) {};
00088 
00092   virtual void Load(vtkRenderer *) {};
00093 
00095 
00097   vtkGetMacro(Repeat,int);
00098   vtkSetMacro(Repeat,int);
00099   vtkBooleanMacro(Repeat,int);
00101 
00103 
00106   vtkGetMacro(EdgeClamp,int);
00107   vtkSetMacro(EdgeClamp,int);
00108   vtkBooleanMacro(EdgeClamp,int);
00110 
00112 
00113   vtkGetMacro(Interpolate,int);
00114   vtkSetMacro(Interpolate,int);
00115   vtkBooleanMacro(Interpolate,int);
00117 
00119 
00121   vtkSetMacro(Quality,int);
00122   vtkGetMacro(Quality,int);
00123   void SetQualityToDefault() {this->SetQuality(VTK_TEXTURE_QUALITY_DEFAULT);};
00124   void SetQualityTo16Bit() {this->SetQuality(VTK_TEXTURE_QUALITY_16BIT);};
00125   void SetQualityTo32Bit() {this->SetQuality(VTK_TEXTURE_QUALITY_32BIT);};
00127 
00129 
00135   vtkGetMacro(MapColorScalarsThroughLookupTable,int);
00136   vtkSetMacro(MapColorScalarsThroughLookupTable,int);
00137   vtkBooleanMacro(MapColorScalarsThroughLookupTable,int);
00139 
00140 //BTX
00142 
00144   vtkImageData *GetInput();
00145 //ETX
00147 
00149 
00150   void SetLookupTable(vtkScalarsToColors *);
00151   vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
00153 
00155 
00156   vtkGetObjectMacro(MappedScalars,vtkUnsignedCharArray);
00158 
00160   unsigned char *MapScalarsToColors (vtkDataArray *scalars);
00161 
00163 
00165   void SetTransform(vtkTransform *transform);
00166   vtkGetObjectMacro(Transform, vtkTransform);
00168 
00169 //BTX
00171 
00173   enum VTKTextureBlendingMode
00174   {
00175     VTK_TEXTURE_BLENDING_MODE_NONE = 0,
00176     VTK_TEXTURE_BLENDING_MODE_REPLACE,
00177     VTK_TEXTURE_BLENDING_MODE_MODULATE,
00178     VTK_TEXTURE_BLENDING_MODE_ADD,
00179     VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED,
00180     VTK_TEXTURE_BLENDING_MODE_INTERPOLATE,
00181     VTK_TEXTURE_BLENDING_MODE_SUBTRACT
00182   };
00183 //ETX
00185 
00187 
00189   vtkGetMacro(BlendingMode, int);
00190   vtkSetMacro(BlendingMode, int);
00192 
00194 
00196   vtkGetMacro(PremultipliedAlpha,bool);
00197   vtkSetMacro(PremultipliedAlpha,bool);
00198   vtkBooleanMacro(PremultipliedAlpha,bool);
00200 
00202 
00207   vtkGetMacro(RestrictPowerOf2ImageSmaller,int);
00208   vtkSetMacro(RestrictPowerOf2ImageSmaller,int);
00209   vtkBooleanMacro(RestrictPowerOf2ImageSmaller,int);
00211 
00215   virtual int IsTranslucent();
00216 
00217 protected:
00218   vtkTexture();
00219   ~vtkTexture();
00220 
00221   int   Repeat;
00222   int   EdgeClamp;
00223   int   Interpolate;
00224   int   Quality;
00225   int   MapColorScalarsThroughLookupTable;
00226   vtkScalarsToColors *LookupTable;
00227   vtkUnsignedCharArray *MappedScalars;
00228   vtkTransform  *Transform;
00229 
00230   int BlendingMode;
00231   int RestrictPowerOf2ImageSmaller;
00232   // this is to duplicated the previous behavior of SelfCreatedLookUpTable
00233   int SelfAdjustingTableRange;
00234   bool PremultipliedAlpha;
00235 
00236   // the result of HasTranslucentPolygonalGeometry is cached
00237   vtkTimeStamp TranslucentComputationTime;
00238   int TranslucentCachedResult;
00239 
00240 private:
00241   vtkTexture(const vtkTexture&);  // Not implemented.
00242   void operator=(const vtkTexture&);  // Not implemented.
00243 };
00244 
00245 #endif