MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / Image

Method Image

extern/imgui/imgui_widgets.cpp:1021–1043  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1019}
1020
1021void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col)
1022{
1023 ImGuiWindow* window = GetCurrentWindow();
1024 if (window->SkipItems)
1025 return;
1026
1027 ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
1028 if (border_col.w > 0.0f)
1029 bb.Max += ImVec2(2, 2);
1030 ItemSize(bb);
1031 if (!ItemAdd(bb, 0))
1032 return;
1033
1034 if (border_col.w > 0.0f)
1035 {
1036 window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(border_col), 0.0f);
1037 window->DrawList->AddImage(user_texture_id, bb.Min + ImVec2(1, 1), bb.Max - ImVec2(1, 1), uv0, uv1, GetColorU32(tint_col));
1038 }
1039 else
1040 {
1041 window->DrawList->AddImage(user_texture_id, bb.Min, bb.Max, uv0, uv1, GetColorU32(tint_col));
1042 }
1043}
1044
1045// ImageButton() is flawed as 'id' is always derived from 'texture_id' (see #2464 #1390)
1046// 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