MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / PathRect

Method PathRect

KBotExt/imgui/imgui_draw.cpp:1350–1376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1348}
1349
1350void ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, ImDrawFlags flags)
1351{
1352 if (rounding >= 0.5f)
1353 {
1354 flags = FixRectCornerFlags(flags);
1355 rounding = ImMin(rounding, ImFabs(b.x - a.x) * (((flags & ImDrawFlags_RoundCornersTop) == ImDrawFlags_RoundCornersTop) || ((flags & ImDrawFlags_RoundCornersBottom) == ImDrawFlags_RoundCornersBottom) ? 0.5f : 1.0f) - 1.0f);
1356 rounding = ImMin(rounding, ImFabs(b.y - a.y) * (((flags & ImDrawFlags_RoundCornersLeft) == ImDrawFlags_RoundCornersLeft) || ((flags & ImDrawFlags_RoundCornersRight) == ImDrawFlags_RoundCornersRight) ? 0.5f : 1.0f) - 1.0f);
1357 }
1358 if (rounding < 0.5f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone)
1359 {
1360 PathLineTo(a);
1361 PathLineTo(ImVec2(b.x, a.y));
1362 PathLineTo(b);
1363 PathLineTo(ImVec2(a.x, b.y));
1364 }
1365 else
1366 {
1367 const float rounding_tl = (flags & ImDrawFlags_RoundCornersTopLeft) ? rounding : 0.0f;
1368 const float rounding_tr = (flags & ImDrawFlags_RoundCornersTopRight) ? rounding : 0.0f;
1369 const float rounding_br = (flags & ImDrawFlags_RoundCornersBottomRight) ? rounding : 0.0f;
1370 const float rounding_bl = (flags & ImDrawFlags_RoundCornersBottomLeft) ? rounding : 0.0f;
1371 PathArcToFast(ImVec2(a.x + rounding_tl, a.y + rounding_tl), rounding_tl, 6, 9);
1372 PathArcToFast(ImVec2(b.x - rounding_tr, a.y + rounding_tr), rounding_tr, 9, 12);
1373 PathArcToFast(ImVec2(b.x - rounding_br, b.y - rounding_br), rounding_br, 0, 3);
1374 PathArcToFast(ImVec2(a.x + rounding_bl, b.y - rounding_bl), rounding_bl, 3, 6);
1375 }
1376}
1377
1378void ImDrawList::AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness)
1379{

Callers

nothing calls this directly

Calls 3

FixRectCornerFlagsFunction · 0.85
ImMinFunction · 0.85
ImVec2Function · 0.85

Tested by

no test coverage detected