VTK  9.3.0
vtkWindowToImageFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
61 #ifndef vtkWindowToImageFilter_h
62 #define vtkWindowToImageFilter_h
63 
64 #include "vtkAlgorithm.h"
65 #include "vtkImageData.h" // makes things a bit easier
66 #include "vtkRenderingCoreModule.h" // For export macro
67 
68 // VTK_RGB and VTK_RGBA are defined in system includes
69 #define VTK_ZBUFFER 5
70 
71 VTK_ABI_NAMESPACE_BEGIN
72 class vtkWindow;
73 
74 class vtkWTI2DHelperClass;
75 class VTKRENDERINGCORE_EXPORT vtkWindowToImageFilter : public vtkAlgorithm
76 {
77 public:
79 
81  void PrintSelf(ostream& os, vtkIndent indent) override;
82 
86  void SetInput(vtkWindow* input);
87 
89 
93  vtkGetObjectMacro(Input, vtkWindow);
95 
97 
100  vtkSetVector2Macro(Scale, int);
101  vtkGetVector2Macro(Scale, int);
103 
108  void SetScale(int scale) { this->SetScale(scale, scale); }
109 
111 
116  vtkSetMacro(FixBoundary, bool);
117  vtkGetMacro(FixBoundary, bool);
118  vtkBooleanMacro(FixBoundary, bool);
120 
122 
126  vtkBooleanMacro(ReadFrontBuffer, vtkTypeBool);
127  vtkGetMacro(ReadFrontBuffer, vtkTypeBool);
128  vtkSetMacro(ReadFrontBuffer, vtkTypeBool);
130 
132 
136  vtkBooleanMacro(ShouldRerender, vtkTypeBool);
137  vtkSetMacro(ShouldRerender, vtkTypeBool);
138  vtkGetMacro(ShouldRerender, vtkTypeBool);
140 
142 
146  void SetViewport(double, double, double, double);
147  void SetViewport(double*);
148  vtkGetVectorMacro(Viewport, double, 4);
150 
152 
158  vtkSetMacro(InputBufferType, int);
159  vtkGetMacro(InputBufferType, int);
160  void SetInputBufferTypeToRGB() { this->SetInputBufferType(VTK_RGB); }
161  void SetInputBufferTypeToRGBA() { this->SetInputBufferType(VTK_RGBA); }
162  void SetInputBufferTypeToZBuffer() { this->SetInputBufferType(VTK_ZBUFFER); }
164 
169 
175 
176 protected:
179 
180  // vtkWindow is not a vtkDataObject, so we need our own ivar.
182  int Scale[2];
185  double Viewport[4];
188 
190 
192 
193  // see algorithm for more info
195 
203  virtual void Render();
204 
205  // The following was extracted from vtkRenderLargeImage, and patch to handle viewports
207  void Shift2DActors(int x, int y);
209  vtkWTI2DHelperClass* StoredData;
210 
211 private:
213  void operator=(const vtkWindowToImageFilter&) = delete;
214 };
215 
216 VTK_ABI_NAMESPACE_END
217 #endif
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:61
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
a simple class to control print indentation
Definition: vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Use a vtkWindow as input to image pipeline.
void SetViewport(double *)
Set/get the extents to be used to generate the image.
vtkTypeBool ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
see vtkAlgorithm for details
void SetInput(vtkWindow *input)
Indicates what renderer to get the pixel data from.
virtual void Render()
Allows subclasses to customize how a request for render is handled.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetViewport(double, double, double, double)
Set/get the extents to be used to generate the image.
void SetInputBufferTypeToRGB()
Set/get the window buffer from which data will be read.
static vtkWindowToImageFilter * New()
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkWTI2DHelperClass * StoredData
void Shift2DActors(int x, int y)
void SetInputBufferTypeToRGBA()
Set/get the window buffer from which data will be read.
void RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual void RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
void SetScale(int scale)
Convenience method to set same scale factors for x and y.
void SetInputBufferTypeToZBuffer()
Set/get the window buffer from which data will be read.
~vtkWindowToImageFilter() override
vtkImageData * GetOutput()
Get the output data object for a port on this algorithm.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ scale
Definition: vtkX3D.h:229
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_RGBA
#define VTK_RGB
#define VTK_ZBUFFER