vtkSMSaveScreenshotProxy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMSaveScreenshotProxy.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
30 #ifndef vtkSMSaveScreenshotProxy_h
31 #define vtkSMSaveScreenshotProxy_h
32 
33 #include "vtkRemotingViewsModule.h" // needed for exports
34 #include "vtkSMProxy.h"
35 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
36 #include "vtkVector.h" // needed for vtkVector2i.
37 
38 class vtkImageData;
40 class vtkSMViewProxy;
41 
43 {
44 public:
45  static vtkSMSaveScreenshotProxy* New();
47  void PrintSelf(ostream& os, vtkIndent indent) override;
48 
53  bool WriteImage(const char* filename);
54 
63  bool WriteImage(const char* filename, vtkTypeUInt32 location);
64 
68  vtkSmartPointer<vtkImageData> CaptureImage();
69 
73  virtual void UpdateDefaultsAndVisibilities(const char* filename);
74 
80  static vtkSmartPointer<vtkImageData> CaptureImage(vtkSMViewProxy* view, const vtkVector2i& size);
81 
87  static vtkSmartPointer<vtkImageData> CaptureImage(
88  vtkSMViewLayoutProxy* view, const vtkVector2i& size);
89 
102  static vtkVector2i GetScaleFactorsAndSize(
103  const vtkVector2i& targetSize, vtkVector2i& size, bool* approximate = nullptr);
104 
112  static int ComputeMagnification(const vtkVector2i& targetSize, vtkVector2i& size);
113 
115 
119  std::string GetFileFormatFilters();
121 
122 protected:
124  ~vtkSMSaveScreenshotProxy() override;
125 
130  std::pair<vtkSmartPointer<vtkImageData>, vtkSmartPointer<vtkImageData>> CapturePreppedImages();
131 
136  virtual bool Prepare();
137 
141  virtual bool Cleanup();
142 
143  vtkSMViewLayoutProxy* GetLayout();
144  vtkSMViewProxy* GetView();
145 
151  vtkSMProxy* GetFormatProxy(const std::string& filename);
152 
156  std::string GetStereoFileName(const std::string& filename, bool left);
157 
159  // vtkSMRecolorableImageExtractWriterProxy uses experimental API
160  // SetUseFloatingPointBuffers.
162  vtkSetMacro(UseFloatingPointBuffers, bool);
164 
165 private:
167  void operator=(const vtkSMSaveScreenshotProxy&) = delete;
168 
172  class vtkState;
173  class vtkStateView;
174  class vtkStateLayout;
175  vtkState* State;
176  bool UseFloatingPointBuffers;
177 };
178 
179 #endif
#define VTKREMOTINGVIEWS_EXPORT
void PrintSelf(ostream &os, vtkIndent indent) override
Superclass for all view proxies.
vtkSMMessage * State
Definition: vtkSMProxy.h:1006
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:152
void operator=(const vtkSMProxy &)=delete
proxy to help with saving screenshots for views