VTK  9.6.20260220
vtkWindow.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
35
36#ifndef vtkWindow_h
37#define vtkWindow_h
38
39#include "vtkCommonCoreModule.h" // For export macro
40#include "vtkObject.h"
41#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
42
43VTK_ABI_NAMESPACE_BEGIN
44class vtkImageData;
46
47#define VTK_CURSOR_DEFAULT 0
48#define VTK_CURSOR_ARROW 1
49#define VTK_CURSOR_SIZENE 2
50#define VTK_CURSOR_SIZENW 3
51#define VTK_CURSOR_SIZESW 4
52#define VTK_CURSOR_SIZESE 5
53#define VTK_CURSOR_SIZENS 6
54#define VTK_CURSOR_SIZEWE 7
55#define VTK_CURSOR_SIZEALL 8
56#define VTK_CURSOR_HAND 9
57#define VTK_CURSOR_CROSSHAIR 10
58#define VTK_CURSOR_CUSTOM 11
59
60class VTKCOMMONCORE_EXPORT VTK_MARSHALAUTO vtkWindow : public vtkObject
61{
62public:
63 vtkTypeMacro(vtkWindow, vtkObject);
64 void PrintSelf(ostream& os, vtkIndent indent) override;
65
67
71 virtual void SetDisplayId(void*) {}
72 virtual void SetWindowId(void*) {}
73 virtual void SetParentId(void*) {}
74 virtual void* GetGenericDisplayId() { return nullptr; }
75 virtual void* GetGenericWindowId() { return nullptr; }
76 virtual void* GetGenericParentId() { return nullptr; }
77 virtual void* GetGenericContext() { return nullptr; }
78 virtual void* GetGenericDrawable() { return nullptr; }
79 virtual void SetWindowInfo(const char*) {}
80 virtual void SetParentInfo(const char*) {}
81 virtual bool EnsureDisplay() { return true; }
82
84
86
90 virtual int* GetPosition() VTK_SIZEHINT(2);
91
97 virtual void SetPosition(int x, int y);
98 virtual void SetPosition(int a[2]);
100
102
106 virtual int* GetSize() VTK_SIZEHINT(2);
107
116 virtual void SetSize(int width, int height);
117 virtual void SetSize(int a[2]);
119
125
129 virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
130
132
135 vtkGetMacro(Mapped, vtkTypeBool);
137
139
142 vtkGetMacro(ShowWindow, bool);
143 vtkSetMacro(ShowWindow, bool);
144 vtkBooleanMacro(ShowWindow, bool);
146
148
153 vtkSetMacro(UseOffScreenBuffers, bool);
154 vtkGetMacro(UseOffScreenBuffers, bool);
155 vtkBooleanMacro(UseOffScreenBuffers, bool);
157
159
165 vtkSetMacro(Erase, vtkTypeBool);
166 vtkGetMacro(Erase, vtkTypeBool);
167 vtkBooleanMacro(Erase, vtkTypeBool);
169
171
176 vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
178
180
183 vtkGetStringMacro(WindowName);
184 vtkSetStringMacro(WindowName);
186
191 virtual void SetIcon(vtkImageData*) {}
192
198 virtual void Render() {}
199
206
208
220 virtual unsigned char* GetPixelData(
221 int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
222 {
223 return nullptr;
224 }
225 virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
226 vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
227 {
228 return 0;
229 }
230
231
233
238 vtkGetMacro(DPI, int);
239 vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
241
248 virtual bool DetectDPI() { return false; }
249
251
256 {
257 this->SetShowWindow(val == 0);
258 this->SetUseOffScreenBuffers(val != 0);
259 }
260 vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
262
268 vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
269
274 virtual void MakeCurrent() {}
275
280 virtual void ReleaseCurrent() {}
281
283
289 vtkSetVector2Macro(TileScale, int);
290 vtkGetVector2Macro(TileScale, int);
291 void SetTileScale(int s) { this->SetTileScale(s, s); }
292 vtkSetVector4Macro(TileViewport, double);
293 vtkGetVector4Macro(TileViewport, double);
295
297
302 vtkSetMacro(Borders, vtkTypeBool);
303 vtkGetMacro(Borders, vtkTypeBool);
304 vtkBooleanMacro(Borders, vtkTypeBool);
306
308
314 virtual void HideCursor() {}
315 virtual void ShowCursor() {}
316 virtual void SetCursorPosition(int, int) {}
318
320
323 vtkSetMacro(CurrentCursor, int);
324 vtkGetMacro(CurrentCursor, int);
326
328
335
336protected:
338 ~vtkWindow() override;
339
341 int Size[2];
342 int Position[2];
348 int DPI;
351 char* CursorFileName = nullptr;
352
353 double TileViewport[4];
354 int TileSize[2];
355 int TileScale[2];
356
357private:
358 vtkWindow(const vtkWindow&) = delete;
359 void operator=(const vtkWindow&) = delete;
360};
361
362VTK_ABI_NAMESPACE_END
363#endif
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:108
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:129
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:78
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition vtkWindow.h:220
bool UseOffScreenBuffers
Definition vtkWindow.h:345
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition vtkWindow.h:248
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition vtkWindow.h:268
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition vtkWindow.h:191
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:75
virtual bool EnsureDisplay()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:81
vtkTypeBool Borders
Definition vtkWindow.h:349
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:79
virtual void SetUseOffScreenBuffers(bool)
Render to an offscreen destination such as a framebuffer.
virtual void ReleaseCurrent()
Release the current context.
Definition vtkWindow.h:280
vtkGetFilePathMacro(CursorFileName)
Set/Get the full path to the custom cursor.
virtual void * GetGenericContext()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:77
vtkTypeBool DoubleBuffer
Definition vtkWindow.h:347
int * GetActualSize()
GetSize() returns the size * this->TileScale, whereas this method returns the size without multiplyin...
int TileSize[2]
Definition vtkWindow.h:354
~vtkWindow() override
int Position[2]
Definition vtkWindow.h:342
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:76
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:225
double TileViewport[4]
Definition vtkWindow.h:353
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:74
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:71
virtual void HideCursor()
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
Definition vtkWindow.h:314
int CurrentCursor
Definition vtkWindow.h:350
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition vtkWindow.h:255
virtual void ShowCursor()
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
Definition vtkWindow.h:315
vtkTypeBool Mapped
Definition vtkWindow.h:343
int Size[2]
Definition vtkWindow.h:341
vtkSetFilePathMacro(CursorFileName)
Set/Get the full path to the custom cursor.
char * CursorFileName
Definition vtkWindow.h:351
vtkTypeBool Erase
Definition vtkWindow.h:346
bool ShowWindow
Definition vtkWindow.h:344
char * WindowName
Definition vtkWindow.h:340
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:80
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition vtkWindow.h:205
virtual void SetCursorPosition(int, int)
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
Definition vtkWindow.h:316
int TileScale[2]
Definition vtkWindow.h:355
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:198
virtual void SetParentId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:73
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition vtkWindow.h:291
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:274
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:72
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_INT_MAX
Definition vtkType.h:192
#define VTK_CURSOR_DEFAULT
Definition vtkWindow.h:47
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_UNBLOCKTHREADS
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)