Open3D (C++ API)  0.18.0+601516a
BitmapWindowSystem.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <functional>
11 #include <memory>
12 
14 
15 namespace open3d {
16 
17 namespace core {
18 class Tensor;
19 }
20 
21 namespace visualization {
22 namespace gui {
23 
24 struct MouseEvent;
25 struct KeyEvent;
26 struct TextInputEvent;
27 
29 public:
30  enum class Rendering {
31  NORMAL, // normal OpenGL rendering, requires X11, Win32, or Cocoa
32  HEADLESS // uses EGL, does not require the OS to have a window system.
33  // (Linux only)
34  };
37 
38  void Initialize() override;
39  void Uninitialize() override;
40 
42  std::function<void(Window*, std::shared_ptr<core::Tensor>)>;
44 
45  void WaitEventsTimeout(double timeout_secs) override;
46 
48  int width,
49  int height,
50  const char* title,
51  int flags) override;
52  void DestroyWindow(OSWindow w) override;
53 
54  Size GetScreenSize(OSWindow w) override;
55 
56  void PostRedrawEvent(OSWindow w) override;
57  void PostMouseEvent(OSWindow w, const MouseEvent& e);
58  void PostKeyEvent(OSWindow w, const KeyEvent& e);
59  void PostTextInputEvent(OSWindow w, const TextInputEvent& e);
60 
61  bool GetWindowIsVisible(OSWindow w) const override;
62  void ShowWindow(OSWindow w, bool show) override;
63 
64  void RaiseWindowToTop(OSWindow w) override;
65  bool IsActiveWindow(OSWindow w) const override;
66 
67  Point GetWindowPos(OSWindow w) const override;
68  void SetWindowPos(OSWindow w, int x, int y) override;
69 
70  Size GetWindowSize(OSWindow w) const override;
71  void SetWindowSize(OSWindow w, int width, int height) override;
72 
73  Size GetWindowSizePixels(OSWindow w) const override;
74  void SetWindowSizePixels(OSWindow w, const Size& size) override;
75 
76  float GetWindowScaleFactor(OSWindow w) const override;
77  float GetUIScaleFactor(OSWindow w) const override;
78 
79  void SetWindowTitle(OSWindow w, const char* title) override;
80 
81  Point GetMousePosInWindow(OSWindow w) const override;
82  int GetMouseButtons(OSWindow w) const override;
83 
84  void CancelUserClose(OSWindow w) override;
85 
86  void* GetNativeDrawable(OSWindow w) override;
87 
89 
90  void ResizeRenderer(OSWindow w,
91  rendering::FilamentRenderer* renderer) override;
92 
93  MenuBase* CreateOSMenu() override;
94 
95 private:
96  struct Impl;
97  std::unique_ptr<Impl> impl_;
98 };
99 
100 } // namespace gui
101 } // namespace visualization
102 } // namespace open3d
Window * o3d_window
Definition: BitmapWindowSystem.cpp:29
std::function< void(std::shared_ptr< core::Tensor >)> callback
Definition: FilamentRenderer.cpp:182
Definition: BitmapWindowSystem.h:28
void SetWindowSizePixels(OSWindow w, const Size &size) override
Definition: BitmapWindowSystem.cpp:257
rendering::FilamentRenderer * CreateRenderer(OSWindow w) override
Definition: BitmapWindowSystem.cpp:281
void SetWindowTitle(OSWindow w, const char *title) override
Definition: BitmapWindowSystem.cpp:267
void Uninitialize() override
Definition: BitmapWindowSystem.cpp:147
float GetUIScaleFactor(OSWindow w) const override
Definition: BitmapWindowSystem.cpp:265
void ResizeRenderer(OSWindow w, rendering::FilamentRenderer *renderer) override
Definition: BitmapWindowSystem.cpp:306
bool GetWindowIsVisible(OSWindow w) const override
Definition: BitmapWindowSystem.cpp:224
void PostKeyEvent(OSWindow w, const KeyEvent &e)
Definition: BitmapWindowSystem.cpp:213
bool IsActiveWindow(OSWindow w) const override
Definition: BitmapWindowSystem.cpp:230
void SetWindowSize(OSWindow w, int width, int height) override
Definition: BitmapWindowSystem.cpp:246
Size GetScreenSize(OSWindow w) override
Definition: BitmapWindowSystem.cpp:165
void ShowWindow(OSWindow w, bool show) override
Definition: BitmapWindowSystem.cpp:226
OSWindow CreateOSWindow(Window *o3d_window, int width, int height, const char *title, int flags) override
Definition: BitmapWindowSystem.cpp:169
Rendering
Definition: BitmapWindowSystem.h:30
int GetMouseButtons(OSWindow w) const override
Definition: BitmapWindowSystem.cpp:273
~BitmapWindowSystem()
Definition: BitmapWindowSystem.cpp:143
void RaiseWindowToTop(OSWindow w) override
Definition: BitmapWindowSystem.cpp:228
std::function< void(Window *, std::shared_ptr< core::Tensor >)> OnDrawCallback
Definition: BitmapWindowSystem.h:42
void DestroyWindow(OSWindow w) override
Definition: BitmapWindowSystem.cpp:178
Size GetWindowSizePixels(OSWindow w) const override
Definition: BitmapWindowSystem.cpp:253
void PostMouseEvent(OSWindow w, const MouseEvent &e)
Definition: BitmapWindowSystem.cpp:208
void WaitEventsTimeout(double timeout_secs) override
Definition: BitmapWindowSystem.cpp:154
Point GetWindowPos(OSWindow w) const override
Definition: BitmapWindowSystem.cpp:232
void SetWindowPos(OSWindow w, int x, int y) override
Definition: BitmapWindowSystem.cpp:236
void * GetNativeDrawable(OSWindow w) override
Definition: BitmapWindowSystem.cpp:279
BitmapWindowSystem(Rendering mode=Rendering::NORMAL)
Definition: BitmapWindowSystem.cpp:131
Point GetMousePosInWindow(OSWindow w) const override
Definition: BitmapWindowSystem.cpp:269
void SetOnWindowDraw(OnDrawCallback callback)
Definition: BitmapWindowSystem.cpp:149
float GetWindowScaleFactor(OSWindow w) const override
Definition: BitmapWindowSystem.cpp:261
void Initialize() override
Definition: BitmapWindowSystem.cpp:145
MenuBase * CreateOSMenu() override
Definition: BitmapWindowSystem.cpp:312
Size GetWindowSize(OSWindow w) const override
Definition: BitmapWindowSystem.cpp:241
void CancelUserClose(OSWindow w) override
Definition: BitmapWindowSystem.cpp:277
void PostTextInputEvent(OSWindow w, const TextInputEvent &e)
Definition: BitmapWindowSystem.cpp:218
void PostRedrawEvent(OSWindow w) override
Definition: BitmapWindowSystem.cpp:203
Definition: MenuBase.h:26
Definition: Window.h:30
Definition: WindowSystem.h:27
void * OSWindow
Definition: WindowSystem.h:29
int width
Definition: FilePCD.cpp:52
int size
Definition: FilePCD.cpp:40
int height
Definition: FilePCD.cpp:53
const char const char value recording_handle imu_sample void
Definition: K4aPlugin.cpp:250
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle temperature_c k4a_image_t image_handle uint8_t image_handle image_handle image_handle image_handle image_handle timestamp_usec white_balance image_handle k4a_device_configuration_t config device_handle char size_t serial_number_size bool int32_t int32_t int32_t int32_t k4a_color_control_mode_t default_mode mode
Definition: K4aPlugin.cpp:678
Definition: PinholeCameraIntrinsic.cpp:16
Definition: BitmapWindowSystem.cpp:126
Definition: Events.h:203