VTK  9.7.0
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
16
17#ifndef vtkWindow_h
18#define vtkWindow_h
19
20#include "vtkCommonCoreModule.h" // For export macro
21#include "vtkObject.h"
22#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
23
24VTK_ABI_NAMESPACE_BEGIN
25class vtkImageData;
27
28#define VTK_CURSOR_DEFAULT 0
29#define VTK_CURSOR_ARROW 1
30#define VTK_CURSOR_SIZENE 2
31#define VTK_CURSOR_SIZENW 3
32#define VTK_CURSOR_SIZESW 4
33#define VTK_CURSOR_SIZESE 5
34#define VTK_CURSOR_SIZENS 6
35#define VTK_CURSOR_SIZEWE 7
36#define VTK_CURSOR_SIZEALL 8
37#define VTK_CURSOR_HAND 9
38#define VTK_CURSOR_CROSSHAIR 10
39#define VTK_CURSOR_CUSTOM 11
40
41class VTKCOMMONCORE_EXPORT VTK_MARSHALAUTO vtkWindow : public vtkObject
42{
43public:
44 vtkTypeMacro(vtkWindow, vtkObject);
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
48
52 virtual void SetDisplayId(void*) {}
53 virtual void SetWindowId(void*) {}
54 virtual void SetParentId(void*) {}
55 virtual void* GetGenericDisplayId() { return nullptr; }
56 virtual void* GetGenericWindowId() { return nullptr; }
57 virtual void* GetGenericParentId() { return nullptr; }
58 virtual void* GetGenericContext() { return nullptr; }
59 virtual void* GetGenericDrawable() { return nullptr; }
60 virtual void SetWindowInfo(const char*) {}
61 virtual void SetParentInfo(const char*) {}
62 virtual bool EnsureDisplay() { return true; }
63
65
67
71 virtual int* GetPosition() VTK_SIZEHINT(2);
72
78 virtual void SetPosition(int x, int y);
79 virtual void SetPosition(int a[2]);
81
83
87 virtual int* GetSize() VTK_SIZEHINT(2);
88
97 virtual void SetSize(int width, int height);
98 virtual void SetSize(int a[2]);
100
106
110 virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
111
113
116 vtkGetMacro(Mapped, vtkTypeBool);
118
120
123 vtkGetMacro(ShowWindow, bool);
124 vtkSetMacro(ShowWindow, bool);
125 vtkBooleanMacro(ShowWindow, bool);
127
129
134 vtkSetMacro(UseOffScreenBuffers, bool);
135 vtkGetMacro(UseOffScreenBuffers, bool);
136 vtkBooleanMacro(UseOffScreenBuffers, bool);
138
140
146 vtkSetMacro(Erase, vtkTypeBool);
147 vtkGetMacro(Erase, vtkTypeBool);
148 vtkBooleanMacro(Erase, vtkTypeBool);
150
152
157 vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
159
161
164 vtkGetStringMacro(WindowName);
165 vtkSetStringMacro(WindowName);
167
172 virtual void SetIcon(vtkImageData*) {}
173
179 virtual void Render() {}
180
187
189
201 virtual unsigned char* GetPixelData(
202 int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
203 {
204 return nullptr;
205 }
206 virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
207 vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
208 {
209 return 0;
210 }
212
214
219 vtkGetMacro(DPI, int);
220 vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
222
229 virtual bool DetectDPI() { return false; }
230
232
237 {
238 this->SetShowWindow(val == 0);
239 this->SetUseOffScreenBuffers(val != 0);
240 }
241 vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
243
249 vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
250
255 virtual void MakeCurrent() {}
256
261 virtual void ReleaseCurrent() {}
262
264
270 vtkSetVector2Macro(TileScale, int);
271 vtkGetVector2Macro(TileScale, int);
272 void SetTileScale(int s) { this->SetTileScale(s, s); }
273 vtkSetVector4Macro(TileViewport, double);
274 vtkGetVector4Macro(TileViewport, double);
276
278
283 vtkSetMacro(Borders, vtkTypeBool);
284 vtkGetMacro(Borders, vtkTypeBool);
285 vtkBooleanMacro(Borders, vtkTypeBool);
287
289
295 virtual void HideCursor() {}
296 virtual void ShowCursor() {}
297 virtual void SetCursorPosition(int, int) {}
299
301
304 vtkSetMacro(CurrentCursor, int);
305 vtkGetMacro(CurrentCursor, int);
307
309
316
317protected:
319 ~vtkWindow() override;
320
322 int Size[2];
323 int Position[2];
329 int DPI;
332 char* CursorFileName = nullptr;
333
334 double TileViewport[4];
335 int TileSize[2];
336 int TileScale[2];
337
338private:
339 vtkWindow(const vtkWindow&) = delete;
340 void operator=(const vtkWindow&) = delete;
341};
342
343VTK_ABI_NAMESPACE_END
344#endif
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:29
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:110
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:59
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition vtkWindow.h:201
bool UseOffScreenBuffers
Definition vtkWindow.h:326
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition vtkWindow.h:229
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition vtkWindow.h:249
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition vtkWindow.h:172
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:56
virtual bool EnsureDisplay()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:62
vtkTypeBool Borders
Definition vtkWindow.h:330
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:60
virtual void SetUseOffScreenBuffers(bool)
Render to an offscreen destination such as a framebuffer.
virtual void ReleaseCurrent()
Release the current context.
Definition vtkWindow.h:261
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:58
vtkTypeBool DoubleBuffer
Definition vtkWindow.h:328
int * GetActualSize()
GetSize() returns the size * this->TileScale, whereas this method returns the size without multiplyin...
int TileSize[2]
Definition vtkWindow.h:335
~vtkWindow() override
int Position[2]
Definition vtkWindow.h:323
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:57
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:206
double TileViewport[4]
Definition vtkWindow.h:334
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:55
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:52
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:295
int CurrentCursor
Definition vtkWindow.h:331
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition vtkWindow.h:236
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:296
vtkTypeBool Mapped
Definition vtkWindow.h:324
int Size[2]
Definition vtkWindow.h:322
vtkSetFilePathMacro(CursorFileName)
Set/Get the full path to the custom cursor.
char * CursorFileName
Definition vtkWindow.h:332
vtkTypeBool Erase
Definition vtkWindow.h:327
bool ShowWindow
Definition vtkWindow.h:325
char * WindowName
Definition vtkWindow.h:321
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:61
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition vtkWindow.h:186
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:297
int TileScale[2]
Definition vtkWindow.h:336
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:179
virtual void SetParentId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:54
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition vtkWindow.h:272
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:255
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:53
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_INT_MAX
Definition vtkType.h:192
#define VTK_CURSOR_DEFAULT
Definition vtkWindow.h:28
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_UNBLOCKTHREADS
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)