VTK  9.2.6
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=========================================================================*/
28
29#ifndef vtkWindow_h
30#define vtkWindow_h
31
32#include "vtkCommonCoreModule.h" // For export macro
33#include "vtkObject.h"
34
35class vtkImageData;
37
38class VTKCOMMONCORE_EXPORT vtkWindow : public vtkObject
39{
40public:
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
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
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 }
205
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
252 virtual void ReleaseCurrent() {}
253
255
261 vtkSetVector2Macro(TileScale, int);
262 vtkGetVector2Macro(TileScale, int);
263 void SetTileScale(int s) { this->SetTileScale(s, s); }
264 vtkSetVector4Macro(TileViewport, double);
265 vtkGetVector4Macro(TileViewport, double);
267
268protected:
270 ~vtkWindow() override;
271
273 int Size[2];
274 int Position[2];
280 int DPI;
281
282 double TileViewport[4];
283 int TileSize[2];
284 int TileScale[2];
285
286private:
287 vtkWindow(const vtkWindow&) = delete;
288 void operator=(const vtkWindow&) = delete;
289};
290
291#endif
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:40
dynamic, self-adjusting array of unsigned char
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual bool GetShowWindow()
Show or not Show the window.
virtual int * GetScreenSize()
Get the current size of the screen in pixels.
Definition vtkWindow.h:105
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:56
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
bool UseOffScreenBuffers
Definition vtkWindow.h:277
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition vtkWindow.h:222
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition vtkWindow.h:240
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition vtkWindow.h:167
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:53
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:57
virtual void SetUseOffScreenBuffers(bool)
Render to an offscreen destination such as a framebuffer.
virtual void ReleaseCurrent()
Release the current context.
Definition vtkWindow.h:252
virtual void * GetGenericContext()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:55
vtkTypeBool DoubleBuffer
Definition vtkWindow.h:279
int * GetActualSize()
GetSize() returns the size * this->TileScale, whereas this method returns the size without multiplyin...
int TileSize[2]
Definition vtkWindow.h:283
~vtkWindow() override
int Position[2]
Definition vtkWindow.h:274
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:54
virtual void SetPosition(int x, int y)
Set the position (x and y) of the rendering window in screen coordinates (in pixels).
virtual int GetPixelData(int, int, int, int, int, vtkUnsignedCharArray *, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition vtkWindow.h:200
double TileViewport[4]
Definition vtkWindow.h:282
virtual void SetShowWindow(bool)
Show or not Show the window.
virtual void * GetGenericDisplayId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:52
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:49
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition vtkWindow.h:228
vtkTypeBool Mapped
Definition vtkWindow.h:275
int Size[2]
Definition vtkWindow.h:273
vtkTypeBool Erase
Definition vtkWindow.h:278
bool ShowWindow
Definition vtkWindow.h:276
char * WindowName
Definition vtkWindow.h:272
virtual int * GetPosition()
Get the position (x and y) of the rendering window in screen coordinates (in pixels).
virtual void SetParentInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:58
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition vtkWindow.h:180
int TileScale[2]
Definition vtkWindow.h:284
virtual int * GetSize()
Get the size (width and height) of the rendering window in screen coordinates (in pixels).
virtual void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition vtkWindow.h:173
virtual void SetParentId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:51
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition vtkWindow.h:263
virtual void SetSize(int width, int height)
Set the size (width and height) of the rendering window in screen coordinates (in pixels).
virtual void MakeCurrent()
Make the window current.
Definition vtkWindow.h:246
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:50
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_INT_MAX
Definition vtkType.h:155
#define VTK_SIZEHINT(...)