FlattenQBezier

function FlattenQBezier(const pt1, pt2, pt3: TPointD): TPathD; overload;

function FlattenQBezier(const pts: TPathD): TPathD; overload;

function FlattenQBezier(const pts: TPathsD): TPathsD; overload;


uses Img32, Img32.Fmt.PNG, Img32.vector, Img32.Draw;
...
var
  img: TImage32;
  path, path2: TPathD;
  rec: TRect;
begin
  img := TImage32.Create(256,256);
  rec := img.Bounds;
  Windows.InflateRect(rec, -30, 0);
  Windows.OffsetRect(rec, 0, 80);
  
  with rec do
    Path := FlattenQBezier(PointD(left, top),
      PointD((left+right)/2, bottom),
      PointD(right, top));
  DrawLine(img, path, 10, clMaroon32, esRound);
  
  //draw a couple of 'points'
  DrawPoint(img, PointD(32,25) , 25, clBlue32);
  DrawPoint(img, PointD(256-32,25) , 25, clBlue32);

  img.SaveToFile('c:\temp\line4.png');
  img.Free;
end;
    

See Also

FlattenCBezier, FlattenQSpline