title: How to fill the area between two bezier curves using dear imgui
body: <p>How can I fill the area between two bezier curves using <a href="https://github.com/ocornut/imgui" rel="nofollow noreferrer">dear imgui</a>?</p>
  
  <p>I drew the curves using the ImDrawList API, like this:</p>
  
  <pre><code>        ImVec2 p0(10, 100); ImVec2 c1(110, 50); ImVec2 p1(210, 100);
          ImVec2 q0(10, 200); ImVec2 c2(110, 100); ImVec2 q1(210, 200);
  
          auto col = IM_COL32(0,255,255, 255);
  
          ImDrawList* draw_list = ImGui::GetWindowDrawList();
  
          draw_list-&gt;AddBezierCurve(p0, c1, c1, p1, col, 1.0f);
          draw_list-&gt;AddBezierCurve(q0, c2, c2, q1, col, 1.0f);
  
          // I can close the curves, visually, with these lines
          draw_list-&gt;AddLine(p0, q0, col, 1.0f);
          draw_list-&gt;AddLine(p1, q1, col, 1.0f);
  </code></pre>
  
  <p>Edit:</p>
  
  <p>I used the stateful API to draw the path I wanted and then I called a function to fill this path. Here's the code:</p>
  
  <pre><code>        draw_list-&gt;PathLineTo(p0);
          draw_list-&gt;PathBezierCurveTo(c1, c1, p1);
          draw_list-&gt;PathLineTo(q1);
          draw_list-&gt;PathBezierCurveTo(c2, c2, q0);
  
          draw_list-&gt;PathFillConvex(col);
  </code></pre>
  
  <p>But there is something wrong as you can see: </p>
  
  <p><a href="https://i.stack.imgur.com/SUvX6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SUvX6.png" alt="result"></a></p>
  
  <p>The correct geometry is drawn in white.</p>