VTK
dox/Rendering/vtkWindowToImageFilter.h
Go to the documentation of this file.
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 
00102   vtkSetMacro(FixBoundary, bool);
00103   vtkGetMacro(FixBoundary, bool);
00104   vtkBooleanMacro(FixBoundary, bool);
00106 
00108 
00110   vtkBooleanMacro(ReadFrontBuffer, int);
00111   vtkGetMacro(ReadFrontBuffer, int);
00112   vtkSetMacro(ReadFrontBuffer, int);
00114   
00116 
00118   vtkBooleanMacro(ShouldRerender, int);
00119   vtkSetMacro(ShouldRerender, int);
00120   vtkGetMacro(ShouldRerender, int);
00122   
00124 
00126   vtkSetVector4Macro(Viewport,double);
00127   vtkGetVectorMacro(Viewport,double,4);
00129 
00131 
00135   vtkSetMacro(InputBufferType, int);
00136   vtkGetMacro(InputBufferType, int);
00137   void SetInputBufferTypeToRGB() {this->SetInputBufferType(VTK_RGB);};
00138   void SetInputBufferTypeToRGBA() {this->SetInputBufferType(VTK_RGBA);};
00139   void SetInputBufferTypeToZBuffer() {this->SetInputBufferType(VTK_ZBUFFER);};
00141 
00142 
00144   vtkImageData* GetOutput();
00145 
00147 
00148   virtual int ProcessRequest(vtkInformation*,
00149                              vtkInformationVector**,
00150                              vtkInformationVector*);
00152 
00153 protected:
00154   vtkWindowToImageFilter();
00155   ~vtkWindowToImageFilter();
00156 
00157   // vtkWindow is not a vtkDataObject, so we need our own ivar.
00158   vtkWindow *Input;
00159   int Magnification;
00160   int ReadFrontBuffer;
00161   int ShouldRerender;
00162   double Viewport[4];
00163   int InputBufferType;
00164   bool FixBoundary;
00165 
00166   void RequestData(vtkInformation *, 
00167                    vtkInformationVector **, vtkInformationVector *);
00168 
00169   virtual void RequestInformation (vtkInformation*,
00170                                   vtkInformationVector**,
00171                                   vtkInformationVector*);
00172 
00173   // see algorithm for more info
00174   virtual int FillOutputPortInformation(int port, vtkInformation* info);
00175 
00176   // The following was extracted from vtkRenderLargeImage, and patch to handle viewports
00177   void Rescale2DActors();
00178   void Shift2DActors(int x, int y);
00179   void Restore2DActors();
00180   vtkWTI2DHelperClass *StoredData;
00181 
00182 private:
00183   vtkWindowToImageFilter(const vtkWindowToImageFilter&);  // Not implemented.
00184   void operator=(const vtkWindowToImageFilter&);  // Not implemented.
00185 };
00186 
00187 #endif