VTK  9.5.2
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
32
33#ifndef vtkWindow_h
34#define vtkWindow_h
35
36#include "vtkCommonCoreModule.h" // For export macro
37#include "vtkObject.h"
38#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
39
40VTK_ABI_NAMESPACE_BEGIN
41class vtkImageData;
43
44class VTKCOMMONCORE_EXPORT VTK_MARSHALAUTO vtkWindow : public vtkObject
45{
46public:
47 vtkTypeMacro(vtkWindow, vtkObject);
48 void PrintSelf(ostream& os, vtkIndent indent) override;
49
51
55 virtual void SetDisplayId(void*) {}
56 virtual void SetWindowId(void*) {}
57 virtual void SetParentId(void*) {}
58 virtual void* GetGenericDisplayId() { return nullptr; }
59 virtual void* GetGenericWindowId() { return nullptr; }
60 virtual void* GetGenericParentId() { return nullptr; }
61 virtual void* GetGenericContext() { return nullptr; }
62 virtual void* GetGenericDrawable() { return nullptr; }
63 virtual void SetWindowInfo(const char*) {}
64 virtual void SetParentInfo(const char*) {}
65 virtual bool EnsureDisplay() { return true; }
66
68
70
74 virtual int* GetPosition() VTK_SIZEHINT(2);
75
81 virtual void SetPosition(int x, int y);
82 virtual void SetPosition(int a[2]);
84
86
90 virtual int* GetSize() VTK_SIZEHINT(2);
91
100 virtual void SetSize(int width, int height);
101 virtual void SetSize(int a[2]);
103
109
113 virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
114
116
119 vtkGetMacro(Mapped, vtkTypeBool);
121
123
126 vtkGetMacro(ShowWindow, bool);
127 vtkSetMacro(ShowWindow, bool);
128 vtkBooleanMacro(ShowWindow, bool);
130
132
137 vtkSetMacro(UseOffScreenBuffers, bool);
138 vtkGetMacro(UseOffScreenBuffers, bool);
139 vtkBooleanMacro(UseOffScreenBuffers, bool);
141
143
149 vtkSetMacro(Erase, vtkTypeBool);
150 vtkGetMacro(Erase, vtkTypeBool);
151 vtkBooleanMacro(Erase, vtkTypeBool);
153
155
160 vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
162
164
167 vtkGetStringMacro(WindowName);
168 vtkSetStringMacro(WindowName);
170
175 virtual void SetIcon(vtkImageData*) {}
176
182 virtual void Render() {}
183
190
192
204 virtual unsigned char* GetPixelData(
205 int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
206 {
207 return nullptr;
208 }
209 virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
210 vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
211 {
212 return 0;
213 }
214
215
217
222 vtkGetMacro(DPI, int);
223 vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
225
232 virtual bool DetectDPI() { return false; }
233
235
240 {
241 this->SetShowWindow(val == 0);
242 this->SetUseOffScreenBuffers(val != 0);
243 }
244 vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
246
252 vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
253
258 virtual void MakeCurrent() {}
259
264 virtual void ReleaseCurrent() {}
265
267
273 vtkSetVector2Macro(TileScale, int);
274 vtkGetVector2Macro(TileScale, int);
275 void SetTileScale(int s) { this->SetTileScale(s, s); }
276 vtkSetVector4Macro(TileViewport, double);
277 vtkGetVector4Macro(TileViewport, double);
279
280protected:
282 ~vtkWindow() override;
283
285 int Size[2];
286 int Position[2];
292 int DPI;
293
294 double TileViewport[4];
295 int TileSize[2];
296 int TileScale[2];
297
298private:
299 vtkWindow(const vtkWindow&) = delete;
300 void operator=(const vtkWindow&) = delete;
301};
302
303VTK_ABI_NAMESPACE_END
304#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:113
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:62
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition vtkWindow.h:204
bool UseOffScreenBuffers
Definition vtkWindow.h:289
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition vtkWindow.h:232
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition vtkWindow.h:252
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition vtkWindow.h:175
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:59
virtual bool EnsureDisplay()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:65
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:63
virtual void SetUseOffScreenBuffers(bool)
Render to an offscreen destination such as a framebuffer.
virtual void ReleaseCurrent()
Release the current context.
Definition vtkWindow.h:264
virtual void * GetGenericContext()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:61
vtkTypeBool DoubleBuffer
Definition vtkWindow.h:291
int * GetActualSize()
GetSize() returns the size * this->TileScale, whereas this method returns the size without multiplyin...
int TileSize[2]
Definition vtkWindow.h:295
~vtkWindow() override
int Position[2]
Definition vtkWindow.h:286
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:60
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:209
double TileViewport[4]
Definition vtkWindow.h:294
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:58
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:55
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition vtkWindow.h:239
vtkTypeBool Mapped
Definition vtkWindow.h:287
int Size[2]
Definition vtkWindow.h:285
vtkTypeBool Erase
Definition vtkWindow.h:290
bool ShowWindow
Definition vtkWindow.h:288
char * WindowName
Definition vtkWindow.h:284
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:64
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition vtkWindow.h:189
virtual VTK_UNBLOCKTHREADS void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition vtkWindow.h:182
int TileScale[2]
Definition vtkWindow.h:296
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:57
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition vtkWindow.h:275
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:258
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:56
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_INT_MAX
Definition vtkType.h:161
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_UNBLOCKTHREADS
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)