MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / AddCircle

Method AddCircle

lib/imgui/imgui_draw.cpp:1103–1131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1101}
1102
1103void ImDrawList::AddCircle(const ImVec2& center, float radius, ImU32 col, int num_segments, float thickness)
1104{
1105 if ((col & IM_COL32_A_MASK) == 0 || radius <= 0.0f)
1106 return;
1107
1108 // Obtain segment count
1109 if (num_segments <= 0)
1110 {
1111 // Automatic segment count
1112 const int radius_idx = (int)radius - 1;
1113 if (radius_idx < IM_ARRAYSIZE(_Data->CircleSegmentCounts))
1114 num_segments = _Data->CircleSegmentCounts[radius_idx]; // Use cached value
1115 else
1116 num_segments = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, _Data->CircleSegmentMaxError);
1117 }
1118 else
1119 {
1120 // Explicit segment count (still clamp to avoid drawing insanely tessellated shapes)
1121 num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX);
1122 }
1123
1124 // Because we are filling a closed shape we remove 1 from the count of segments/points
1125 const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
1126 if (num_segments == 12)
1127 PathArcToFast(center, radius - 0.5f, 0, 12);
1128 else
1129 PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1);
1130 PathStroke(col, true, thickness);
1131}
1132
1133void ImDrawList::AddCircleFilled(const ImVec2& center, float radius, ImU32 col, int num_segments)
1134{

Callers 3

RadioButtonMethod · 0.80
ColorPicker4Method · 0.80

Calls 1

ImClampFunction · 0.85

Tested by

no test coverage detected