VTK  9.2.20230401
vtkWindow.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkWindow.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm 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 =========================================================================*/
29 #ifndef vtkWindow_h
30 #define vtkWindow_h
31 
32 #include "vtkCommonCoreModule.h" // For export macro
33 #include "vtkObject.h"
34 
35 VTK_ABI_NAMESPACE_BEGIN
36 class vtkImageData;
38 
39 class VTKCOMMONCORE_EXPORT vtkWindow : public vtkObject
40 {
41 public:
42  vtkTypeMacro(vtkWindow, vtkObject);
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
50  virtual void SetDisplayId(void*) {}
51  virtual void SetWindowId(void*) {}
52  virtual void SetParentId(void*) {}
53  virtual void* GetGenericDisplayId() { return nullptr; }
54  virtual void* GetGenericWindowId() { return nullptr; }
55  virtual void* GetGenericParentId() { return nullptr; }
56  virtual void* GetGenericContext() { return nullptr; }
57  virtual void* GetGenericDrawable() { return nullptr; }
58  virtual void SetWindowInfo(const char*) {}
59  virtual void SetParentInfo(const char*) {}
61 
63 
67  virtual int* GetPosition() VTK_SIZEHINT(2);
68 
74  virtual void SetPosition(int x, int y);
75  virtual void SetPosition(int a[2]);
77 
79 
83  virtual int* GetSize() VTK_SIZEHINT(2);
84 
93  virtual void SetSize(int width, int height);
94  virtual void SetSize(int a[2]);
96 
101  int* GetActualSize() VTK_SIZEHINT(2);
102 
106  virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
107 
109 
112  vtkGetMacro(Mapped, vtkTypeBool);
114 
116 
119  vtkGetMacro(ShowWindow, bool);
120  vtkSetMacro(ShowWindow, bool);
121  vtkBooleanMacro(ShowWindow, bool);
123 
125 
130  vtkSetMacro(UseOffScreenBuffers, bool);
131  vtkGetMacro(UseOffScreenBuffers, bool);
132  vtkBooleanMacro(UseOffScreenBuffers, bool);
134 
136 
142  vtkSetMacro(Erase, vtkTypeBool);
143  vtkGetMacro(Erase, vtkTypeBool);
144  vtkBooleanMacro(Erase, vtkTypeBool);
146 
148 
151  vtkSetMacro(DoubleBuffer, vtkTypeBool);
152  vtkGetMacro(DoubleBuffer, vtkTypeBool);
153  vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
155 
157 
160  vtkGetStringMacro(WindowName);
161  vtkSetStringMacro(WindowName);
163 
168  virtual void SetIcon(vtkImageData*) {}
169 
174  virtual void Render() {}
175 
182 
184 
196  virtual unsigned char* GetPixelData(
197  int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
198  {
199  return nullptr;
200  }
201  virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
202  vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
203  {
204  return 0;
205  }
207 
209 
213  vtkGetMacro(DPI, int);
214  vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
216 
223  virtual bool DetectDPI() { return false; }
224 
226 
230  {
231  this->SetShowWindow(val == 0);
232  this->SetUseOffScreenBuffers(val != 0);
233  }
234  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
236 
241  vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
242 
247  virtual void MakeCurrent() {}
248 
253  virtual void ReleaseCurrent() {}
254 
256 
262  vtkSetVector2Macro(TileScale, int);
263  vtkGetVector2Macro(TileScale, int);
264  void SetTileScale(int s) { this->SetTileScale(s, s); }
265  vtkSetVector4Macro(TileViewport, double);
266  vtkGetVector4Macro(TileViewport, double);
268 
269 protected:
271  ~vtkWindow() override;
272 
273  char* WindowName;
274  int Size[2];
275  int Position[2];
281  int DPI;
282 
283  double TileViewport[4];
284  int TileSize[2];
285  int TileScale[2];
286 
287 private:
288  vtkWindow(const vtkWindow&) = delete;
289  void operator=(const vtkWindow&) = delete;
290 };
291 
292 VTK_ABI_NAMESPACE_END
293 #endif
topologically and geometrically regular array of data
Definition: vtkImageData.h:164
a simple class to control print indentation
Definition: vtkIndent.h:120
abstract base class for most VTK objects
Definition: vtkObject.h:83
dynamic, self-adjusting array of unsigned char
window superclass for vtkRenderWindow
Definition: vtkWindow.h:40
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool UseOffScreenBuffers
Definition: vtkWindow.h:278
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition: vtkWindow.h:223
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition: vtkWindow.h:241
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:57
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition: vtkWindow.h:168
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:58
virtual void ReleaseCurrent()
Release the current context.
Definition: vtkWindow.h:253
vtkTypeBool DoubleBuffer
Definition: vtkWindow.h:280
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:55
~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:201
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:50
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition: vtkWindow.h:196
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition: vtkWindow.h:229
virtual void * GetGenericDisplayId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:53
vtkTypeBool Mapped
Definition: vtkWindow.h:276
virtual int * GetPosition()
Get the position (x and y) of the rendering window in screen coordinates (in pixels).
vtkTypeBool Erase
Definition: vtkWindow.h:279
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:54
bool ShowWindow
Definition: vtkWindow.h:277
char * WindowName
Definition: vtkWindow.h:273
virtual void SetParentInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:59
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkWindow.h:181
virtual void * GetGenericContext()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:56
virtual void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition: vtkWindow.h:174
virtual void SetParentId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:52
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition: vtkWindow.h:264
virtual void MakeCurrent()
Make the window current.
Definition: vtkWindow.h:247
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:51
@ height
Definition: vtkX3D.h:266
int vtkTypeBool
Definition: vtkABI.h:71
#define VTK_INT_MAX
Definition: vtkType.h:156
#define VTK_SIZEHINT(...)