From 4565bf98139bc8e4a17820439d781272f4b502de Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 12 Jul 2015 10:52:20 -0600 Subject: [PATCH] Demo: custom rendering example uses AddRectFilledMultiColor() --- imgui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 49eea35f..75d83130 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -12272,7 +12272,8 @@ static void ShowExampleAppCustomRendering(bool* opened) // If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max). ImVec2 canvas_pos = ImGui::GetCursorScreenPos(); // ImDrawList API uses screen coordinates! ImVec2 canvas_size = ImVec2(ImMax(50.0f,ImGui::GetWindowContentRegionMax().x-ImGui::GetCursorPos().x), ImMax(50.0f,ImGui::GetWindowContentRegionMax().y-ImGui::GetCursorPos().y)); // Resize canvas what's available - draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), 0xFFFFFFFF); + draw_list->AddRectFilledMultiColor(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), ImColor(0,0,0), ImColor(255,0,0), ImColor(255,255,0), ImColor(0,255,0)); + draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), ImColor(255,255,255)); bool adding_preview = false; ImGui::InvisibleButton("canvas", canvas_size); if (ImGui::IsItemHovered())