/// <summary> /// Helper to scale the ClipRect field of each ImDrawCmd. /// Use if your final output buffer is at a different scale than ImGui expects, /// or if there is a difference between your window resolution and framebuffer resolution. /// </summary> /// <param name="drawData">Pointer to the DrawData to scale.</param> /// <param name="scale">The scale to apply.</param> public static unsafe void ScaleClipRects(ImDrawData drawData, ImVec2 scale) { for (int i = 0; i < drawData.CmdListsCount; i++) { NativeImDrawList *cmd_list = drawData.CmdLists[i]; for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) { ImDrawCmd *drawCmdList = (ImDrawCmd *)cmd_list->CmdBuffer.Data; ImDrawCmd *cmd = &drawCmdList[cmd_i]; cmd->ClipRect = new ImVec4(cmd->ClipRect.X * scale.X, cmd->ClipRect.Y * scale.Y, cmd->ClipRect.Z * scale.X, cmd->ClipRect.W * scale.Y); } } }
public ImDrawList(NativeImDrawList *native) { Native = native; }