VTK
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  virtual void SetPosition(int, int);
64  virtual void SetPosition(int a[2]);
66 
68 
71  virtual int* GetSize() VTK_SIZEHINT(2);
72  virtual void SetSize(int, int);
73  virtual void SetSize(int a[2]);
75 
80  int* GetActualSize() VTK_SIZEHINT(2);
81 
85  virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
86 
88 
91  vtkGetMacro(Mapped, vtkTypeBool);
93 
95 
98  vtkGetMacro(ShowWindow, bool);
99  vtkSetMacro(ShowWindow, bool);
100  vtkBooleanMacro(ShowWindow, bool);
102 
104 
109  vtkSetMacro(UseOffScreenBuffers, bool);
110  vtkGetMacro(UseOffScreenBuffers, bool);
111  vtkBooleanMacro(UseOffScreenBuffers, bool);
113 
115 
121  vtkSetMacro(Erase, vtkTypeBool);
122  vtkGetMacro(Erase, vtkTypeBool);
123  vtkBooleanMacro(Erase, vtkTypeBool);
125 
127 
130  vtkSetMacro(DoubleBuffer, vtkTypeBool);
131  vtkGetMacro(DoubleBuffer, vtkTypeBool);
132  vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
134 
136 
139  vtkGetStringMacro(WindowName);
140  vtkSetStringMacro(WindowName);
142 
147  virtual void Render() {}
148 
155 
157 
169  virtual unsigned char* GetPixelData(
170  int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
171  {
172  return nullptr;
173  }
174  virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
175  vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
176  {
177  return 0;
178  }
180 
182 
186  vtkGetMacro(DPI, int);
187  vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
189 
196  virtual bool DetectDPI() { return false; }
197 
199 
203  {
204  this->SetShowWindow(val == 0);
205  this->SetUseOffScreenBuffers(val != 0);
206  }
207  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
209 
214  vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
215 
220  virtual void MakeCurrent() {}
221 
223 
229  vtkSetVector2Macro(TileScale, int);
230  vtkGetVector2Macro(TileScale, int);
231  void SetTileScale(int s) { this->SetTileScale(s, s); }
232  vtkSetVector4Macro(TileViewport, double);
233  vtkGetVector4Macro(TileViewport, double);
235 
236 protected:
237  vtkWindow();
238  ~vtkWindow() override;
239 
240  char* WindowName;
241  int Size[2];
242  int Position[2];
248  int DPI;
249 
250  double TileViewport[4];
251  int TileSize[2];
252  int TileScale[2];
253 
254 private:
255  vtkWindow(const vtkWindow&) = delete;
256  void operator=(const vtkWindow&) = delete;
257 };
258 
259 #endif
vtkWindow::UseOffScreenBuffers
bool UseOffScreenBuffers
Definition: vtkWindow.h:245
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkWindow::GetGenericContext
virtual void * GetGenericContext()
Definition: vtkWindow.h:51
vtkWindow::GetGenericDisplayId
virtual void * GetGenericDisplayId()
Definition: vtkWindow.h:48
vtkWindow::SetWindowInfo
virtual void SetWindowInfo(const char *)
Definition: vtkWindow.h:53
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:35
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkWindow::SetTileScale
void SetTileScale(int s)
Definition: vtkWindow.h:231
vtkWindow::GetGenericDrawable
virtual void * GetGenericDrawable()
Definition: vtkWindow.h:52
vtkWindow::DetectDPI
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition: vtkWindow.h:196
vtkWindow::GetGenericParentId
virtual void * GetGenericParentId()
Definition: vtkWindow.h:50
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkWindow::SetParentInfo
virtual void SetParentInfo(const char *)
Definition: vtkWindow.h:54
vtkWindow::SetParentId
virtual void SetParentId(void *)
Definition: vtkWindow.h:47
vtkWindow::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkWindow.h:154
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkWindow::GetPixelData
virtual int GetPixelData(int, int, int, int, int, vtkUnsignedCharArray *, int=0)
Definition: vtkWindow.h:174
vtkWindow::SetOffScreenRendering
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition: vtkWindow.h:202
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkWindow::Mapped
vtkTypeBool Mapped
Definition: vtkWindow.h:243
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:45
vtkWindow::WindowName
char * WindowName
Definition: vtkWindow.h:240
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:147
vtkWindow::MakeCurrent
virtual void MakeCurrent()
Make the window current.
Definition: vtkWindow.h:220
vtkWindow::GetGenericWindowId
virtual void * GetGenericWindowId()
Definition: vtkWindow.h:49
vtkWindow::DPI
int DPI
Definition: vtkWindow.h:248
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:169
vtkWindow::SetWindowId
virtual void SetWindowId(void *)
Definition: vtkWindow.h:46
vtkWindow::Erase
vtkTypeBool Erase
Definition: vtkWindow.h:246
vtkWindow::GetOffScreenRendering
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition: vtkWindow.h:214
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkWindow::DoubleBuffer
vtkTypeBool DoubleBuffer
Definition: vtkWindow.h:247
vtkWindow::ShowWindow
bool ShowWindow
Definition: vtkWindow.h:244