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
17 #ifndef vtkWindow_h
18 #define vtkWindow_h
19 
20 #include "vtkCommonCoreModule.h" // For export macro
21 #include "vtkObject.h"
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 class vtkImageData;
26 
27 class VTKCOMMONCORE_EXPORT vtkWindow : public vtkObject
28 {
29 public:
30  vtkTypeMacro(vtkWindow, vtkObject);
31  void PrintSelf(ostream& os, vtkIndent indent) override;
32 
34 
38  virtual void SetDisplayId(void*) {}
39  virtual void SetWindowId(void*) {}
40  virtual void SetParentId(void*) {}
41  virtual void* GetGenericDisplayId() { return nullptr; }
42  virtual void* GetGenericWindowId() { return nullptr; }
43  virtual void* GetGenericParentId() { return nullptr; }
44  virtual void* GetGenericContext() { return nullptr; }
45  virtual void* GetGenericDrawable() { return nullptr; }
46  virtual void SetWindowInfo(const char*) {}
47  virtual void SetParentInfo(const char*) {}
49 
51 
55  virtual int* GetPosition() VTK_SIZEHINT(2);
56 
62  virtual void SetPosition(int x, int y);
63  virtual void SetPosition(int a[2]);
65 
67 
71  virtual int* GetSize() VTK_SIZEHINT(2);
72 
81  virtual void SetSize(int width, int height);
82  virtual void SetSize(int a[2]);
84 
89  int* GetActualSize() VTK_SIZEHINT(2);
90 
94  virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
95 
97 
100  vtkGetMacro(Mapped, vtkTypeBool);
102 
104 
107  vtkGetMacro(ShowWindow, bool);
108  vtkSetMacro(ShowWindow, bool);
109  vtkBooleanMacro(ShowWindow, bool);
111 
113 
118  vtkSetMacro(UseOffScreenBuffers, bool);
119  vtkGetMacro(UseOffScreenBuffers, bool);
120  vtkBooleanMacro(UseOffScreenBuffers, bool);
122 
124 
130  vtkSetMacro(Erase, vtkTypeBool);
131  vtkGetMacro(Erase, vtkTypeBool);
132  vtkBooleanMacro(Erase, vtkTypeBool);
134 
136 
139  vtkSetMacro(DoubleBuffer, vtkTypeBool);
140  vtkGetMacro(DoubleBuffer, vtkTypeBool);
141  vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
143 
145 
148  vtkGetStringMacro(WindowName);
149  vtkSetStringMacro(WindowName);
151 
156  virtual void SetIcon(vtkImageData*) {}
157 
162  virtual void Render() {}
163 
170 
172 
184  virtual unsigned char* GetPixelData(
185  int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
186  {
187  return nullptr;
188  }
189  virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
190  vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
191  {
192  return 0;
193  }
195 
197 
201  vtkGetMacro(DPI, int);
202  vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
204 
211  virtual bool DetectDPI() { return false; }
212 
214 
218  {
219  this->SetShowWindow(val == 0);
220  this->SetUseOffScreenBuffers(val != 0);
221  }
222  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
224 
229  vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
230 
235  virtual void MakeCurrent() {}
236 
241  virtual void ReleaseCurrent() {}
242 
244 
250  vtkSetVector2Macro(TileScale, int);
251  vtkGetVector2Macro(TileScale, int);
252  void SetTileScale(int s) { this->SetTileScale(s, s); }
253  vtkSetVector4Macro(TileViewport, double);
254  vtkGetVector4Macro(TileViewport, double);
256 
257 protected:
259  ~vtkWindow() override;
260 
261  char* WindowName;
262  int Size[2];
263  int Position[2];
269  int DPI;
270 
271  double TileViewport[4];
272  int TileSize[2];
273  int TileScale[2];
274 
275 private:
276  vtkWindow(const vtkWindow&) = delete;
277  void operator=(const vtkWindow&) = delete;
278 };
279 
280 VTK_ABI_NAMESPACE_END
281 #endif
topologically and geometrically regular array of data
Definition: vtkImageData.h:43
a simple class to control print indentation
Definition: vtkIndent.h:29
abstract base class for most VTK objects
Definition: vtkObject.h:52
dynamic, self-adjusting array of unsigned char
window superclass for vtkRenderWindow
Definition: vtkWindow.h:28
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool UseOffScreenBuffers
Definition: vtkWindow.h:266
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition: vtkWindow.h:211
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition: vtkWindow.h:229
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:45
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition: vtkWindow.h:156
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:46
virtual void ReleaseCurrent()
Release the current context.
Definition: vtkWindow.h:241
vtkTypeBool DoubleBuffer
Definition: vtkWindow.h:268
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:43
~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:189
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:38
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition: vtkWindow.h:184
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition: vtkWindow.h:217
virtual void * GetGenericDisplayId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:41
vtkTypeBool Mapped
Definition: vtkWindow.h:264
virtual int * GetPosition()
Get the position (x and y) of the rendering window in screen coordinates (in pixels).
vtkTypeBool Erase
Definition: vtkWindow.h:267
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:42
bool ShowWindow
Definition: vtkWindow.h:265
char * WindowName
Definition: vtkWindow.h:261
virtual void SetParentInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:47
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkWindow.h:169
virtual void * GetGenericContext()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:44
virtual void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition: vtkWindow.h:162
virtual void SetParentId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:40
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition: vtkWindow.h:252
virtual void MakeCurrent()
Make the window current.
Definition: vtkWindow.h:235
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:39
@ height
Definition: vtkX3D.h:254
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_INT_MAX
Definition: vtkType.h:144
#define VTK_SIZEHINT(...)