Clarification about Im helpers + moving GetColorXXX functions outside of that block.
diff --git a/imgui.cpp b/imgui.cpp
index c32b64c..3095784 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -1726,38 +1726,6 @@
}
}
-ImU32 ImGui::GetColorU32(ImGuiCol idx, float alpha_mul)
-{
- ImGuiStyle& style = GImGui->Style;
- ImVec4 c = style.Colors[idx];
- c.w *= style.Alpha * alpha_mul;
- return ColorConvertFloat4ToU32(c);
-}
-
-ImU32 ImGui::GetColorU32(const ImVec4& col)
-{
- ImGuiStyle& style = GImGui->Style;
- ImVec4 c = col;
- c.w *= style.Alpha;
- return ColorConvertFloat4ToU32(c);
-}
-
-const ImVec4& ImGui::GetStyleColorVec4(ImGuiCol idx)
-{
- ImGuiStyle& style = GImGui->Style;
- return style.Colors[idx];
-}
-
-ImU32 ImGui::GetColorU32(ImU32 col)
-{
- float style_alpha = GImGui->Style.Alpha;
- if (style_alpha >= 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.
- return (col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT);
-}
-
//-----------------------------------------------------------------------------
// [SECTION] ImGuiStorage
// Helper: Key->value storage
@@ -2215,10 +2183,42 @@
//-----------------------------------------------------------------------------
// [SECTION] RENDER HELPERS
-// Those (internal) functions are currently quite a legacy mess - their signature and behavior will change.
+// Some of those (internal) functions are currently quite a legacy mess - their signature and behavior will change.
// Also see imgui_draw.cpp for some more which have been reworked to not rely on ImGui:: state.
//-----------------------------------------------------------------------------
+ImU32 ImGui::GetColorU32(ImGuiCol idx, float alpha_mul)
+{
+ ImGuiStyle& style = GImGui->Style;
+ ImVec4 c = style.Colors[idx];
+ c.w *= style.Alpha * alpha_mul;
+ return ColorConvertFloat4ToU32(c);
+}
+
+ImU32 ImGui::GetColorU32(const ImVec4& col)
+{
+ ImGuiStyle& style = GImGui->Style;
+ ImVec4 c = col;
+ c.w *= style.Alpha;
+ return ColorConvertFloat4ToU32(c);
+}
+
+const ImVec4& ImGui::GetStyleColorVec4(ImGuiCol idx)
+{
+ ImGuiStyle& style = GImGui->Style;
+ return style.Colors[idx];
+}
+
+ImU32 ImGui::GetColorU32(ImU32 col)
+{
+ ImGuiStyle& style = GImGui->Style;
+ if (style.Alpha >= 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.
+ return (col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT);
+}
+
const char* ImGui::FindRenderedTextEnd(const char* text, const char* text_end)
{
const char* text_display_end = text;
diff --git a/imgui_internal.h b/imgui_internal.h
index ec35468..07fb288 100644
--- a/imgui_internal.h
+++ b/imgui_internal.h
@@ -192,6 +192,8 @@
//-----------------------------------------------------------------------------
// Generic helpers
+// Note that the ImXXX helpers functions are lower-level than ImGui functions.
+// ImGui functions or the ImGui context are never called/used from other ImXXX functions.
//-----------------------------------------------------------------------------
// - Helpers: Misc
// - Helpers: Bit manipulation