ImGui Rounded Image

ImGui::Image does not support rounding, however you can draw it yourself by using AddImageRounded from ImDrawList. This is how I do it:

if(rounding == 0) {
    ImGui::Image(texture, ImVec2(desired_width, desired_height));
} else {
    ImDrawList* dl = ImGui::GetForegroundDrawList();
    ImVec2 p_min = ImGui::GetCursorScreenPos();
    ImVec2 p_max = ImVec2(p_min.x + desired_width, p_min.y + desired_height);
    dl->AddImageRounded(texture, p_min, p_max,
                        ImVec2(0, 0), ImVec2(1, 1), ImGui::GetColorU32(ImVec4(1, 1, 1, 1)),
                        rounding);
}

And how it works without and with rounding:

image-20221219092233697

P.S. Browser Tamer is a browser automation system utility done in spare time by myself. Official page is located here.


To contact me, send an email anytime or leave a comment below.