MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / RenderDimmedBackgrounds

Method RenderDimmedBackgrounds

KBotExt/imgui/imgui.cpp:4926–4962  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4924}
4925
4926static void ImGui::RenderDimmedBackgrounds()
4927{
4928 ImGuiContext& g = *GImGui;
4929 ImGuiWindow* modal_window = GetTopMostAndVisiblePopupModal();
4930 if (g.DimBgRatio <= 0.0f && g.NavWindowingHighlightAlpha <= 0.0f)
4931 return;
4932 const bool dim_bg_for_modal = (modal_window != NULL);
4933 const bool dim_bg_for_window_list = (g.NavWindowingTargetAnim != NULL && g.NavWindowingTargetAnim->Active);
4934 if (!dim_bg_for_modal && !dim_bg_for_window_list)
4935 return;
4936
4937 if (dim_bg_for_modal)
4938 {
4939 // Draw dimming behind modal or a begin stack child, whichever comes first in draw order.
4940 ImGuiWindow* dim_behind_window = FindBottomMostVisibleWindowWithinBeginStack(modal_window);
4941 RenderDimmedBackgroundBehindWindow(dim_behind_window, GetColorU32(ImGuiCol_ModalWindowDimBg, g.DimBgRatio));
4942 }
4943 else if (dim_bg_for_window_list)
4944 {
4945 // Draw dimming behind CTRL+Tab target window
4946 RenderDimmedBackgroundBehindWindow(g.NavWindowingTargetAnim, GetColorU32(ImGuiCol_NavWindowingDimBg, g.DimBgRatio));
4947
4948 // Draw border around CTRL+Tab target window
4949 ImGuiWindow* window = g.NavWindowingTargetAnim;
4950 ImGuiViewport* viewport = GetMainViewport();
4951 float distance = g.FontSize;
4952 ImRect bb = window->Rect();
4953 bb.Expand(distance);
4954 if (bb.GetWidth() >= viewport->Size.x && bb.GetHeight() >= viewport->Size.y)
4955 bb.Expand(-distance - 1.0f); // If a window fits the entire viewport, adjust its highlight inward
4956 if (window->DrawList->CmdBuffer.Size == 0)
4957 window->DrawList->AddDrawCmd();
4958 window->DrawList->PushClipRect(viewport->Pos, viewport->Pos + viewport->Size);
4959 window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), window->WindowRounding, 0, 3.0f);
4960 window->DrawList->PopClipRect();
4961 }
4962}
4963
4964// This is normally called by Render(). You may want to call it directly if you want to avoid calling Render() but the gain will be very minimal.
4965void ImGui::EndFrame()

Callers

nothing calls this directly

Calls 4

AddDrawCmdMethod · 0.80
AddRectMethod · 0.80
PushClipRectMethod · 0.45
PopClipRectMethod · 0.45

Tested by

no test coverage detected