MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / AddCircle

Method AddCircle

extern/imgui/imgui_draw.cpp:1482–1504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1480}
1481
1482void ImDrawList::AddCircle(const ImVec2& center, float radius, ImU32 col, int num_segments, float thickness)
1483{
1484 if ((col & IM_COL32_A_MASK) == 0 || radius < 0.5f)
1485 return;
1486
1487 if (num_segments <= 0)
1488 {
1489 // Use arc with automatic segment count
1490 _PathArcToFastEx(center, radius - 0.5f, 0, IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0);
1491 _Path.Size--;
1492 }
1493 else
1494 {
1495 // Explicit segment count (still clamp to avoid drawing insanely tessellated shapes)
1496 num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX);
1497
1498 // Because we are filling a closed shape we remove 1 from the count of segments/points
1499 const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
1500 PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1);
1501 }
1502
1503 PathStroke(col, ImDrawFlags_Closed, thickness);
1504}
1505
1506void ImDrawList::AddCircleFilled(const ImVec2& center, float radius, ImU32 col, int num_segments)
1507{

Callers 4

RadioButtonMethod · 0.80
ColorPicker4Method · 0.80
ShowStyleEditorMethod · 0.80

Calls 1

ImClampFunction · 0.85

Tested by

no test coverage detected