VTK  9.3.20240328
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
36 #ifndef vtkWindow_h
37 #define vtkWindow_h
38 
39 #include "vtkCommonCoreModule.h" // For export macro
40 #include "vtkObject.h"
41 
42 VTK_ABI_NAMESPACE_BEGIN
43 class vtkImageData;
45 
46 class VTKCOMMONCORE_EXPORT vtkWindow : public vtkObject
47 {
48 public:
49  vtkTypeMacro(vtkWindow, vtkObject);
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
53 
57  virtual void SetDisplayId(void*) {}
58  virtual void SetWindowId(void*) {}
59  virtual void SetParentId(void*) {}
60  virtual void* GetGenericDisplayId() { return nullptr; }
61  virtual void* GetGenericWindowId() { return nullptr; }
62  virtual void* GetGenericParentId() { return nullptr; }
63  virtual void* GetGenericContext() { return nullptr; }
64  virtual void* GetGenericDrawable() { return nullptr; }
65  virtual void SetWindowInfo(const char*) {}
66  virtual void SetParentInfo(const char*) {}
68 
70 
74  virtual int* GetPosition() VTK_SIZEHINT(2);
75 
81  virtual void SetPosition(int x, int y);
82  virtual void SetPosition(int a[2]);
84 
86 
90  virtual int* GetSize() VTK_SIZEHINT(2);
91 
100  virtual void SetSize(int width, int height);
101  virtual void SetSize(int a[2]);
103 
108  int* GetActualSize() VTK_SIZEHINT(2);
109 
113  virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
114 
116 
119  vtkGetMacro(Mapped, vtkTypeBool);
121 
123 
126  vtkGetMacro(ShowWindow, bool);
127  vtkSetMacro(ShowWindow, bool);
128  vtkBooleanMacro(ShowWindow, bool);
130 
132 
137  vtkSetMacro(UseOffScreenBuffers, bool);
138  vtkGetMacro(UseOffScreenBuffers, bool);
139  vtkBooleanMacro(UseOffScreenBuffers, bool);
141 
143 
149  vtkSetMacro(Erase, vtkTypeBool);
150  vtkGetMacro(Erase, vtkTypeBool);
151  vtkBooleanMacro(Erase, vtkTypeBool);
153 
155 
158  vtkSetMacro(DoubleBuffer, vtkTypeBool);
159  vtkGetMacro(DoubleBuffer, vtkTypeBool);
160  vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
162 
164 
167  vtkGetStringMacro(WindowName);
168  vtkSetStringMacro(WindowName);
170 
175  virtual void SetIcon(vtkImageData*) {}
176 
181  virtual void Render() {}
182 
189 
191 
203  virtual unsigned char* GetPixelData(
204  int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
205  {
206  return nullptr;
207  }
208  virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
209  vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
210  {
211  return 0;
212  }
214 
216 
220  vtkGetMacro(DPI, int);
221  vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
223 
230  virtual bool DetectDPI() { return false; }
231 
233 
237  {
238  this->SetShowWindow(val == 0);
239  this->SetUseOffScreenBuffers(val != 0);
240  }
241  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
243 
248  vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
249 
254  virtual void MakeCurrent() {}
255 
260  virtual void ReleaseCurrent() {}
261 
263 
269  vtkSetVector2Macro(TileScale, int);
270  vtkGetVector2Macro(TileScale, int);
271  void SetTileScale(int s) { this->SetTileScale(s, s); }
272  vtkSetVector4Macro(TileViewport, double);
273  vtkGetVector4Macro(TileViewport, double);
275 
276 protected:
278  ~vtkWindow() override;
279 
280  char* WindowName;
281  int Size[2];
282  int Position[2];
288  int DPI;
289 
290  double TileViewport[4];
291  int TileSize[2];
292  int TileScale[2];
293 
294 private:
295  vtkWindow(const vtkWindow&) = delete;
296  void operator=(const vtkWindow&) = delete;
297 };
298 
299 VTK_ABI_NAMESPACE_END
300 #endif
topologically and geometrically regular array of data
Definition: vtkImageData.h:155
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:161
dynamic, self-adjusting array of unsigned char
window superclass for vtkRenderWindow
Definition: vtkWindow.h:47
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool UseOffScreenBuffers
Definition: vtkWindow.h:285
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition: vtkWindow.h:230
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition: vtkWindow.h:248
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:64
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition: vtkWindow.h:175
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:65
virtual void ReleaseCurrent()
Release the current context.
Definition: vtkWindow.h:260
vtkTypeBool DoubleBuffer
Definition: vtkWindow.h:287
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:62
~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:208
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:57
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition: vtkWindow.h:203
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition: vtkWindow.h:236
virtual void * GetGenericDisplayId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:60
vtkTypeBool Mapped
Definition: vtkWindow.h:283
virtual int * GetPosition()
Get the position (x and y) of the rendering window in screen coordinates (in pixels).
vtkTypeBool Erase
Definition: vtkWindow.h:286
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:61
bool ShowWindow
Definition: vtkWindow.h:284
char * WindowName
Definition: vtkWindow.h:280
virtual void SetParentInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:66
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkWindow.h:188
virtual void * GetGenericContext()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:63
virtual void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition: vtkWindow.h:181
virtual void SetParentId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:59
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition: vtkWindow.h:271
virtual void MakeCurrent()
Make the window current.
Definition: vtkWindow.h:254
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:58
@ height
Definition: vtkX3D.h:254
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_INT_MAX
Definition: vtkType.h:144
#define VTK_SIZEHINT(...)