MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / PrimPieSliceLine

Function PrimPieSliceLine

Source/3rdParty/implot/implot_items.cpp:2772–2822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2770}
2771
2772IMPLOT_INLINE void PrimPieSliceLine(ImDrawList& draw_list, const ImVec2* points, int count, ImU32 col, float half_weight, const ImVec2& tex_uv0, const ImVec2& tex_uv1) {
2773 // Create a thick polyline by drawing quads between each segment
2774 const int segments = count - 1;
2775
2776 for (int i = 0; i < segments; ++i) {
2777 const ImVec2& p1 = points[i];
2778 const ImVec2& p2 = points[i + 1];
2779
2780 // Calculate perpendicular vector for line thickness (same as PrimLine)
2781 float dx = p2.x - p1.x;
2782 float dy = p2.y - p1.y;
2783 IMPLOT_NORMALIZE2F_OVER_ZERO(dx, dy);
2784 dx *= half_weight;
2785 dy *= half_weight;
2786
2787 // Four vertices for the quad (same layout as PrimLine)
2788 draw_list._VtxWritePtr[0].pos.x = p1.x + dy;
2789 draw_list._VtxWritePtr[0].pos.y = p1.y - dx;
2790 draw_list._VtxWritePtr[0].uv = tex_uv0;
2791 draw_list._VtxWritePtr[0].col = col;
2792
2793 draw_list._VtxWritePtr[1].pos.x = p2.x + dy;
2794 draw_list._VtxWritePtr[1].pos.y = p2.y - dx;
2795 draw_list._VtxWritePtr[1].uv = tex_uv0;
2796 draw_list._VtxWritePtr[1].col = col;
2797
2798 draw_list._VtxWritePtr[2].pos.x = p2.x - dy;
2799 draw_list._VtxWritePtr[2].pos.y = p2.y + dx;
2800 draw_list._VtxWritePtr[2].uv = tex_uv1;
2801 draw_list._VtxWritePtr[2].col = col;
2802
2803 draw_list._VtxWritePtr[3].pos.x = p1.x - dy;
2804 draw_list._VtxWritePtr[3].pos.y = p1.y + dx;
2805 draw_list._VtxWritePtr[3].uv = tex_uv1;
2806 draw_list._VtxWritePtr[3].col = col;
2807
2808 draw_list._VtxWritePtr += 4;
2809
2810 // Two triangles for the quad
2811 const ImDrawIdx vtx_idx = (ImDrawIdx)(draw_list._VtxCurrentIdx);
2812 draw_list._IdxWritePtr[0] = vtx_idx;
2813 draw_list._IdxWritePtr[1] = vtx_idx + 1;
2814 draw_list._IdxWritePtr[2] = vtx_idx + 2;
2815 draw_list._IdxWritePtr[3] = vtx_idx;
2816 draw_list._IdxWritePtr[4] = vtx_idx + 2;
2817 draw_list._IdxWritePtr[5] = vtx_idx + 3;
2818 draw_list._IdxWritePtr += 6;
2819
2820 draw_list._VtxCurrentIdx += 4;
2821 }
2822}
2823
2824IMPLOT_INLINE void RenderPieSliceFill(ImDrawList& draw_list, ImVec2* buffer, int count, ImU32 col) {
2825 const ImVec2 uv = draw_list._Data->TexUvWhitePixel;

Callers 1

RenderPieSliceLineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected