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
vtkImageData.h
vtkWindowToImageFilter::SetInputBufferTypeToZBuffer
void SetInputBufferTypeToZBuffer()
Definition: vtkWindowToImageFilter.h:164
vtkX3D::scale
Definition: vtkX3D.h:229
vtkWindowToImageFilter::ReadFrontBuffer
vtkTypeBool ReadFrontBuffer
Definition: vtkWindowToImageFilter.h:187
vtkAlgorithm
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:59
vtkWindowToImageFilter::SetInputBufferTypeToRGBA
void SetInputBufferTypeToRGBA()
Definition: vtkWindowToImageFilter.h:163
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkWindowToImageFilter::FixBoundary
bool FixBoundary
Definition: vtkWindowToImageFilter.h:191
vtkWindowToImageFilter
Use a vtkWindow as input to image pipeline.
Definition: vtkWindowToImageFilter.h:77
vtkWindowToImageFilter::SetScale
void SetScale(int scale)
Convenience method to set same scale factors for x and y.
Definition: vtkWindowToImageFilter.h:110
vtkWindowToImageFilter::Input
vtkWindow * Input
Definition: vtkWindowToImageFilter.h:185
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkAlgorithm.h
vtkX3D::port
Definition: vtkX3D.h:447
VTK_ZBUFFER
#define VTK_ZBUFFER
Definition: vtkWindowToImageFilter.h:72
VTK_RGB
#define VTK_RGB
Definition: vtkSystemIncludes.h:99
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkWindowToImageFilter::ShouldRerender
vtkTypeBool ShouldRerender
Definition: vtkWindowToImageFilter.h:188
vtkWindowToImageFilter::InputBufferType
int InputBufferType
Definition: vtkWindowToImageFilter.h:190
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
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:216
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:162