Open3D (C++ API)  0.17.0
Loading...
Searching...
No Matches
UIImage.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// Copyright (c) 2018-2023 www.open3d.org
5// SPDX-License-Identifier: MIT
6// ----------------------------------------------------------------------------
7
8#pragma once
9
12
13namespace open3d {
14
15namespace t {
16namespace geometry {
17class Image;
18}
19}
20
21namespace geometry {
22class Image;
23} // namespace geometry
24
25namespace visualization {
26
27namespace rendering {
28class Renderer;
29}
30
31namespace gui {
32
33class UIImage {
34public:
35 explicit UIImage(const char* image_path);
36 explicit UIImage(std::shared_ptr<geometry::Image> image);
37 explicit UIImage(std::shared_ptr<t::geometry::Image> image);
42 float u0 = 0.0f,
43 float v0 = 0.0f,
44 float u1 = 1.0f,
45 float v1 = 1.0f);
46 ~UIImage();
47
50 void UpdateImage(std::shared_ptr<geometry::Image> image);
51
54 void UpdateImage(std::shared_ptr<t::geometry::Image> image);
55
56 enum class Scaling {
57 NONE,
58 ANY,
59 ASPECT
60 };
62 Scaling GetScaling() const;
63
65 const Widget::Constraints& constraints) const;
66
67 struct DrawParams {
68 // Default values are to make GCC happy and contented,
69 // pos and size don't have reasonable defaults.
70 float pos_x = 0.0f;
71 float pos_y = 0.0f;
72 float width = 0.0f;
73 float height = 0.0f;
74 float u0 = 0.0f;
75 float v0 = 0.0f;
76 float u1 = 1.0f;
77 float v1 = 1.0f;
79 bool image_size_changed = false;
80 };
82 const Rect& frame) const;
83
84private:
85 struct Impl;
86 std::unique_ptr<Impl> impl_;
87};
88
89} // namespace gui
90} // namespace visualization
91} // namespace open3d
Rect frame
Definition BitmapWindowSystem.cpp:30
std::shared_ptr< core::Tensor > image
Definition FilamentRenderer.cpp:183
float scaling
Definition Window.cpp:78
ImGuiContext * context
Definition Window.cpp:76
Scaling GetScaling() const
Definition UIImage.cpp:152
~UIImage()
Definition UIImage.cpp:134
Size CalcPreferredSize(const LayoutContext &context, const Widget::Constraints &constraints) const
Definition UIImage.cpp:154
void SetScaling(Scaling scaling)
Definition UIImage.cpp:150
Scaling
Definition UIImage.h:56
@ ASPECT
Scales to any size and aspect ratio.
void UpdateImage(std::shared_ptr< geometry::Image > image)
Definition UIImage.cpp:140
DrawParams CalcDrawParams(visualization::rendering::Renderer &renderer, const Rect &frame) const
Definition UIImage.cpp:177
Definition PinholeCameraIntrinsic.cpp:16
visualization::rendering::TextureHandle texture
Definition UIImage.h:78
bool image_size_changed
Definition UIImage.h:79