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
13
14#ifndef vtkWindow_h
15#define vtkWindow_h
16
17#include "vtkCommonCoreModule.h" // For export macro
18#include "vtkObject.h"
19#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
20
21VTK_ABI_NAMESPACE_BEGIN
22class vtkImageData;
24
25class VTKCOMMONCORE_EXPORT VTK_MARSHALAUTO vtkWindow : public vtkObject
26{
27public:
28 vtkTypeMacro(vtkWindow, vtkObject);
29 void PrintSelf(ostream& os, vtkIndent indent) override;
30
32
36 virtual void SetDisplayId(void*) {}
37 virtual void SetWindowId(void*) {}
38 virtual void SetParentId(void*) {}
39 virtual void* GetGenericDisplayId() { return nullptr; }
40 virtual void* GetGenericWindowId() { return nullptr; }
41 virtual void* GetGenericParentId() { return nullptr; }
42 virtual void* GetGenericContext() { return nullptr; }
43 virtual void* GetGenericDrawable() { return nullptr; }
44 virtual void SetWindowInfo(const char*) {}
45 virtual void SetParentInfo(const char*) {}
46 virtual bool EnsureDisplay() { return true; }
47
49
51
55 virtual int* GetPosition() VTK_SIZEHINT(2);
56
62 virtual void SetPosition(int x, int y);
63 virtual void SetPosition(int a[2]);
65
67
71 virtual int* GetSize() VTK_SIZEHINT(2);
72
81 virtual void SetSize(int width, int height);
82 virtual void SetSize(int a[2]);
84
90
94 virtual int* GetScreenSize() VTK_SIZEHINT(2) { return nullptr; }
95
97
100 vtkGetMacro(Mapped, vtkTypeBool);
102
104
107 vtkGetMacro(ShowWindow, bool);
108 vtkSetMacro(ShowWindow, bool);
109 vtkBooleanMacro(ShowWindow, bool);
111
113
118 vtkSetMacro(UseOffScreenBuffers, bool);
119 vtkGetMacro(UseOffScreenBuffers, bool);
120 vtkBooleanMacro(UseOffScreenBuffers, bool);
122
124
130 vtkSetMacro(Erase, vtkTypeBool);
131 vtkGetMacro(Erase, vtkTypeBool);
132 vtkBooleanMacro(Erase, vtkTypeBool);
134
136
141 vtkBooleanMacro(DoubleBuffer, vtkTypeBool);
143
145
148 vtkGetStringMacro(WindowName);
149 vtkSetStringMacro(WindowName);
151
156 virtual void SetIcon(vtkImageData*) {}
157
163 virtual void Render() {}
164
171
173
185 virtual unsigned char* GetPixelData(
186 int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/, int /*right*/ = 0)
187 {
188 return nullptr;
189 }
190 virtual int GetPixelData(int /*x*/, int /*y*/, int /*x2*/, int /*y2*/, int /*front*/,
191 vtkUnsignedCharArray* /*data*/, int /*right*/ = 0)
192 {
193 return 0;
194 }
195
196
198
203 vtkGetMacro(DPI, int);
204 vtkSetClampMacro(DPI, int, 1, VTK_INT_MAX);
206
213 virtual bool DetectDPI() { return false; }
214
216
221 {
222 this->SetShowWindow(val == 0);
223 this->SetUseOffScreenBuffers(val != 0);
224 }
225 vtkBooleanMacro(OffScreenRendering, vtkTypeBool);
227
233 vtkTypeBool GetOffScreenRendering() { return this->GetShowWindow() ? 0 : 1; }
234
239 virtual void MakeCurrent() {}
240
245 virtual void ReleaseCurrent() {}
246
248
254 vtkSetVector2Macro(TileScale, int);
255 vtkGetVector2Macro(TileScale, int);
256 void SetTileScale(int s) { this->SetTileScale(s, s); }
257 vtkSetVector4Macro(TileViewport, double);
258 vtkGetVector4Macro(TileViewport, double);
260
261protected:
263 ~vtkWindow() override;
264
266 int Size[2];
267 int Position[2];
273 int DPI;
274
275 double TileViewport[4];
276 int TileSize[2];
277 int TileScale[2];
278
279private:
280 vtkWindow(const vtkWindow&) = delete;
281 void operator=(const vtkWindow&) = delete;
282};
283
284VTK_ABI_NAMESPACE_END
285#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:94
virtual void * GetGenericDrawable()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:43
virtual unsigned char * GetPixelData(int, int, int, int, int, int=0)
Get the pixel data of an image, transmitted as RGBRGBRGB.
Definition vtkWindow.h:185
bool UseOffScreenBuffers
Definition vtkWindow.h:270
virtual bool DetectDPI()
Attempt to detect and set the DPI of the display device by querying the system.
Definition vtkWindow.h:213
vtkTypeBool GetOffScreenRendering()
Deprecated, directly use GetShowWindow and GetOffScreenBuffers instead.
Definition vtkWindow.h:233
virtual void SetIcon(vtkImageData *)
Set the icon used in title bar and task bar.
Definition vtkWindow.h:156
virtual void * GetGenericWindowId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:40
virtual bool EnsureDisplay()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:46
virtual void SetWindowInfo(const char *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:44
virtual void SetUseOffScreenBuffers(bool)
Render to an offscreen destination such as a framebuffer.
virtual void ReleaseCurrent()
Release the current context.
Definition vtkWindow.h:245
virtual void * GetGenericContext()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:42
vtkTypeBool DoubleBuffer
Definition vtkWindow.h:272
int * GetActualSize()
GetSize() returns the size * this->TileScale, whereas this method returns the size without multiplyin...
int TileSize[2]
Definition vtkWindow.h:276
~vtkWindow() override
int Position[2]
Definition vtkWindow.h:267
virtual void * GetGenericParentId()
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:41
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:190
double TileViewport[4]
Definition vtkWindow.h:275
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:39
virtual void SetDisplayId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:36
void SetOffScreenRendering(vtkTypeBool val)
Convenience to set SHowWindow and UseOffScreenBuffers in one call.
Definition vtkWindow.h:220
vtkTypeBool Mapped
Definition vtkWindow.h:268
int Size[2]
Definition vtkWindow.h:266
vtkTypeBool Erase
Definition vtkWindow.h:271
bool ShowWindow
Definition vtkWindow.h:269
char * WindowName
Definition vtkWindow.h:265
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:45
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition vtkWindow.h:170
virtual VTK_UNBLOCKTHREADS void Render()
Ask each viewport owned by this Window to render its image and synchronize this process.
Definition vtkWindow.h:163
int TileScale[2]
Definition vtkWindow.h:277
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:38
void SetTileScale(int s)
These methods are used by vtkWindowToImageFilter to tell a VTK window to simulate a larger window by ...
Definition vtkWindow.h:256
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:239
virtual void SetWindowId(void *)
These are window system independent methods that are used to help interface vtkWindow to native windo...
Definition vtkWindow.h:37
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)