ArrowHead

function ArrowHead(const arrowTip, controlPt: TPointD; size: double; arrowStyle: TArrowStyle): TPathD;


The controlPt's only function is to control the angle of the arrow.


uses
  Img32, Img32.Fmt.PNG, Img32.Vector, Img32.Draw;
...
var
  img: TImage32;
  pts: array [0..3] of TPointD;
  path, head, tail: TPathD;
  lineWidth, arrowHeadSize: integer;
begin
  pts[0] := PointD(20,20);
  pts[1] := PointD(130,20);
  pts[2] := PointD(130,240);
  pts[3] := PointD(240,240);
  lineWidth := 5;
  arrowHeadSize := GetDefaultArrowHeadSize(lineWidth);
  //create a curved path and then shorten it to accommodate arrow heads
  path := FlattenCBezier(pts[0], pts[1], pts[2], pts[3]);
  path := ShortenPath(path, peBothEnds, arrowHeadSize);
  //create the arrow heads
  tail := ArrowHead(pts[0], path[0], arrowHeadSize, asCircle);
  head := ArrowHead(pts[3], path[High(path)], arrowHeadSize, asFancy);

  //draw the path and the arrow heads
  img := TImage32.Create(256,256);
  DrawLine(img, path, lineWidth, clBlack32, esRound);
  DrawLine(img, tail, lineWidth, clBlack32, esPolygon);
  DrawLine(img, head, lineWidth, clBlack32, esPolygon);
  img.SaveToFile('arrow.png');
  img.Free;