VTK  9.7.20260804
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
200 virtual void Render() {}
201
208
210
222 virtual unsigned char* GetPixelData(
223 int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
224 {
225 return nullptr;
226 }
228 virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
229 vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
230 {
231 return 0;
232 }
233
234
236
243 vtkGetMacro(DPI, int);
244 virtual void SetDPI(int dpi);
246
252 virtual bool DetectDPI() { return false; }
253
255
260 {
261 this->SetShowWindow(val == 0);
262 this->SetUseOffScreenBuffers(val != 0);
263 }
264 vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
266
272 VTK_DEPRECATED_IN_9_8_0("Use GetShowWindow instead")
273 vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
274
279 virtual void MakeCurrent() {}
280
285 virtual void ReleaseCurrent() {}
286
288
294 vtkSetVector2Macro(TileScale, int);
295 vtkGetVector2Macro(TileScale, int);
296 void SetTileScale(int s) { this->SetTileScale(s, s); }
297 vtkSetVector4Macro(TileViewport, double);
298 vtkGetVector4Macro(TileViewport, double);
300
302
307 vtkSetMacro(Borders, vtkTypeBool);
308 vtkGetMacro(Borders, vtkTypeBool);
309 vtkBooleanMacro(Borders, vtkTypeBool);
311
313
319 virtual void HideCursor() {}
320 virtual void ShowCursor() {}
321 virtual void SetCursorPosition(int, int) {}
323
325
328 vtkSetMacro(CurrentCursor, int);
329 vtkGetMacro(CurrentCursor, int);
331
333
340
341protected:
343 ~vtkWindow() override;
344
346 int Size[2];
347 int Position[2];
353 int DPI;
356 char* CursorFileName = nullptr;
357
358 double TileViewport[4];
359 int TileSize[2];
360 int TileScale[2];
361
362private:
363 vtkWindow(const vtkWindow&) = delete;
364 void operator=(const vtkWindow&) = delete;
365};
366
367VTK_ABI_NAMESPACE_END
368#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 VTK_MAYSUSPEND void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition vtkWindow.h:200
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition vtkWindow.h:222
bool UseOffScreenBuffers
Definition vtkWindow.h:350
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition vtkWindow.h:252
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition vtkWindow.h:273
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: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:354
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:285
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:352
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:228
int TileSize[2]
Definition vtkWindow.h:359
~vtkWindow() override
int Position[2]
Definition vtkWindow.h:347
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).
double TileViewport[4]
Definition vtkWindow.h:358
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:319
int CurrentCursor
Definition vtkWindow.h:355
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition vtkWindow.h:259
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:320
vtkTypeBool Mapped
Definition vtkWindow.h:348
int Size[2]
Definition vtkWindow.h:346
vtkSetFilePathMacro(CursorFileName)
Set/Get the full path to the custom cursor.
char * CursorFileName
Definition vtkWindow.h:356
vtkTypeBool Erase
Definition vtkWindow.h:351
bool ShowWindow
Definition vtkWindow.h:349
char * WindowName
Definition vtkWindow.h:345
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:207
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:321
int TileScale[2]
Definition vtkWindow.h:360
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: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:296
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:279
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_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)