Open3D (C++ API)  0.16.0
ImageWidget.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// The MIT License (MIT)
5//
6// Copyright (c) 2018-2021 www.open3d.org
7//
8// Permission is hereby granted, free of charge, to any person obtaining a copy
9// of this software and associated documentation files (the "Software"), to deal
10// in the Software without restriction, including without limitation the rights
11// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12// copies of the Software, and to permit persons to whom the Software is
13// furnished to do so, subject to the following conditions:
14//
15// The above copyright notice and this permission notice shall be included in
16// all copies or substantial portions of the Software.
17//
18// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24// IN THE SOFTWARE.
25// ----------------------------------------------------------------------------
26
27#pragma once
28
30
32
33namespace open3d {
34namespace visualization {
35namespace gui {
36
37class ImageWidget : public Widget {
38 using Super = Widget;
39
40public:
44 explicit ImageWidget(const char* image_path);
46 explicit ImageWidget(std::shared_ptr<geometry::Image> image);
48 explicit ImageWidget(std::shared_ptr<t::geometry::Image> image);
53 float u0 = 0.0f,
54 float v0 = 0.0f,
55 float u1 = 1.0f,
56 float v1 = 1.0f);
57 ImageWidget(std::shared_ptr<UIImage> image);
59
68 void UpdateImage(std::shared_ptr<geometry::Image> image);
69 void UpdateImage(std::shared_ptr<t::geometry::Image> image);
70
71 std::shared_ptr<UIImage> GetUIImage() const;
72 void SetUIImage(std::shared_ptr<UIImage> image);
73
75 const Constraints& constraints) const override;
76
77 void Layout(const LayoutContext& context) override;
78
79 DrawResult Draw(const DrawContext& context) override;
80
81private:
82 struct Impl;
83 std::unique_ptr<Impl> impl_;
84};
85
86} // namespace gui
87} // namespace visualization
88} // namespace open3d
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:202
ImGuiContext * context
Definition: Window.cpp:95
Definition: ImageWidget.h:37
void Layout(const LayoutContext &context) override
Definition: ImageWidget.cpp:109
ImageWidget()
Definition: ImageWidget.cpp:43
DrawResult Draw(const DrawContext &context) override
Definition: ImageWidget.cpp:113
std::shared_ptr< UIImage > GetUIImage() const
Definition: ImageWidget.cpp:87
void UpdateImage(std::shared_ptr< geometry::Image > image)
Definition: ImageWidget.cpp:79
~ImageWidget()
Definition: ImageWidget.cpp:77
void SetUIImage(std::shared_ptr< UIImage > image)
Definition: ImageWidget.cpp:91
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: ImageWidget.cpp:95
Definition: Widget.h:68
Widget()
Definition: Widget.cpp:53
DrawResult
Definition: Widget.h:114
Definition: PinholeCameraIntrinsic.cpp:35
Definition: ImageWidget.cpp:39