VTK  9.3.0
vtkWindow.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
26 #ifndef vtkWindow_h
27 #define vtkWindow_h
28 
29 #include "vtkCommonCoreModule.h" // For export macro
30 #include "vtkObject.h"
31 
32 VTK_ABI_NAMESPACE_BEGIN
33 class vtkImageData;
35 
36 class VTKCOMMONCORE_EXPORT vtkWindow : public vtkObject
37 {
38 public:
39  vtkTypeMacro(vtkWindow, vtkObject);
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
43 
47  virtual void SetDisplayId(void*) {}
48  virtual void SetWindowId(void*) {}
49  virtual void SetParentId(void*) {}
50  virtual void* GetGenericDisplayId() { return nullptr; }
51  virtual void* GetGenericWindowId() { return nullptr; }
52  virtual void* GetGenericParentId() { return nullptr; }
53  virtual void* GetGenericContext() { return nullptr; }
54  virtual void* GetGenericDrawable() { return nullptr; }
55  virtual void SetWindowInfo(const char*) {}
56  virtual void SetParentInfo(const char*) {}
58 
60 
64  virtual int* GetPosition() VTK_SIZEHINT(2);
65 
71  virtual void SetPosition(int x, int y);
72  virtual void SetPosition(int a[2]);
74 
76 
80  virtual int* GetSize() VTK_SIZEHINT(2);
81 
90  virtual void SetSize(int width, int height);
91  virtual void SetSize(int a[2]);
93 
98  int* GetActualSize() VTK_SIZEHINT(2);
99 
103  virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
104 
106 
109  vtkGetMacro(Mapped, vtkTypeBool);
111 
113 
116  vtkGetMacro(ShowWindow, bool);
117  vtkSetMacro(ShowWindow, bool);
118  vtkBooleanMacro(ShowWindow, bool);
120 
122 
127  vtkSetMacro(UseOffScreenBuffers, bool);
128  vtkGetMacro(UseOffScreenBuffers, bool);
129  vtkBooleanMacro(UseOffScreenBuffers, bool);
131 
133 
139  vtkSetMacro(Erase, vtkTypeBool);
140  vtkGetMacro(Erase, vtkTypeBool);
141  vtkBooleanMacro(Erase, vtkTypeBool);
143 
145 
148  vtkSetMacro(DoubleBuffer, vtkTypeBool);
149  vtkGetMacro(DoubleBuffer, vtkTypeBool);
150  vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
152 
154 
157  vtkGetStringMacro(WindowName);
158  vtkSetStringMacro(WindowName);
160 
165  virtual void SetIcon(vtkImageData*) {}
166 
171  virtual void Render() {}
172 
179 
181 
193  virtual unsigned char* GetPixelData(
194  int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
195  {
196  return nullptr;
197  }
198  virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
199  vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
200  {
201  return 0;
202  }
204 
206 
210  vtkGetMacro(DPI, int);
211  vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
213 
220  virtual bool DetectDPI() { return false; }
221 
223 
227  {
228  this->SetShowWindow(val == 0);
229  this->SetUseOffScreenBuffers(val != 0);
230  }
231  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
233 
238  vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
239 
244  virtual void MakeCurrent() {}
245 
250  virtual void ReleaseCurrent() {}
251 
253 
259  vtkSetVector2Macro(TileScale, int);
260  vtkGetVector2Macro(TileScale, int);
261  void SetTileScale(int s) { this->SetTileScale(s, s); }
262  vtkSetVector4Macro(TileViewport, double);
263  vtkGetVector4Macro(TileViewport, double);
265 
266 protected:
268  ~vtkWindow() override;
269 
270  char* WindowName;
271  int Size[2];
272  int Position[2];
278  int DPI;
279 
280  double TileViewport[4];
281  int TileSize[2];
282  int TileScale[2];
283 
284 private:
285  vtkWindow(const vtkWindow&) = delete;
286  void operator=(const vtkWindow&) = delete;
287 };
288 
289 VTK_ABI_NAMESPACE_END
290 #endif
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract base class for most VTK objects
Definition: vtkObject.h:61
dynamic, self-adjusting array of unsigned char
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool UseOffScreenBuffers
Definition: vtkWindow.h:275
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition: vtkWindow.h:220
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition: vtkWindow.h:238
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:54
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition: vtkWindow.h:165
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:55
virtual void ReleaseCurrent()
Release the current context.
Definition: vtkWindow.h:250
vtkTypeBool DoubleBuffer
Definition: vtkWindow.h:277
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:52
~vtkWindow() override
virtual int GetPixelData(int, int, int, int, int, vtkUnsignedCharArray *, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition: vtkWindow.h:198
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:47
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition: vtkWindow.h:193
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition: vtkWindow.h:226
virtual void * GetGenericDisplayId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:50
vtkTypeBool Mapped
Definition: vtkWindow.h:273
virtual int * GetPosition()
Get the position (x and y) of the rendering window in screen coordinates (in pixels).
vtkTypeBool Erase
Definition: vtkWindow.h:276
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:51
bool ShowWindow
Definition: vtkWindow.h:274
char * WindowName
Definition: vtkWindow.h:270
virtual void SetParentInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:56
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkWindow.h:178
virtual void * GetGenericContext()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:53
virtual void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition: vtkWindow.h:171
virtual void SetParentId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:49
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition: vtkWindow.h:261
virtual void MakeCurrent()
Make the window current.
Definition: vtkWindow.h:244
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:48
@ height
Definition: vtkX3D.h:254
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_INT_MAX
Definition: vtkType.h:144
#define VTK_SIZEHINT(...)