VTK  9.7.20261204
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 "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_8_0
41#include "vtkObject.h"
42#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
43
44VTK_ABI_NAMESPACE_BEGIN
45class vtkImageData;
47
48#define VTK_CURSOR_DEFAULT 0
49#define VTK_CURSOR_ARROW 1
50#define VTK_CURSOR_SIZENE 2
51#define VTK_CURSOR_SIZENW 3
52#define VTK_CURSOR_SIZESW 4
53#define VTK_CURSOR_SIZESE 5
54#define VTK_CURSOR_SIZENS 6
55#define VTK_CURSOR_SIZEWE 7
56#define VTK_CURSOR_SIZEALL 8
57#define VTK_CURSOR_HAND 9
58#define VTK_CURSOR_CROSSHAIR 10
59#define VTK_CURSOR_CUSTOM 11
60#define VTK_CURSOR_IBEAM 12
61#define VTK_CURSOR_WAIT 13
62#define VTK_CURSOR_PROGRESS 14
63#define VTK_CURSOR_NOTALLOWED 15
64
65class VTKCOMMONCORE_EXPORT VTK_MARSHALAUTO vtkWindow : public vtkObject
66{
67public:
68 vtkTypeMacro(vtkWindow, vtkObject);
69 void PrintSelf(ostream& os, vtkIndent indent) override;
70
72
76 virtual void SetDisplayId(void*) {}
77 virtual void SetWindowId(void*) {}
78 virtual void SetParentId(void*) {}
79 virtual void* GetGenericDisplayId() { return nullptr; }
80 virtual void* GetGenericWindowId() { return nullptr; }
81 virtual void* GetGenericParentId() { return nullptr; }
82 virtual void* GetGenericContext() { return nullptr; }
83 virtual void* GetGenericDrawable() { return nullptr; }
84 virtual void SetWindowInfo(const char*) {}
85 virtual void SetParentInfo(const char*) {}
86 virtual bool EnsureDisplay() { return true; }
87
89
91
95 virtual int* GetPosition() VTK_SIZEHINT(2);
96
102 virtual void SetPosition(int x, int y);
103 virtual void SetPosition(int a[2]);
105
107
111 virtual int* GetSize() VTK_SIZEHINT(2);
112
121 virtual void SetSize(int width, int height);
122 virtual void SetSize(int a[2]);
124
126
130 virtual int* GetMinimumSize() VTK_SIZEHINT(2);
131
137 virtual void SetMinimumSize(int width, int height);
138 virtual void SetMinimumSize(int size[2]);
140
146
150 virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
151
153
156 vtkGetMacro(Mapped, vtkTypeBool);
158
160
163 vtkGetMacro(ShowWindow, bool);
164 vtkSetMacro(ShowWindow, bool);
165 vtkBooleanMacro(ShowWindow, bool);
167
169
174 vtkSetMacro(UseOffScreenBuffers, bool);
175 vtkGetMacro(UseOffScreenBuffers, bool);
176 vtkBooleanMacro(UseOffScreenBuffers, bool);
178
180
186 vtkSetMacro(Erase, vtkTypeBool);
187 vtkGetMacro(Erase, vtkTypeBool);
188 vtkBooleanMacro(Erase, vtkTypeBool);
190
192
197 vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
199
201
204 vtkGetStringMacro(WindowName);
205 vtkSetStringMacro(WindowName);
207
212 virtual void SetIcon(vtkImageData*) {}
213
220 virtual void Render() {}
221
228
230
242 virtual unsigned char* GetPixelData(
243 int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
244 {
245 return nullptr;
246 }
248 virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
249 vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
250 {
251 return 0;
252 }
253
254
256
263 vtkGetMacro(DPI, int);
264 virtual void SetDPI(int dpi);
266
272 virtual bool DetectDPI() { return false; }
273
275
280 {
281 this->SetShowWindow(val == 0);
282 this->SetUseOffScreenBuffers(val != 0);
283 }
284 vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
286
292 VTK_DEPRECATED_IN_9_8_0("Use GetShowWindow instead")
293 vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
294
299 virtual void MakeCurrent() {}
300
305 virtual void ReleaseCurrent() {}
306
308
314 vtkSetVector2Macro(TileScale, int);
315 vtkGetVector2Macro(TileScale, int);
316 void SetTileScale(int s) { this->SetTileScale(s, s); }
317 vtkSetVector4Macro(TileViewport, double);
318 vtkGetVector4Macro(TileViewport, double);
320
322
327 vtkSetMacro(Borders, vtkTypeBool);
328 vtkGetMacro(Borders, vtkTypeBool);
329 vtkBooleanMacro(Borders, vtkTypeBool);
331
333
339 virtual void HideCursor() {}
340 virtual void ShowCursor() {}
341 virtual void SetCursorPosition(int, int) {}
343
345
348 vtkSetMacro(CurrentCursor, int);
349 vtkGetMacro(CurrentCursor, int);
351
353
360
361protected:
363 ~vtkWindow() override;
364
366 int Size[2];
367 int MinimumSize[2] = { 30, 30 };
368 int Position[2];
374 int DPI;
377 char* CursorFileName = nullptr;
378
379 double TileViewport[4];
380 int TileSize[2];
381 int TileScale[2];
382
383private:
384 vtkWindow(const vtkWindow&) = delete;
385 void operator=(const vtkWindow&) = delete;
386};
387
388VTK_ABI_NAMESPACE_END
389#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:150
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:83
virtual VTK_MAYSUSPEND void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition vtkWindow.h:220
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition vtkWindow.h:242
bool UseOffScreenBuffers
Definition vtkWindow.h:371
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition vtkWindow.h:272
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition vtkWindow.h:293
virtual void SetDPI(int dpi)
Return a best estimate to the dots per inch of the display device being rendered (or printed).
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition vtkWindow.h:212
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:80
virtual bool EnsureDisplay()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:86
vtkTypeBool Borders
Definition vtkWindow.h:375
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:84
virtual void SetUseOffScreenBuffers(bool)
Render to an offscreen destination such as a framebuffer.
virtual void ReleaseCurrent()
Release the current context.
Definition vtkWindow.h:305
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:82
vtkTypeBool DoubleBuffer
Definition vtkWindow.h:373
int * GetActualSize()
GetSize() returns the size * this->TileScale, whereas this method returns the size without multiplyin...
virtual VTK_MAYSUSPEND int GetPixelData(int, int, int, int, int, vtkUnsignedCharArray *, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition vtkWindow.h:248
int TileSize[2]
Definition vtkWindow.h:380
~vtkWindow() override
int Position[2]
Definition vtkWindow.h:368
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:81
virtual int * GetMinimumSize()
Get the minimum size (width and height) of the rendering window in screen coordinates (in pixels).
virtual void SetMinimumSize(int width, int height)
Set the minimum size (width and height) of the rendering window in screen coordinates (in pixels).
virtual void SetPosition(int x, int y)
Set the position (x and y) of the rendering window in screen coordinates (in pixels).
double TileViewport[4]
Definition vtkWindow.h:379
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:79
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:76
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:339
int CurrentCursor
Definition vtkWindow.h:376
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition vtkWindow.h:279
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:340
vtkTypeBool Mapped
Definition vtkWindow.h:369
int Size[2]
Definition vtkWindow.h:366
vtkSetFilePathMacro(CursorFileName)
Set/Get the full path to the custom cursor.
char * CursorFileName
Definition vtkWindow.h:377
vtkTypeBool Erase
Definition vtkWindow.h:372
bool ShowWindow
Definition vtkWindow.h:370
char * WindowName
Definition vtkWindow.h:365
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:85
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition vtkWindow.h:227
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:341
int TileScale[2]
Definition vtkWindow.h:381
virtual int * GetSize()
Get the size (width and height) of the rendering window in screen coordinates (in pixels).
virtual void SetParentId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:78
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition vtkWindow.h:316
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:299
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:77
int MinimumSize[2]
Definition vtkWindow.h:367
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DEPRECATED_IN_9_8_0(reason)
#define VTK_CURSOR_DEFAULT
Definition vtkWindow.h:48
#define VTK_MAYSUSPEND
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_UNBLOCKTHREADS
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)