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 =========================================================================*/
64 #ifndef vtkWindowToImageFilter_h
65 #define vtkWindowToImageFilter_h
66 
67 #include "vtkRenderingCoreModule.h" // For export macro
68 #include "vtkAlgorithm.h"
69 #include "vtkImageData.h" // makes things a bit easier
70 
71 // VTK_RGB and VTK_RGBA are defined in system includes
72 #define VTK_ZBUFFER 5
73 
74 class vtkWindow;
75 
76 class vtkWTI2DHelperClass;
77 class VTKRENDERINGCORE_EXPORT vtkWindowToImageFilter : public vtkAlgorithm
78 {
79 public:
80  static vtkWindowToImageFilter *New();
81 
83  void PrintSelf(ostream& os, vtkIndent indent) override;
84 
88  void SetInput(vtkWindow *input);
89 
91 
95  vtkGetObjectMacro(Input,vtkWindow);
97 
99 
102  vtkSetVector2Macro(Scale, int);
103  vtkGetVector2Macro(Scale, int);
105 
110  void SetScale(int scale) { this->SetScale(scale, scale); }
111 
113 
118  vtkSetMacro(FixBoundary, bool);
119  vtkGetMacro(FixBoundary, bool);
120  vtkBooleanMacro(FixBoundary, bool);
122 
124 
128  vtkBooleanMacro(ReadFrontBuffer, vtkTypeBool);
129  vtkGetMacro(ReadFrontBuffer, vtkTypeBool);
130  vtkSetMacro(ReadFrontBuffer, vtkTypeBool);
132 
134 
138  vtkBooleanMacro(ShouldRerender, vtkTypeBool);
139  vtkSetMacro(ShouldRerender, vtkTypeBool);
140  vtkGetMacro(ShouldRerender, vtkTypeBool);
142 
144 
148  void SetViewport(double, double, double, double);
149  void SetViewport(double*);
150  vtkGetVectorMacro(Viewport,double,4);
152 
154 
160  vtkSetMacro(InputBufferType, int);
161  vtkGetMacro(InputBufferType, int);
162  void SetInputBufferTypeToRGB() {this->SetInputBufferType(VTK_RGB);};
163  void SetInputBufferTypeToRGBA() {this->SetInputBufferType(VTK_RGBA);};
164  void SetInputBufferTypeToZBuffer() {this->SetInputBufferType(VTK_ZBUFFER);};
166 
167 
171  vtkImageData* GetOutput();
172 
178  vtkInformationVector*) override;
179 
180 protected:
182  ~vtkWindowToImageFilter() override;
183 
184  // vtkWindow is not a vtkDataObject, so we need our own ivar.
186  int Scale[2];
189  double Viewport[4];
192 
193  void RequestData(vtkInformation *,
195 
196  virtual void RequestInformation (vtkInformation*,
199 
200  // see algorithm for more info
202 
210  virtual void Render();
211 
212  // The following was extracted from vtkRenderLargeImage, and patch to handle viewports
213  void Rescale2DActors();
214  void Shift2DActors(int x, int y);
215  void Restore2DActors();
216  vtkWTI2DHelperClass *StoredData;
217 
218 private:
220  void operator=(const vtkWindowToImageFilter&) = delete;
221 };
222 
223 #endif
vtkWTI2DHelperClass * StoredData
Store vtkAlgorithm input/output information.
void SetInputBufferTypeToRGB()
Set/get the window buffer from which data will be read.
virtual int ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetInputBufferTypeToZBuffer()
Set/get the window buffer from which data will be read.
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:59
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Fill the output port information objects for this algorithm.
void SetScale(int scale)
Convenience method to set same scale factors for x and y.
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:47
#define VTK_ZBUFFER
Use a vtkWindow as input to image pipeline.
#define VTK_RGBA
#define VTK_RGB
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
void SetInputBufferTypeToRGBA()
Set/get the window buffer from which data will be read.