VTK  9.3.20240327
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
161 #ifndef vtkWindowToImageFilter_h
162 #define vtkWindowToImageFilter_h
163 
164 #include "vtkAlgorithm.h"
165 #include "vtkImageData.h" // makes things a bit easier
166 #include "vtkRenderingCoreModule.h" // For export macro
167 
168 // VTK_RGB and VTK_RGBA are defined in system includes
169 #define VTK_ZBUFFER 5
170 
171 VTK_ABI_NAMESPACE_BEGIN
172 class vtkWindow;
173 
174 class vtkWTI2DHelperClass;
175 class VTKRENDERINGCORE_EXPORT vtkWindowToImageFilter : public vtkAlgorithm
176 {
177 public:
179 
181  void PrintSelf(ostream& os, vtkIndent indent) override;
182 
186  void SetInput(vtkWindow* input);
187 
189 
193  vtkGetObjectMacro(Input, vtkWindow);
195 
197 
200  vtkSetVector2Macro(Scale, int);
201  vtkGetVector2Macro(Scale, int);
203 
208  void SetScale(int scale) { this->SetScale(scale, scale); }
209 
211 
216  vtkSetMacro(FixBoundary, bool);
217  vtkGetMacro(FixBoundary, bool);
218  vtkBooleanMacro(FixBoundary, bool);
220 
222 
226  vtkBooleanMacro(ReadFrontBuffer, vtkTypeBool);
227  vtkGetMacro(ReadFrontBuffer, vtkTypeBool);
228  vtkSetMacro(ReadFrontBuffer, vtkTypeBool);
230 
232 
236  vtkBooleanMacro(ShouldRerender, vtkTypeBool);
237  vtkSetMacro(ShouldRerender, vtkTypeBool);
238  vtkGetMacro(ShouldRerender, vtkTypeBool);
240 
242 
246  void SetViewport(double, double, double, double);
247  void SetViewport(double*);
248  vtkGetVectorMacro(Viewport, double, 4);
250 
252 
258  vtkSetMacro(InputBufferType, int);
259  vtkGetMacro(InputBufferType, int);
260  void SetInputBufferTypeToRGB() { this->SetInputBufferType(VTK_RGB); }
261  void SetInputBufferTypeToRGBA() { this->SetInputBufferType(VTK_RGBA); }
262  void SetInputBufferTypeToZBuffer() { this->SetInputBufferType(VTK_ZBUFFER); }
264 
269 
275 
276 protected:
279 
280  // vtkWindow is not a vtkDataObject, so we need our own ivar.
282  int Scale[2];
285  double Viewport[4];
288 
290 
292 
293  // see algorithm for more info
295 
303  virtual void Render();
304 
305  // The following was extracted from vtkRenderLargeImage, and patch to handle viewports
307  void Shift2DActors(int x, int y);
309  vtkWTI2DHelperClass* StoredData;
310 
311 private:
313  void operator=(const vtkWindowToImageFilter&) = delete;
314 };
315 
316 VTK_ABI_NAMESPACE_END
317 #endif
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:161
topologically and geometrically regular array of data
Definition: vtkImageData.h:155
a simple class to control print indentation
Definition: vtkIndent.h:108
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:47
@ 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