VTK
vtkWindowToImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkWindowToImageFilter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
58 #ifndef vtkWindowToImageFilter_h
59 #define vtkWindowToImageFilter_h
60 
61 #include "vtkRenderingCoreModule.h" // For export macro
62 #include "vtkAlgorithm.h"
63 #include "vtkImageData.h" // makes things a bit easier
64 
65 // VTK_RGB and VTK_RGBA are defined in system includes
66 #define VTK_ZBUFFER 5
67 
68 class vtkWindow;
69 
70 class vtkWTI2DHelperClass;
71 class VTKRENDERINGCORE_EXPORT vtkWindowToImageFilter : public vtkAlgorithm
72 {
73 public:
74  static vtkWindowToImageFilter *New();
75 
77  void PrintSelf(ostream& os, vtkIndent indent) override;
78 
82  void SetInput(vtkWindow *input);
83 
85 
89  vtkGetObjectMacro(Input,vtkWindow);
91 
93 
96  vtkSetVector2Macro(Scale, int);
97  vtkGetVector2Macro(Scale, int);
99 
104  void SetScale(int scale) { this->SetScale(scale, scale); }
105 
107 
112  vtkSetMacro(FixBoundary, bool);
113  vtkGetMacro(FixBoundary, bool);
114  vtkBooleanMacro(FixBoundary, bool);
116 
118 
122  vtkBooleanMacro(ReadFrontBuffer, vtkTypeBool);
123  vtkGetMacro(ReadFrontBuffer, vtkTypeBool);
124  vtkSetMacro(ReadFrontBuffer, vtkTypeBool);
126 
128 
132  vtkBooleanMacro(ShouldRerender, vtkTypeBool);
133  vtkSetMacro(ShouldRerender, vtkTypeBool);
134  vtkGetMacro(ShouldRerender, vtkTypeBool);
136 
138 
142  void SetViewport(double, double, double, double);
143  void SetViewport(double*);
144  vtkGetVectorMacro(Viewport,double,4);
146 
148 
154  vtkSetMacro(InputBufferType, int);
155  vtkGetMacro(InputBufferType, int);
156  void SetInputBufferTypeToRGB() {this->SetInputBufferType(VTK_RGB);};
157  void SetInputBufferTypeToRGBA() {this->SetInputBufferType(VTK_RGBA);};
158  void SetInputBufferTypeToZBuffer() {this->SetInputBufferType(VTK_ZBUFFER);};
160 
161 
165  vtkImageData* GetOutput();
166 
172  vtkInformationVector*) override;
173 
174 protected:
176  ~vtkWindowToImageFilter() override;
177 
178  // vtkWindow is not a vtkDataObject, so we need our own ivar.
180  int Scale[2];
183  double Viewport[4];
186 
187  void RequestData(vtkInformation *,
189 
190  virtual void RequestInformation (vtkInformation*,
193 
194  // see algorithm for more info
196 
204  virtual void Render();
205 
206  // The following was extracted from vtkRenderLargeImage, and patch to handle viewports
207  void Rescale2DActors();
208  void Shift2DActors(int x, int y);
209  void Restore2DActors();
210  vtkWTI2DHelperClass *StoredData;
211 
212 private:
214  void operator=(const vtkWindowToImageFilter&) = delete;
215 };
216 
217 #endif
vtkImageData.h
vtkWindowToImageFilter::SetInputBufferTypeToZBuffer
void SetInputBufferTypeToZBuffer()
Definition: vtkWindowToImageFilter.h:158
vtkX3D::scale
Definition: vtkX3D.h:229
vtkWindowToImageFilter::ReadFrontBuffer
vtkTypeBool ReadFrontBuffer
Definition: vtkWindowToImageFilter.h:181
vtkAlgorithm
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:53
vtkWindowToImageFilter::SetInputBufferTypeToRGBA
void SetInputBufferTypeToRGBA()
Definition: vtkWindowToImageFilter.h:157
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkWindowToImageFilter::FixBoundary
bool FixBoundary
Definition: vtkWindowToImageFilter.h:185
vtkWindowToImageFilter
Use a vtkWindow as input to image pipeline.
Definition: vtkWindowToImageFilter.h:71
vtkWindowToImageFilter::SetScale
void SetScale(int scale)
Convenience method to set same scale factors for x and y.
Definition: vtkWindowToImageFilter.h:104
vtkWindowToImageFilter::Input
vtkWindow * Input
Definition: vtkWindowToImageFilter.h:179
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkAlgorithm.h
vtkX3D::port
Definition: vtkX3D.h:447
VTK_ZBUFFER
#define VTK_ZBUFFER
Definition: vtkWindowToImageFilter.h:66
VTK_RGB
#define VTK_RGB
Definition: vtkSystemIncludes.h:99
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkWindowToImageFilter::ShouldRerender
vtkTypeBool ShouldRerender
Definition: vtkWindowToImageFilter.h:182
vtkWindowToImageFilter::InputBufferType
int InputBufferType
Definition: vtkWindowToImageFilter.h:184
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkX3D::info
Definition: vtkX3D.h:376
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkAlgorithm::ProcessRequest
virtual int ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
VTK_RGBA
#define VTK_RGBA
Definition: vtkSystemIncludes.h:100
vtkAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkWindowToImageFilter::StoredData
vtkWTI2DHelperClass * StoredData
Definition: vtkWindowToImageFilter.h:210
vtkAlgorithm::FillOutputPortInformation
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Fill the output port information objects for this algorithm.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkWindowToImageFilter::SetInputBufferTypeToRGB
void SetInputBufferTypeToRGB()
Definition: vtkWindowToImageFilter.h:156