MCPcopy Create free account
hub / github.com/RenderKit/embree / Image

Method Image

tutorials/common/imgui/imgui_widgets.cpp:1016–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1014}
1015
1016void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col)
1017{
1018 ImGuiWindow* window = GetCurrentWindow();
1019 if (window->SkipItems)
1020 return;
1021
1022 ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
1023 if (border_col.w > 0.0f)
1024 bb.Max += ImVec2(2, 2);
1025 ItemSize(bb);
1026 if (!ItemAdd(bb, 0))
1027 return;
1028
1029 if (border_col.w > 0.0f)
1030 {
1031 window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(border_col), 0.0f);
1032 window->DrawList->AddImage(user_texture_id, bb.Min + ImVec2(1, 1), bb.Max - ImVec2(1, 1), uv0, uv1, GetColorU32(tint_col));
1033 }
1034 else
1035 {
1036 window->DrawList->AddImage(user_texture_id, bb.Min, bb.Max, uv0, uv1, GetColorU32(tint_col));
1037 }
1038}
1039
1040// ImageButton() is flawed as 'id' is always derived from 'texture_id' (see #2464 #1390)
1041// We provide this internal helper to write your own variant while we figure out how to redesign the public ImageButton() API.

Callers

nothing calls this directly

Calls 5

GetCurrentWindowFunction · 0.85
ImVec2Function · 0.85
ItemSizeFunction · 0.85
AddRectMethod · 0.80
AddImageMethod · 0.80

Tested by

no test coverage detected