VTK  9.0.3
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 
36 
37 class VTKCOMMONCORE_EXPORT vtkWindow : public vtkObject
38 {
39 public:
40  vtkTypeMacro(vtkWindow, vtkObject);
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
44 
48  virtual void SetDisplayId(void*) {}
49  virtual void SetWindowId(void*) {}
50  virtual void SetParentId(void*) {}
51  virtual void* GetGenericDisplayId() { return nullptr; }
52  virtual void* GetGenericWindowId() { return nullptr; }
53  virtual void* GetGenericParentId() { return nullptr; }
54  virtual void* GetGenericContext() { return nullptr; }
55  virtual void* GetGenericDrawable() { return nullptr; }
56  virtual void SetWindowInfo(const char*) {}
57  virtual void SetParentInfo(const char*) {}
59 
61 
65  virtual int* GetPosition() VTK_SIZEHINT(2);
66 
72  virtual void SetPosition(int x, int y);
73  virtual void SetPosition(int a[2]);
75 
77 
81  virtual int* GetSize() VTK_SIZEHINT(2);
82 
91  virtual void SetSize(int width, int height);
92  virtual void SetSize(int a[2]);
94 
99  int* GetActualSize() VTK_SIZEHINT(2);
100 
104  virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
105 
107 
110  vtkGetMacro(Mapped, vtkTypeBool);
112 
114 
117  vtkGetMacro(ShowWindow, bool);
118  vtkSetMacro(ShowWindow, bool);
119  vtkBooleanMacro(ShowWindow, bool);
121 
123 
128  vtkSetMacro(UseOffScreenBuffers, bool);
129  vtkGetMacro(UseOffScreenBuffers, bool);
130  vtkBooleanMacro(UseOffScreenBuffers, bool);
132 
134 
140  vtkSetMacro(Erase, vtkTypeBool);
141  vtkGetMacro(Erase, vtkTypeBool);
142  vtkBooleanMacro(Erase, vtkTypeBool);
144 
146 
149  vtkSetMacro(DoubleBuffer, vtkTypeBool);
150  vtkGetMacro(DoubleBuffer, vtkTypeBool);
151  vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
153 
155 
158  vtkGetStringMacro(WindowName);
159  vtkSetStringMacro(WindowName);
161 
166  virtual void Render() {}
167 
174 
176 
188  virtual unsigned char* GetPixelData(
189  int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
190  {
191  return nullptr;
192  }
193  virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
194  vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
195  {
196  return 0;
197  }
199 
201 
205  vtkGetMacro(DPI, int);
206  vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
208 
215  virtual bool DetectDPI() { return false; }
216 
218 
222  {
223  this->SetShowWindow(val == 0);
224  this->SetUseOffScreenBuffers(val != 0);
225  }
226  vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
228 
233  vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
234 
239  virtual void MakeCurrent() {}
240 
242 
248  vtkSetVector2Macro(TileScale, int);
249  vtkGetVector2Macro(TileScale, int);
250  void SetTileScale(int s) { this->SetTileScale(s, s); }
251  vtkSetVector4Macro(TileViewport, double);
252  vtkGetVector4Macro(TileViewport, double);
254 
255 protected:
257  ~vtkWindow() override;
258 
259  char* WindowName;
260  int Size[2];
261  int Position[2];
267  int DPI;
268 
269  double TileViewport[4];
270  int TileSize[2];
271  int TileScale[2];
272 
273 private:
274  vtkWindow(const vtkWindow&) = delete;
275  void operator=(const vtkWindow&) = delete;
276 };
277 
278 #endif
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:63
dynamic, self-adjusting array of unsigned char
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool UseOffScreenBuffers
Definition: vtkWindow.h:264
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition: vtkWindow.h:215
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition: vtkWindow.h:233
virtual void * GetGenericDrawable()
Definition: vtkWindow.h:55
virtual void SetWindowInfo(const char *)
Definition: vtkWindow.h:56
vtkTypeBool DoubleBuffer
Definition: vtkWindow.h:266
virtual void * GetGenericParentId()
Definition: vtkWindow.h:53
~vtkWindow() override
virtual int GetPixelData(int, int, int, int, int, vtkUnsignedCharArray *, int=0)
Definition: vtkWindow.h:193
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition: vtkWindow.h:48
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition: vtkWindow.h:188
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition: vtkWindow.h:221
virtual void * GetGenericDisplayId()
Definition: vtkWindow.h:51
vtkTypeBool Mapped
Definition: vtkWindow.h:262
virtual int * GetPosition()
Get the position (x and y) of the rendering window in screen coordinates (in pixels).
vtkTypeBool Erase
Definition: vtkWindow.h:265
virtual void * GetGenericWindowId()
Definition: vtkWindow.h:52
bool ShowWindow
Definition: vtkWindow.h:263
char * WindowName
Definition: vtkWindow.h:259
virtual void SetParentInfo(const char *)
Definition: vtkWindow.h:57
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkWindow.h:173
virtual void * GetGenericContext()
Definition: vtkWindow.h:54
virtual void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition: vtkWindow.h:166
virtual void SetParentId(void *)
Definition: vtkWindow.h:50
void SetTileScale(int s)
Definition: vtkWindow.h:250
virtual void MakeCurrent()
Make the window current.
Definition: vtkWindow.h:239
virtual void SetWindowId(void *)
Definition: vtkWindow.h:49
@ height
Definition: vtkX3D.h:260
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_SIZEHINT(...)