17 namespace visualization {
26 std::make_shared<UIImage>(std::make_shared<geometry::Image>());
31 impl_->image_ = std::make_shared<UIImage>(image_path);
36 impl_->image_ = std::make_shared<UIImage>(
image);
41 impl_->image_ = std::make_shared<UIImage>(
image);
50 impl_->image_ = std::make_shared<UIImage>(texture_id, u0, v0, u1, v1);
55 impl_->image_ =
image;
73 impl_->image_ =
image;
80 pref = impl_->image_->CalcPreferredSize(
context, constraints);
102 ImTextureID image_id =
103 reinterpret_cast<ImTextureID
>(
params.texture.GetId());
104 ImGui::SetCursorScreenPos(
105 ImVec2(
params.pos_x,
params.pos_y - ImGui::GetScrollY()));
106 ImGui::Image(image_id, ImVec2(
params.width,
params.height),
113 frame.y -= ImGui::GetScrollY();
114 const char* error_text =
" Error\nloading\n image";
115 Color fg(1.0, 1.0, 1.0);
116 ImGui::GetWindowDrawList()->AddRectFilled(
118 ImVec2(
float(
frame.GetRight()),
float(
frame.GetBottom())),
119 IM_COL32(255, 0, 0, 255));
120 ImGui::GetWindowDrawList()->AddRect(
122 ImVec2(
float(
frame.GetRight()),
float(
frame.GetBottom())),
123 IM_COL32(255, 255, 255, 255));
126 auto padding = ImGui::GetStyle().FramePadding;
128 float wrapX = ImGui::GetCursorPos().x + wrap_width;
129 auto* font = ImGui::GetFont();
131 font->CalcTextSizeA(
float(
context.theme.font_size), wrap_width,
132 wrap_width, error_text);
133 float x = (float(
frame.width) - text_size.x) / 2.0f;
134 float y = (float(
frame.height) - text_size.y) / 2.0f;
136 ImGui::SetCursorScreenPos(ImVec2(x +
frame.x, y +
frame.y));
137 ImGui::PushTextWrapPos(wrapX);
138 ImGui::TextWrapped(
"%s", error_text);
139 ImGui::PopTextWrapPos();
141 ImGui::PopStyleColor();
145 if (
params.image_size_changed) {
std::shared_ptr< core::Tensor > image
cmdLineReadable * params[]
MiniVec< float, N > ceil(const MiniVec< float, N > &a)
ImVec4 colorToImgui(const Color &color)
Generic file read and write utility for python interface.
static const REHandle kBad