VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkWindowToImageFilter.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 =========================================================================*/ 00062 #ifndef __vtkWindowToImageFilter_h 00063 #define __vtkWindowToImageFilter_h 00064 00065 #include "vtkAlgorithm.h" 00066 #include "vtkImageData.h" // makes things a bit easier 00067 00068 // VTK_RGB and VTK_RGBA are defined in system includes 00069 #define VTK_ZBUFFER 5 00070 00071 class vtkWindow; 00072 00073 class vtkWTI2DHelperClass; 00074 class VTK_RENDERING_EXPORT vtkWindowToImageFilter : public vtkAlgorithm 00075 { 00076 public: 00077 static vtkWindowToImageFilter *New(); 00078 00079 vtkTypeMacro(vtkWindowToImageFilter,vtkAlgorithm); 00080 void PrintSelf(ostream& os, vtkIndent indent); 00081 00084 void SetInput(vtkWindow *input); 00085 00087 00089 vtkGetObjectMacro(Input,vtkWindow); 00091 00093 00094 vtkSetClampMacro(Magnification,int,1,2048); 00095 vtkGetMacro(Magnification,int); 00097 00099 00101 vtkBooleanMacro(ReadFrontBuffer, int); 00102 vtkGetMacro(ReadFrontBuffer, int); 00103 vtkSetMacro(ReadFrontBuffer, int); 00105 00107 00109 vtkBooleanMacro(ShouldRerender, int); 00110 vtkSetMacro(ShouldRerender, int); 00111 vtkGetMacro(ShouldRerender, int); 00113 00115 00117 vtkSetVector4Macro(Viewport,double); 00118 vtkGetVectorMacro(Viewport,double,4); 00120 00122 00126 vtkSetMacro(InputBufferType, int); 00127 vtkGetMacro(InputBufferType, int); 00128 void SetInputBufferTypeToRGB() {this->SetInputBufferType(VTK_RGB);}; 00129 void SetInputBufferTypeToRGBA() {this->SetInputBufferType(VTK_RGBA);}; 00130 void SetInputBufferTypeToZBuffer() {this->SetInputBufferType(VTK_ZBUFFER);}; 00132 00133 00135 vtkImageData* GetOutput(); 00136 00138 00139 virtual int ProcessRequest(vtkInformation*, 00140 vtkInformationVector**, 00141 vtkInformationVector*); 00143 00144 protected: 00145 vtkWindowToImageFilter(); 00146 ~vtkWindowToImageFilter(); 00147 00148 // vtkWindow is not a vtkDataObject, so we need our own ivar. 00149 vtkWindow *Input; 00150 int Magnification; 00151 int ReadFrontBuffer; 00152 int ShouldRerender; 00153 double Viewport[4]; 00154 int InputBufferType; 00155 00156 void RequestData(vtkInformation *, 00157 vtkInformationVector **, vtkInformationVector *); 00158 00159 virtual void RequestInformation (vtkInformation*, 00160 vtkInformationVector**, 00161 vtkInformationVector*); 00162 00163 // see algorithm for more info 00164 virtual int FillOutputPortInformation(int port, vtkInformation* info); 00165 00166 // The following was extracted from vtkRenderLargeImage, and patch to handle viewports 00167 void Rescale2DActors(); 00168 void Shift2DActors(int x, int y); 00169 void Restore2DActors(); 00170 vtkWTI2DHelperClass *StoredData; 00171 00172 private: 00173 vtkWindowToImageFilter(const vtkWindowToImageFilter&); // Not implemented. 00174 void operator=(const vtkWindowToImageFilter&); // Not implemented. 00175 }; 00176 00177 #endif