VTK
dox/Rendering/Core/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 "vtkRenderingCoreModule.h" // For export macro
00066 #include "vtkAlgorithm.h"
00067 #include "vtkImageData.h" // makes things a bit easier
00068 
00069 // VTK_RGB and VTK_RGBA are defined in system includes
00070 #define VTK_ZBUFFER 5
00071 
00072 class vtkWindow;
00073 
00074 class vtkWTI2DHelperClass;
00075 class VTKRENDERINGCORE_EXPORT vtkWindowToImageFilter : public vtkAlgorithm
00076 {
00077 public:
00078   static vtkWindowToImageFilter *New();
00079 
00080   vtkTypeMacro(vtkWindowToImageFilter,vtkAlgorithm);
00081   void PrintSelf(ostream& os, vtkIndent indent);
00082 
00085   void SetInput(vtkWindow *input);
00086 
00088 
00090   vtkGetObjectMacro(Input,vtkWindow);
00092 
00094 
00095   vtkSetClampMacro(Magnification,int,1,2048);
00096   vtkGetMacro(Magnification,int);
00098 
00100 
00103   vtkSetMacro(FixBoundary, bool);
00104   vtkGetMacro(FixBoundary, bool);
00105   vtkBooleanMacro(FixBoundary, bool);
00107 
00109 
00111   vtkBooleanMacro(ReadFrontBuffer, int);
00112   vtkGetMacro(ReadFrontBuffer, int);
00113   vtkSetMacro(ReadFrontBuffer, int);
00115 
00117 
00119   vtkBooleanMacro(ShouldRerender, int);
00120   vtkSetMacro(ShouldRerender, int);
00121   vtkGetMacro(ShouldRerender, int);
00123 
00125 
00127   vtkSetVector4Macro(Viewport,double);
00128   vtkGetVectorMacro(Viewport,double,4);
00130 
00132 
00136   vtkSetMacro(InputBufferType, int);
00137   vtkGetMacro(InputBufferType, int);
00138   void SetInputBufferTypeToRGB() {this->SetInputBufferType(VTK_RGB);};
00139   void SetInputBufferTypeToRGBA() {this->SetInputBufferType(VTK_RGBA);};
00140   void SetInputBufferTypeToZBuffer() {this->SetInputBufferType(VTK_ZBUFFER);};
00142 
00143 
00145   vtkImageData* GetOutput();
00146 
00148 
00149   virtual int ProcessRequest(vtkInformation*,
00150                              vtkInformationVector**,
00151                              vtkInformationVector*);
00153 
00154 protected:
00155   vtkWindowToImageFilter();
00156   ~vtkWindowToImageFilter();
00157 
00158   // vtkWindow is not a vtkDataObject, so we need our own ivar.
00159   vtkWindow *Input;
00160   int Magnification;
00161   int ReadFrontBuffer;
00162   int ShouldRerender;
00163   double Viewport[4];
00164   int InputBufferType;
00165   bool FixBoundary;
00166 
00167   void RequestData(vtkInformation *,
00168                    vtkInformationVector **, vtkInformationVector *);
00169 
00170   virtual void RequestInformation (vtkInformation*,
00171                                   vtkInformationVector**,
00172                                   vtkInformationVector*);
00173 
00174   // see algorithm for more info
00175   virtual int FillOutputPortInformation(int port, vtkInformation* info);
00176 
00177   // The following was extracted from vtkRenderLargeImage, and patch to handle viewports
00178   void Rescale2DActors();
00179   void Shift2DActors(int x, int y);
00180   void Restore2DActors();
00181   vtkWTI2DHelperClass *StoredData;
00182 
00183 private:
00184   vtkWindowToImageFilter(const vtkWindowToImageFilter&);  // Not implemented.
00185   void operator=(const vtkWindowToImageFilter&);  // Not implemented.
00186 };
00187 
00188 #endif