VTK  9.0.20201027
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 class vtkImageData;
37 
38 class VTKCOMMONCORE_EXPORT vtkWindow : public vtkObject
39 {
40 public:
41  vtkTypeMacro(vtkWindow, vtkObject);
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
45 
49  virtual void SetDisplayId(void*) {}
50  virtual void SetWindowId(void*) {}
51  virtual void SetParentId(void*) {}
52  virtual void* GetGenericDisplayId() { return nullptr; }
53  virtual void* GetGenericWindowId() { return nullptr; }
54  virtual void* GetGenericParentId() { return nullptr; }
55  virtual void* GetGenericContext() { return nullptr; }
56  virtual void* GetGenericDrawable() { return nullptr; }
57  virtual void SetWindowInfo(const char*) {}
58  virtual void SetParentInfo(const char*) {}
60 
62 
66  virtual int* GetPosition() VTK_SIZEHINT(2);
67 
73  virtual void SetPosition(int x, int y);
74  virtual void SetPosition(int a[2]);
76 
78 
82  virtual int* GetSize() VTK_SIZEHINT(2);
83 
92  virtual void SetSize(int width, int height);
93  virtual void SetSize(int a[2]);
95 
100  int* GetActualSize() VTK_SIZEHINT(2);
101 
105  virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
106 
108 
111  vtkGetMacro(Mapped, vtkTypeBool);
113 
115 
118  vtkGetMacro(ShowWindow, bool);
119  vtkSetMacro(ShowWindow, bool);
120  vtkBooleanMacro(ShowWindow, bool);
122 
124 
129  vtkSetMacro(UseOffScreenBuffers, bool);
130  vtkGetMacro(UseOffScreenBuffers, bool);
131  vtkBooleanMacro(UseOffScreenBuffers, bool);
133 
135 
141  vtkSetMacro(Erase, vtkTypeBool);
142  vtkGetMacro(Erase, vtkTypeBool);
143  vtkBooleanMacro(Erase, vtkTypeBool);
145 
147 
150  vtkSetMacro(DoubleBuffer, vtkTypeBool);
151  vtkGetMacro(DoubleBuffer, vtkTypeBool);
152  vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
154 
156 
159  vtkGetStringMacro(WindowName);
160  vtkSetStringMacro(WindowName);
162 
167  virtual void SetIcon(vtkImageData*) {}
168 
173  virtual void Render() {}
174 
181 
183 
195  virtual unsigned char* GetPixelData(
196  int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
197  {
198  return nullptr;
199  }
200  virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
201  vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
202  {
203  return 0;
204  }
206 
208 
212  vtkGetMacro(DPI, int);
213  vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
215 
222  virtual bool DetectDPI() { return false; }
223 
225 
229  {
230  this->SetShowWindow(val == 0);
231  this->SetUseOffScreenBuffers(val != 0);
232  }
233  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
235 
240  vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
241 
246  virtual void MakeCurrent() {}
247 
249 
255  vtkSetVector2Macro(TileScale, int);
256  vtkGetVector2Macro(TileScale, int);
257  void SetTileScale(int s) { this->SetTileScale(s, s); }
258  vtkSetVector4Macro(TileViewport, double);
259  vtkGetVector4Macro(TileViewport, double);
261 
262 protected:
263  vtkWindow();
264  ~vtkWindow() override;
265 
266  char* WindowName;
267  int Size[2];
268  int Position[2];
274  int DPI;
275 
276  double TileViewport[4];
277  int TileSize[2];
278  int TileScale[2];
279 
280 private:
281  vtkWindow(const vtkWindow&) = delete;
282  void operator=(const vtkWindow&) = delete;
283 };
284 
285 #endif
vtkWindow::UseOffScreenBuffers
bool UseOffScreenBuffers
Definition: vtkWindow.h:271
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:147
vtkWindow::GetGenericContext
virtual void * GetGenericContext()
Definition: vtkWindow.h:55
vtkWindow::GetGenericDisplayId
virtual void * GetGenericDisplayId()
Definition: vtkWindow.h:52
vtkWindow::SetWindowInfo
virtual void SetWindowInfo(const char *)
Definition: vtkWindow.h:57
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:35
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkWindow::SetTileScale
void SetTileScale(int s)
Definition: vtkWindow.h:257
vtkWindow::GetGenericDrawable
virtual void * GetGenericDrawable()
Definition: vtkWindow.h:56
vtkWindow::SetIcon
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition: vtkWindow.h:167
vtkWindow::DetectDPI
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition: vtkWindow.h:222
vtkWindow::GetGenericParentId
virtual void * GetGenericParentId()
Definition: vtkWindow.h:54
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkWindow::SetParentInfo
virtual void SetParentInfo(const char *)
Definition: vtkWindow.h:58
vtkWindow::SetParentId
virtual void SetParentId(void *)
Definition: vtkWindow.h:51
vtkWindow::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkWindow.h:180
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkX3D::height
Definition: vtkX3D.h:260
vtkWindow::GetPixelData
virtual int GetPixelData(int, int, int, int, int, vtkUnsignedCharArray *, int=0)
Definition: vtkWindow.h:200
vtkWindow::SetOffScreenRendering
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition: vtkWindow.h:228
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:47
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkWindow::Mapped
vtkTypeBool Mapped
Definition: vtkWindow.h:269
vtkWindow::SetDisplayId
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:49
vtkWindow::WindowName
char * WindowName
Definition: vtkWindow.h:266
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkObject.h
vtkWindow::Render
virtual void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition: vtkWindow.h:173
vtkParticleTracerBaseNamespace::Position
struct Position_t Position
Definition: vtkParticleTracerBase.h:63
vtkWindow::MakeCurrent
virtual void MakeCurrent()
Make the window current.
Definition: vtkWindow.h:246
vtkWindow::GetGenericWindowId
virtual void * GetGenericWindowId()
Definition: vtkWindow.h:53
vtkWindow::DPI
int DPI
Definition: vtkWindow.h:274
vtkWindow::GetPixelData
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition: vtkWindow.h:195
vtkWindow::SetWindowId
virtual void SetWindowId(void *)
Definition: vtkWindow.h:50
vtkWindow::Erase
vtkTypeBool Erase
Definition: vtkWindow.h:272
vtkWindow::GetOffScreenRendering
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition: vtkWindow.h:240
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkWindow::DoubleBuffer
vtkTypeBool DoubleBuffer
Definition: vtkWindow.h:273
vtkWindow::ShowWindow
bool ShowWindow
Definition: vtkWindow.h:270