mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
AA branch: added style.AntiAliasedLines, style.AntiAliasedShapes (#133)
This commit is contained in:
parent
19e59421e5
commit
56553f33b8
15
imgui.cpp
15
imgui.cpp
@ -620,6 +620,8 @@ ImGuiStyle::ImGuiStyle()
|
||||
GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
|
||||
DisplayWindowPadding = ImVec2(22,22); // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.
|
||||
DisplaySafeAreaPadding = ImVec2(4,4); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
|
||||
AntiAliasedLines = true; // Enable anti-aliasing on lines/borders. Disable if you are really short on CPU/GPU.
|
||||
AntiAliasedShapes = true; // Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
|
||||
|
||||
Colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
|
||||
Colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
|
||||
@ -9103,6 +9105,8 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32
|
||||
return;
|
||||
|
||||
const ImVec2 uv = GImGui->FontTexUvWhitePixel;
|
||||
anti_aliased &= GImGui->Style.AntiAliasedLines;
|
||||
//if (ImGui::GetIO().KeyCtrl) anti_aliased = false;
|
||||
|
||||
int start = 0, count = points_count;
|
||||
if (!closed)
|
||||
@ -9111,8 +9115,6 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32
|
||||
count = points_count-1;
|
||||
}
|
||||
|
||||
//if (ImGui::GetIO().KeyCtrl) anti_aliased = false;
|
||||
|
||||
if (anti_aliased)
|
||||
{
|
||||
// Anti-aliased stroke
|
||||
@ -9221,7 +9223,7 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32
|
||||
void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col, bool anti_aliased)
|
||||
{
|
||||
const ImVec2 uv = GImGui->FontTexUvWhitePixel;
|
||||
|
||||
anti_aliased &= GImGui->Style.AntiAliasedShapes;
|
||||
//if (ImGui::GetIO().KeyCtrl) anti_aliased = false;
|
||||
|
||||
if (anti_aliased)
|
||||
@ -10821,6 +10823,13 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
|
||||
ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.55f);
|
||||
|
||||
if (ImGui::TreeNode("Rendering"))
|
||||
{
|
||||
ImGui::Checkbox("Anti-aliased lines", &style.AntiAliasedLines);
|
||||
ImGui::Checkbox("Anti-aliased shapes", &style.AntiAliasedShapes);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Sizes"))
|
||||
{
|
||||
ImGui::SliderFloat("Alpha", &style.Alpha, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI. But application code could have a toggle to switch between zero and non-zero.
|
||||
|
2
imgui.h
2
imgui.h
@ -630,6 +630,8 @@ struct ImGuiStyle
|
||||
float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
|
||||
ImVec2 DisplayWindowPadding; // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.
|
||||
ImVec2 DisplaySafeAreaPadding; // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
|
||||
bool AntiAliasedLines; // Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU.
|
||||
bool AntiAliasedShapes; // Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
|
||||
ImVec4 Colors[ImGuiCol_COUNT];
|
||||
|
||||
IMGUI_API ImGuiStyle();
|
||||
|
Loading…
Reference in New Issue
Block a user