VTK  9.5.20251124
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
47class VTKCOMMONCORE_EXPORT VTK_MARSHALAUTO vtkWindow : public vtkObject
48{
49public:
50 vtkTypeMacro(vtkWindow, vtkObject);
51 void PrintSelf(ostream& os, vtkIndent indent) override;
52
54
58 virtual void SetDisplayId(void*) {}
59 virtual void SetWindowId(void*) {}
60 virtual void SetParentId(void*) {}
61 virtual void* GetGenericDisplayId() { return nullptr; }
62 virtual void* GetGenericWindowId() { return nullptr; }
63 virtual void* GetGenericParentId() { return nullptr; }
64 virtual void* GetGenericContext() { return nullptr; }
65 virtual void* GetGenericDrawable() { return nullptr; }
66 virtual void SetWindowInfo(const char*) {}
67 virtual void SetParentInfo(const char*) {}
68 virtual bool EnsureDisplay() { return true; }
69
71
73
77 virtual int* GetPosition() VTK_SIZEHINT(2);
78
84 virtual void SetPosition(int x, int y);
85 virtual void SetPosition(int a[2]);
87
89
93 virtual int* GetSize() VTK_SIZEHINT(2);
94
103 virtual void SetSize(int width, int height);
104 virtual void SetSize(int a[2]);
106
112
116 virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
117
119
122 vtkGetMacro(Mapped, vtkTypeBool);
124
126
129 vtkGetMacro(ShowWindow, bool);
130 vtkSetMacro(ShowWindow, bool);
131 vtkBooleanMacro(ShowWindow, bool);
133
135
140 vtkSetMacro(UseOffScreenBuffers, bool);
141 vtkGetMacro(UseOffScreenBuffers, bool);
142 vtkBooleanMacro(UseOffScreenBuffers, bool);
144
146
152 vtkSetMacro(Erase, vtkTypeBool);
153 vtkGetMacro(Erase, vtkTypeBool);
154 vtkBooleanMacro(Erase, vtkTypeBool);
156
158
163 vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
165
167
170 vtkGetStringMacro(WindowName);
171 vtkSetStringMacro(WindowName);
173
178 virtual void SetIcon(vtkImageData*) {}
179
185 virtual void Render() {}
186
193
195
207 virtual unsigned char* GetPixelData(
208 int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
209 {
210 return nullptr;
211 }
212 virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
213 vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
214 {
215 return 0;
216 }
217
218
220
225 vtkGetMacro(DPI, int);
226 vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
228
235 virtual bool DetectDPI() { return false; }
236
238
243 {
244 this->SetShowWindow(val == 0);
245 this->SetUseOffScreenBuffers(val != 0);
246 }
247 vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
249
255 vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
256
261 virtual void MakeCurrent() {}
262
267 virtual void ReleaseCurrent() {}
268
270
276 vtkSetVector2Macro(TileScale, int);
277 vtkGetVector2Macro(TileScale, int);
278 void SetTileScale(int s) { this->SetTileScale(s, s); }
279 vtkSetVector4Macro(TileViewport, double);
280 vtkGetVector4Macro(TileViewport, double);
282
283protected:
285 ~vtkWindow() override;
286
288 int Size[2];
289 int Position[2];
295 int DPI;
296
297 double TileViewport[4];
298 int TileSize[2];
299 int TileScale[2];
300
301private:
302 vtkWindow(const vtkWindow&) = delete;
303 void operator=(const vtkWindow&) = delete;
304};
305
306VTK_ABI_NAMESPACE_END
307#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:116
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:65
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition vtkWindow.h:207
bool UseOffScreenBuffers
Definition vtkWindow.h:292
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition vtkWindow.h:235
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition vtkWindow.h:255
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition vtkWindow.h:178
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:62
virtual bool EnsureDisplay()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:68
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:66
virtual void SetUseOffScreenBuffers(bool)
Render to an offscreen destination such as a framebuffer.
virtual void ReleaseCurrent()
Release the current context.
Definition vtkWindow.h:267
virtual void * GetGenericContext()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:64
vtkTypeBool DoubleBuffer
Definition vtkWindow.h:294
int * GetActualSize()
GetSize() returns the size * this->TileScale, whereas this method returns the size without multiplyin...
int TileSize[2]
Definition vtkWindow.h:298
~vtkWindow() override
int Position[2]
Definition vtkWindow.h:289
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:63
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:212
double TileViewport[4]
Definition vtkWindow.h:297
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:61
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:58
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition vtkWindow.h:242
vtkTypeBool Mapped
Definition vtkWindow.h:290
int Size[2]
Definition vtkWindow.h:288
vtkTypeBool Erase
Definition vtkWindow.h:293
bool ShowWindow
Definition vtkWindow.h:291
char * WindowName
Definition vtkWindow.h:287
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:67
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition vtkWindow.h:192
int TileScale[2]
Definition vtkWindow.h:299
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:185
virtual void SetParentId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:60
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition vtkWindow.h:278
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:261
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:59
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_INT_MAX
Definition vtkType.h:196
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_UNBLOCKTHREADS
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)