VTK  9.4.20251007
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
28class VTKCOMMONCORE_EXPORT VTK_MARSHALAUTO vtkWindow : public vtkObject
29{
30public:
31 vtkTypeMacro(vtkWindow, vtkObject);
32 void PrintSelf(ostream& os, vtkIndent indent) override;
33
35
39 virtual void SetDisplayId(void*) {}
40 virtual void SetWindowId(void*) {}
41 virtual void SetParentId(void*) {}
42 virtual void* GetGenericDisplayId() { return nullptr; }
43 virtual void* GetGenericWindowId() { return nullptr; }
44 virtual void* GetGenericParentId() { return nullptr; }
45 virtual void* GetGenericContext() { return nullptr; }
46 virtual void* GetGenericDrawable() { return nullptr; }
47 virtual void SetWindowInfo(const char*) {}
48 virtual void SetParentInfo(const char*) {}
49 virtual bool EnsureDisplay() { return true; }
50
52
54
58 virtual int* GetPosition() VTK_SIZEHINT(2);
59
65 virtual void SetPosition(int x, int y);
66 virtual void SetPosition(int a[2]);
68
70
74 virtual int* GetSize() VTK_SIZEHINT(2);
75
84 virtual void SetSize(int width, int height);
85 virtual void SetSize(int a[2]);
87
93
97 virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
98
100
103 vtkGetMacro(Mapped, vtkTypeBool);
105
107
111 vtkGetMacro(ShowWindow, bool);
112 vtkSetMacro(ShowWindow, bool);
113 vtkBooleanMacro(ShowWindow, bool);
115
117
123 vtkSetMacro(UseOffScreenBuffers, bool);
124 vtkGetMacro(UseOffScreenBuffers, bool);
125 vtkBooleanMacro(UseOffScreenBuffers, bool);
127
129
135 vtkSetMacro(Erase, vtkTypeBool);
136 vtkGetMacro(Erase, vtkTypeBool);
137 vtkBooleanMacro(Erase, vtkTypeBool);
139
141
146 vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
148
150
153 vtkGetStringMacro(WindowName);
154 vtkSetStringMacro(WindowName);
156
161 virtual void SetIcon(vtkImageData*) {}
162
168 virtual void Render() {}
169
176
178
190 virtual unsigned char* GetPixelData(
191 int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
192 {
193 return nullptr;
194 }
195 virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
196 vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
197 {
198 return 0;
199 }
200
201
203
208 vtkGetMacro(DPI, int);
209 vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
211
218 virtual bool DetectDPI() { return false; }
219
221
226 {
227 this->SetShowWindow(val == 0);
228 this->SetUseOffScreenBuffers(val != 0);
229 }
230 vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
232
238 vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
239
244 virtual void MakeCurrent() {}
245
250 virtual void ReleaseCurrent() {}
251
253
259 vtkSetVector2Macro(TileScale, int);
260 vtkGetVector2Macro(TileScale, int);
261 void SetTileScale(int s) { this->SetTileScale(s, s); }
262 vtkSetVector4Macro(TileViewport, double);
263 vtkGetVector4Macro(TileViewport, double);
265
266protected:
268 ~vtkWindow() override;
269
271 int Size[2];
272 int Position[2];
278 int DPI;
279
280 double TileViewport[4];
281 int TileSize[2];
282 int TileScale[2];
283
284private:
285 vtkWindow(const vtkWindow&) = delete;
286 void operator=(const vtkWindow&) = delete;
287};
288
289VTK_ABI_NAMESPACE_END
290#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:97
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:46
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition vtkWindow.h:190
bool UseOffScreenBuffers
Definition vtkWindow.h:275
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition vtkWindow.h:218
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition vtkWindow.h:238
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition vtkWindow.h:161
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:43
virtual bool EnsureDisplay()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:49
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:47
virtual void SetUseOffScreenBuffers(bool)
Render to an offscreen destination such as a framebuffer.
virtual void ReleaseCurrent()
Release the current context.
Definition vtkWindow.h:250
virtual void * GetGenericContext()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:45
vtkTypeBool DoubleBuffer
Definition vtkWindow.h:277
int * GetActualSize()
GetSize() returns the size * this->TileScale, whereas this method returns the size without multiplyin...
int TileSize[2]
Definition vtkWindow.h:281
~vtkWindow() override
int Position[2]
Definition vtkWindow.h:272
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:44
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:195
double TileViewport[4]
Definition vtkWindow.h:280
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:42
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:39
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition vtkWindow.h:225
vtkTypeBool Mapped
Definition vtkWindow.h:273
int Size[2]
Definition vtkWindow.h:271
vtkTypeBool Erase
Definition vtkWindow.h:276
bool ShowWindow
Definition vtkWindow.h:274
char * WindowName
Definition vtkWindow.h:270
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:48
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition vtkWindow.h:175
virtual VTK_UNBLOCKTHREADS void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition vtkWindow.h:168
int TileScale[2]
Definition vtkWindow.h:282
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:41
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition vtkWindow.h:261
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:244
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:40
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_INT_MAX
Definition vtkType.h:144
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_UNBLOCKTHREADS
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)