vtkSMSaveScreenshotProxy.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
18 #ifndef vtkSMSaveScreenshotProxy_h
19 #define vtkSMSaveScreenshotProxy_h
20 
21 #include "vtkPVSession.h" // needed for vtkPVSession::ServerFlags
22 #include "vtkRemotingViewsModule.h" // needed for exports
23 #include "vtkSMProxy.h"
24 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
25 #include "vtkVector.h" // needed for vtkVector2i.
26 
27 class vtkImageData;
28 class vtkPVXMLElement;
30 class vtkSMViewProxy;
31 
33 {
34 public:
35  static vtkSMSaveScreenshotProxy* New();
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
48  bool WriteImage(const char* filename, vtkTypeUInt32 location = vtkPVSession::CLIENT,
49  vtkPVXMLElement* stateXMLRoot = nullptr);
50 
54  vtkSmartPointer<vtkImageData> CaptureImage();
55 
59  virtual void UpdateDefaultsAndVisibilities(const char* filename);
60 
66  static vtkSmartPointer<vtkImageData> CaptureImage(vtkSMViewProxy* view, const vtkVector2i& size);
67 
73  static vtkSmartPointer<vtkImageData> CaptureImage(
74  vtkSMViewLayoutProxy* view, const vtkVector2i& size);
75 
88  static vtkVector2i GetScaleFactorsAndSize(
89  const vtkVector2i& targetSize, vtkVector2i& size, bool* approximate = nullptr);
90 
98  static int ComputeMagnification(const vtkVector2i& targetSize, vtkVector2i& size);
99 
101 
105  std::string GetFileFormatFilters();
107 
108 protected:
110  ~vtkSMSaveScreenshotProxy() override;
111 
116  std::pair<vtkSmartPointer<vtkImageData>, vtkSmartPointer<vtkImageData>> CapturePreppedImages();
117 
122  virtual bool Prepare();
123 
127  virtual bool Cleanup();
128 
129  vtkSMViewLayoutProxy* GetLayout();
130  vtkSMViewProxy* GetView();
131 
137  vtkSMProxy* GetFormatProxy(const std::string& filename);
138 
142  std::string GetStereoFileName(const std::string& filename, bool left);
143 
145  // vtkSMRecolorableImageExtractWriterProxy uses experimental API
146  // SetUseFloatingPointBuffers.
148  vtkSetMacro(UseFloatingPointBuffers, bool);
150 
151 private:
153  void operator=(const vtkSMSaveScreenshotProxy&) = delete;
154 
158  class vtkState;
159  class vtkStateView;
160  class vtkStateLayout;
161  vtkState* State;
162  bool UseFloatingPointBuffers;
163 };
164 
165 #endif
#define VTKREMOTINGVIEWS_EXPORT
void PrintSelf(ostream &os, vtkIndent indent) override
Superclass for all view proxies.
vtkSMMessage * State
Definition: vtkSMProxy.h:995
vtkSMViewLayoutProxy is used by ParaView to layout multiple views in a 2D KD-Tree layout...
static vtkSMProxy * New()
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
void operator=(const vtkSMProxy &)=delete
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
proxy to help with saving screenshots for views