VTK  9.3.1
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:
69  static vtkWindowToImageFilter* New();
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 
159  vtkImageData* GetOutput();
160 
166 
167 protected:
169  ~vtkWindowToImageFilter() override;
170 
171  // vtkWindow is not a vtkDataObject, so we need our own ivar.
173  int Scale[2];
176  double Viewport[4];
179 
181 
182  virtual void RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
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
197  void Rescale2DActors();
198  void Shift2DActors(int x, int y);
199  void Restore2DActors();
200  vtkWTI2DHelperClass* StoredData;
201 
202 private:
204  void operator=(const vtkWindowToImageFilter&) = delete;
205 };
206 
207 VTK_ABI_NAMESPACE_END
208 #endif
vtkWTI2DHelperClass * StoredData
Store vtkAlgorithm input/output information.
void SetInputBufferTypeToRGB()
Set/get the window buffer from which data will be read.
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:64
virtual vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:51
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:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
#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.