VTK  9.7.20260714
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
61class VTKCOMMONCORE_EXPORT VTK_MARSHALAUTO vtkWindow : public vtkObject
62{
63public:
64 vtkTypeMacro(vtkWindow, vtkObject);
65 void PrintSelf(ostream& os, vtkIndent indent) override;
66
68
72 virtual void SetDisplayId(void*) {}
73 virtual void SetWindowId(void*) {}
74 virtual void SetParentId(void*) {}
75 virtual void* GetGenericDisplayId() { return nullptr; }
76 virtual void* GetGenericWindowId() { return nullptr; }
77 virtual void* GetGenericParentId() { return nullptr; }
78 virtual void* GetGenericContext() { return nullptr; }
79 virtual void* GetGenericDrawable() { return nullptr; }
80 virtual void SetWindowInfo(const char*) {}
81 virtual void SetParentInfo(const char*) {}
82 virtual bool EnsureDisplay() { return true; }
83
85
87
91 virtual int* GetPosition() VTK_SIZEHINT(2);
92
98 virtual void SetPosition(int x, int y);
99 virtual void SetPosition(int a[2]);
101
103
107 virtual int* GetSize() VTK_SIZEHINT(2);
108
117 virtual void SetSize(int width, int height);
118 virtual void SetSize(int a[2]);
120
126
130 virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
131
133
136 vtkGetMacro(Mapped, vtkTypeBool);
138
140
143 vtkGetMacro(ShowWindow, bool);
144 vtkSetMacro(ShowWindow, bool);
145 vtkBooleanMacro(ShowWindow, bool);
147
149
154 vtkSetMacro(UseOffScreenBuffers, bool);
155 vtkGetMacro(UseOffScreenBuffers, bool);
156 vtkBooleanMacro(UseOffScreenBuffers, bool);
158
160
166 vtkSetMacro(Erase, vtkTypeBool);
167 vtkGetMacro(Erase, vtkTypeBool);
168 vtkBooleanMacro(Erase, vtkTypeBool);
170
172
177 vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
179
181
184 vtkGetStringMacro(WindowName);
185 vtkSetStringMacro(WindowName);
187
192 virtual void SetIcon(vtkImageData*) {}
193
199 virtual void Render() {}
200
207
209
221 virtual unsigned char* GetPixelData(
222 int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
223 {
224 return nullptr;
225 }
226 virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
227 vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
228 {
229 return 0;
230 }
231
232
234
239 vtkGetMacro(DPI, int);
240 vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
242
249 virtual bool DetectDPI() { return false; }
250
252
257 {
258 this->SetShowWindow(val == 0);
259 this->SetUseOffScreenBuffers(val != 0);
260 }
261 vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
263
269 VTK_DEPRECATED_IN_9_8_0("Use GetShowWindow instead")
270 vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
271
276 virtual void MakeCurrent() {}
277
282 virtual void ReleaseCurrent() {}
283
285
291 vtkSetVector2Macro(TileScale, int);
292 vtkGetVector2Macro(TileScale, int);
293 void SetTileScale(int s) { this->SetTileScale(s, s); }
294 vtkSetVector4Macro(TileViewport, double);
295 vtkGetVector4Macro(TileViewport, double);
297
299
304 vtkSetMacro(Borders, vtkTypeBool);
305 vtkGetMacro(Borders, vtkTypeBool);
306 vtkBooleanMacro(Borders, vtkTypeBool);
308
310
316 virtual void HideCursor() {}
317 virtual void ShowCursor() {}
318 virtual void SetCursorPosition(int, int) {}
320
322
325 vtkSetMacro(CurrentCursor, int);
326 vtkGetMacro(CurrentCursor, int);
328
330
337
338protected:
340 ~vtkWindow() override;
341
343 int Size[2];
344 int Position[2];
350 int DPI;
353 char* CursorFileName = nullptr;
354
355 double TileViewport[4];
356 int TileSize[2];
357 int TileScale[2];
358
359private:
360 vtkWindow(const vtkWindow&) = delete;
361 void operator=(const vtkWindow&) = delete;
362};
363
364VTK_ABI_NAMESPACE_END
365#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:130
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:79
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition vtkWindow.h:221
bool UseOffScreenBuffers
Definition vtkWindow.h:347
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition vtkWindow.h:249
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition vtkWindow.h:270
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition vtkWindow.h:192
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:76
virtual bool EnsureDisplay()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:82
vtkTypeBool Borders
Definition vtkWindow.h:351
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:80
virtual void SetUseOffScreenBuffers(bool)
Render to an offscreen destination such as a framebuffer.
virtual void ReleaseCurrent()
Release the current context.
Definition vtkWindow.h:282
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:78
vtkTypeBool DoubleBuffer
Definition vtkWindow.h:349
int * GetActualSize()
GetSize() returns the size * this->TileScale, whereas this method returns the size without multiplyin...
int TileSize[2]
Definition vtkWindow.h:356
~vtkWindow() override
int Position[2]
Definition vtkWindow.h:344
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:77
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:226
double TileViewport[4]
Definition vtkWindow.h:355
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:75
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:72
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:316
int CurrentCursor
Definition vtkWindow.h:352
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition vtkWindow.h:256
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:317
vtkTypeBool Mapped
Definition vtkWindow.h:345
int Size[2]
Definition vtkWindow.h:343
vtkSetFilePathMacro(CursorFileName)
Set/Get the full path to the custom cursor.
char * CursorFileName
Definition vtkWindow.h:353
vtkTypeBool Erase
Definition vtkWindow.h:348
bool ShowWindow
Definition vtkWindow.h:346
char * WindowName
Definition vtkWindow.h:342
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:81
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition vtkWindow.h:206
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:318
int TileScale[2]
Definition vtkWindow.h:357
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:199
virtual void SetParentId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:74
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition vtkWindow.h:293
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:276
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:73
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DEPRECATED_IN_9_8_0(reason)
#define VTK_INT_MAX
Definition vtkType.h:192
#define VTK_CURSOR_DEFAULT
Definition vtkWindow.h:48
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_UNBLOCKTHREADS
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)