Open3D (C++ API)  0.13.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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) 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 
33 namespace open3d {
34 namespace visualization {
35 namespace gui {
36 
37 class ImageWidget : public Widget {
38  using Super = Widget;
39 
40 public:
41  ImageWidget();
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);
58  ~ImageWidget();
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 
81 private:
82  struct Impl;
83  std::unique_ptr<Impl> impl_;
84 };
85 
86 } // namespace gui
87 } // namespace visualization
88 } // namespace open3d
~ImageWidget()
Definition: ImageWidget.cpp:77
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: ImageWidget.cpp:95
Definition: Widget.h:68
DrawResult Draw(const DrawContext &context) override
Definition: ImageWidget.cpp:113
Definition: ImageWidget.h:37
ImGuiContext * context
Definition: Window.cpp:95
Widget()
Definition: Widget.cpp:53
void SetUIImage(std::shared_ptr< UIImage > image)
Definition: ImageWidget.cpp:91
Definition: ImageWidget.cpp:39
Definition: PinholeCameraIntrinsic.cpp:35
void UpdateImage(std::shared_ptr< geometry::Image > image)
Definition: ImageWidget.cpp:79
ImageWidget()
Definition: ImageWidget.cpp:43
DrawResult
Definition: Widget.h:114
void Layout(const LayoutContext &context) override
Definition: ImageWidget.cpp:109
std::shared_ptr< UIImage > GetUIImage() const
Definition: ImageWidget.cpp:87
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:228