mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-27 14:07:00 +00:00
Modals: Temporary changes of ImGuiCol_ModalWindowDimBg are properly handled by BeginPopupModal(). (#7340)
+ Misc: Added optional alpha multiplier parameter to GetColorU32(ImU32) variant.
This commit is contained in:
parent
659fb41d0a
commit
34965cf23a
@ -47,6 +47,8 @@ Other changes:
|
||||
erroneously close the window. (#7325, #7287, #7063)
|
||||
- Popups: Fixed resizable popup minimum size being too small. Standardized minimum
|
||||
size logic. (#7329).
|
||||
- Modals: Temporary changes of ImGuiCol_ModalWindowDimBg are properly handled by
|
||||
BeginPopupModal(). (#7340)
|
||||
- Tables: Angled headers: fixed support for multi-line labels. (#6917)
|
||||
- Tables: Angled headers: various fixes to accurately handle CellPadding changes. (#6917)
|
||||
- Tables: Angled headers: properly registers horizontal component of angled headers
|
||||
@ -58,6 +60,7 @@ Other changes:
|
||||
- Debug Tools: Item Picker: Promoted ImGui::DebugStartItemPicker() to public API. (#2673)
|
||||
- Debug Tools: Item Picker: Menu entry visible in Demo->Tools but greyed out unless
|
||||
io.ConfigDebugIsDebuggerPresent is set. (#2673)
|
||||
- Misc: Added optional alpha multiplier parameter to GetColorU32(ImU32) variant.
|
||||
- Demo: Custom Rendering: better demonstrate PathArcTo(), PathBezierQuadraticCurveTo(),
|
||||
PathBezierCubicCurveTo(), PathStroke(), PathFillConvex() functions.
|
||||
|
||||
@ -88,7 +91,7 @@ Other changes:
|
||||
Added ImGui_ImplSDL2_SetGamepadMode()) function to select whether to automatically pick
|
||||
first available gamepad, all gamepads, or specific gamepads.
|
||||
(#3884, #6559, #6890, #7180) [@ocornut, @lethal-guitar, @wn2000, @bog-dan-ro]
|
||||
- BackendsL SDL3: Fixed gamepad handling. (#7180) [@bog-dan-ro]
|
||||
- Backends: SDL3: Fixed gamepad handling. (#7180) [@bog-dan-ro]
|
||||
- Backends: SDLRenderer3: query newly added SDL_RenderViewportSet() to not restore
|
||||
a wrong viewport if none was initially set.
|
||||
- Backends: DirectX9: Using RGBA format when allowed by the driver to avoid CPU side
|
||||
|
11
imgui.cpp
11
imgui.cpp
@ -3047,13 +3047,14 @@ const ImVec4& ImGui::GetStyleColorVec4(ImGuiCol idx)
|
||||
return style.Colors[idx];
|
||||
}
|
||||
|
||||
ImU32 ImGui::GetColorU32(ImU32 col)
|
||||
ImU32 ImGui::GetColorU32(ImU32 col, float alpha_mul)
|
||||
{
|
||||
ImGuiStyle& style = GImGui->Style;
|
||||
if (style.Alpha >= 1.0f)
|
||||
alpha_mul *= style.Alpha;
|
||||
if (alpha_mul >= 1.0f)
|
||||
return col;
|
||||
ImU32 a = (col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT;
|
||||
a = (ImU32)(a * style.Alpha); // We don't need to clamp 0..255 because Style.Alpha is in 0..1 range.
|
||||
a = (ImU32)(a * alpha_mul); // We don't need to clamp 0..255 because alpha is in 0..1 range.
|
||||
return (col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT);
|
||||
}
|
||||
|
||||
@ -5002,7 +5003,7 @@ static void ImGui::RenderDimmedBackgrounds()
|
||||
{
|
||||
// Draw dimming behind modal or a begin stack child, whichever comes first in draw order.
|
||||
ImGuiWindow* dim_behind_window = FindBottomMostVisibleWindowWithinBeginStack(modal_window);
|
||||
RenderDimmedBackgroundBehindWindow(dim_behind_window, GetColorU32(ImGuiCol_ModalWindowDimBg, g.DimBgRatio));
|
||||
RenderDimmedBackgroundBehindWindow(dim_behind_window, GetColorU32(modal_window->DC.ModalDimBgColor, g.DimBgRatio));
|
||||
}
|
||||
else if (dim_bg_for_window_list)
|
||||
{
|
||||
@ -6960,6 +6961,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
window->DC.TextWrapPos = -1.0f; // disabled
|
||||
window->DC.ItemWidthStack.resize(0);
|
||||
window->DC.TextWrapPosStack.resize(0);
|
||||
if (flags & ImGuiWindowFlags_Modal)
|
||||
window->DC.ModalDimBgColor = ColorConvertFloat4ToU32(GetStyleColorVec4(ImGuiCol_ModalWindowDimBg));
|
||||
|
||||
if (window->AutoFitFramesX > 0)
|
||||
window->AutoFitFramesX--;
|
||||
|
2
imgui.h
2
imgui.h
@ -445,7 +445,7 @@ namespace ImGui
|
||||
IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
|
||||
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f); // retrieve given style color with style alpha applied and optional extra alpha multiplier, packed as a 32-bit value suitable for ImDrawList
|
||||
IMGUI_API ImU32 GetColorU32(const ImVec4& col); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
|
||||
IMGUI_API ImU32 GetColorU32(ImU32 col); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
|
||||
IMGUI_API ImU32 GetColorU32(ImU32 col, float alpha_mul = 1.0f); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
|
||||
IMGUI_API const ImVec4& GetStyleColorVec4(ImGuiCol idx); // retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwise use GetColorU32() to get style color with style alpha baked in.
|
||||
|
||||
// Layout cursor positioning
|
||||
|
@ -2481,6 +2481,7 @@ struct IMGUI_API ImGuiWindowTempData
|
||||
int CurrentTableIdx; // Current table index (into g.Tables)
|
||||
ImGuiLayoutType LayoutType;
|
||||
ImGuiLayoutType ParentLayoutType; // Layout type of parent window at the time of Begin()
|
||||
ImU32 ModalDimBgColor;
|
||||
|
||||
// Local parameters stacks
|
||||
// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
|
||||
|
Loading…
Reference in New Issue
Block a user