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
52 #ifndef vtkWindowToImageFilter_h
53 #define vtkWindowToImageFilter_h
54 
55 #include "vtkAlgorithm.h"
56 #include "vtkImageData.h" // makes things a bit easier
57 #include "vtkRenderingCoreModule.h" // For export macro
58 
59 // VTK_RGB and VTK_RGBA are defined in system includes
60 #define VTK_ZBUFFER 5
61 
62 VTK_ABI_NAMESPACE_BEGIN
63 class vtkWindow;
64 
65 class vtkWTI2DHelperClass;
66 class VTKRENDERINGCORE_EXPORT vtkWindowToImageFilter : public vtkAlgorithm
67 {
68 public:
70 
72  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
77  void SetInput(vtkWindow* input);
78 
80 
84  vtkGetObjectMacro(Input, vtkWindow);
86 
88 
91  vtkSetVector2Macro(Scale, int);
92  vtkGetVector2Macro(Scale, int);
94 
99  void SetScale(int scale) { this->SetScale(scale, scale); }
100 
102 
107  vtkSetMacro(FixBoundary, bool);
108  vtkGetMacro(FixBoundary, bool);
109  vtkBooleanMacro(FixBoundary, bool);
111 
113 
117  vtkBooleanMacro(ReadFrontBuffer, vtkTypeBool);
118  vtkGetMacro(ReadFrontBuffer, vtkTypeBool);
119  vtkSetMacro(ReadFrontBuffer, vtkTypeBool);
121 
123 
127  vtkBooleanMacro(ShouldRerender, vtkTypeBool);
128  vtkSetMacro(ShouldRerender, vtkTypeBool);
129  vtkGetMacro(ShouldRerender, vtkTypeBool);
131 
133 
137  void SetViewport(double, double, double, double);
138  void SetViewport(double*);
139  vtkGetVectorMacro(Viewport, double, 4);
141 
143 
149  vtkSetMacro(InputBufferType, int);
150  vtkGetMacro(InputBufferType, int);
151  void SetInputBufferTypeToRGB() { this->SetInputBufferType(VTK_RGB); }
152  void SetInputBufferTypeToRGBA() { this->SetInputBufferType(VTK_RGBA); }
153  void SetInputBufferTypeToZBuffer() { this->SetInputBufferType(VTK_ZBUFFER); }
155 
160 
166 
167 protected:
170 
171  // vtkWindow is not a vtkDataObject, so we need our own ivar.
173  int Scale[2];
176  double Viewport[4];
179 
181 
183 
184  // see algorithm for more info
186 
194  virtual void Render();
195 
196  // The following was extracted from vtkRenderLargeImage, and patch to handle viewports
198  void Shift2DActors(int x, int y);
200  vtkWTI2DHelperClass* StoredData;
201 
202 private:
204  void operator=(const vtkWindowToImageFilter&) = delete;
205 };
206 
207 VTK_ABI_NAMESPACE_END
208 #endif
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:52
topologically and geometrically regular array of data
Definition: vtkImageData.h:43
a simple class to control print indentation
Definition: vtkIndent.h:29
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:28
@ 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