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