VTK  9.0.1
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 =========================================================================*/
26 #ifndef vtkWindow_h
27 #define vtkWindow_h
28 
29 #include "vtkCommonCoreModule.h" // For export macro
30 #include "vtkObject.h"
31 
33 
34 class VTKCOMMONCORE_EXPORT vtkWindow : public vtkObject
35 {
36 public:
37  vtkTypeMacro(vtkWindow, vtkObject);
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
41 
45  virtual void SetDisplayId(void*) {}
46  virtual void SetWindowId(void*) {}
47  virtual void SetParentId(void*) {}
48  virtual void* GetGenericDisplayId() { return nullptr; }
49  virtual void* GetGenericWindowId() { return nullptr; }
50  virtual void* GetGenericParentId() { return nullptr; }
51  virtual void* GetGenericContext() { return nullptr; }
52  virtual void* GetGenericDrawable() { return nullptr; }
53  virtual void SetWindowInfo(const char*) {}
54  virtual void SetParentInfo(const char*) {}
56 
58 
62  virtual int* GetPosition() VTK_SIZEHINT(2);
63 
69  virtual void SetPosition(int x, int y);
70  virtual void SetPosition(int a[2]);
72 
74 
78  virtual int* GetSize() VTK_SIZEHINT(2);
79 
88  virtual void SetSize(int width, int height);
89  virtual void SetSize(int a[2]);
91 
96  int* GetActualSize() VTK_SIZEHINT(2);
97 
101  virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
102 
104 
107  vtkGetMacro(Mapped, vtkTypeBool);
109 
111 
114  vtkGetMacro(ShowWindow, bool);
115  vtkSetMacro(ShowWindow, bool);
116  vtkBooleanMacro(ShowWindow, bool);
118 
120 
125  vtkSetMacro(UseOffScreenBuffers, bool);
126  vtkGetMacro(UseOffScreenBuffers, bool);
127  vtkBooleanMacro(UseOffScreenBuffers, bool);
129 
131 
137  vtkSetMacro(Erase, vtkTypeBool);
138  vtkGetMacro(Erase, vtkTypeBool);
139  vtkBooleanMacro(Erase, vtkTypeBool);
141 
143 
146  vtkSetMacro(DoubleBuffer, vtkTypeBool);
147  vtkGetMacro(DoubleBuffer, vtkTypeBool);
148  vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
150 
152 
155  vtkGetStringMacro(WindowName);
156  vtkSetStringMacro(WindowName);
158 
163  virtual void Render() {}
164 
171 
173 
185  virtual unsigned char* GetPixelData(
186  int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
187  {
188  return nullptr;
189  }
190  virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
191  vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
192  {
193  return 0;
194  }
196 
198 
202  vtkGetMacro(DPI, int);
203  vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
205 
212  virtual bool DetectDPI() { return false; }
213 
215 
219  {
220  this->SetShowWindow(val == 0);
221  this->SetUseOffScreenBuffers(val != 0);
222  }
223  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
225 
230  vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
231 
236  virtual void MakeCurrent() {}
237 
239 
245  vtkSetVector2Macro(TileScale, int);
246  vtkGetVector2Macro(TileScale, int);
247  void SetTileScale(int s) { this->SetTileScale(s, s); }
248  vtkSetVector4Macro(TileViewport, double);
249  vtkGetVector4Macro(TileViewport, double);
251 
252 protected:
254  ~vtkWindow() override;
255 
256  char* WindowName;
257  int Size[2];
258  int Position[2];
264  int DPI;
265 
266  double TileViewport[4];
267  int TileSize[2];
268  int TileScale[2];
269 
270 private:
271  vtkWindow(const vtkWindow&) = delete;
272  void operator=(const vtkWindow&) = delete;
273 };
274 
275 #endif
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:54
dynamic, self-adjusting array of unsigned char
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool UseOffScreenBuffers
Definition: vtkWindow.h:261
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition: vtkWindow.h:212
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition: vtkWindow.h:230
virtual void * GetGenericDrawable()
Definition: vtkWindow.h:52
virtual void SetWindowInfo(const char *)
Definition: vtkWindow.h:53
vtkTypeBool DoubleBuffer
Definition: vtkWindow.h:263
virtual void * GetGenericParentId()
Definition: vtkWindow.h:50
~vtkWindow() override
virtual int GetPixelData(int, int, int, int, int, vtkUnsignedCharArray *, int=0)
Definition: vtkWindow.h:190
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:45
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition: vtkWindow.h:185
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition: vtkWindow.h:218
virtual void * GetGenericDisplayId()
Definition: vtkWindow.h:48
vtkTypeBool Mapped
Definition: vtkWindow.h:259
virtual int * GetPosition()
Get the position (x and y) of the rendering window in screen coordinates (in pixels).
vtkTypeBool Erase
Definition: vtkWindow.h:262
virtual void * GetGenericWindowId()
Definition: vtkWindow.h:49
bool ShowWindow
Definition: vtkWindow.h:260
char * WindowName
Definition: vtkWindow.h:256
virtual void SetParentInfo(const char *)
Definition: vtkWindow.h:54
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkWindow.h:170
virtual void * GetGenericContext()
Definition: vtkWindow.h:51
virtual void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition: vtkWindow.h:163
virtual void SetParentId(void *)
Definition: vtkWindow.h:47
void SetTileScale(int s)
Definition: vtkWindow.h:247
virtual void MakeCurrent()
Make the window current.
Definition: vtkWindow.h:236
virtual void SetWindowId(void *)
Definition: vtkWindow.h:46
@ height
Definition: vtkX3D.h:260
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_SIZEHINT(...)