DrawLine

procedure DrawLine(img: TImage32; const line: TPathD; lineWidth: double; color: TColor32; endStyle: TEndStyle; joinStyle: TJoinStyle = jsAuto; miterLimit: double = 2); overload;

procedure DrawLine(img: TImage32; const line: TPathD; lineWidth: double; renderer: TCustomRenderer; endStyle: TEndStyle; joinStyle: TJoinStyle = jsAuto; miterLimit: double = 2); overload;

procedure DrawLine(img: TImage32; const lines: TPathsD; lineWidth: double; color: TColor32; endStyle: TEndStyle; joinStyle: TJoinStyle = jsAuto; miterLimit: double = 2); overload;

procedure DrawLine(img: TImage32; const lines: TPathsD; lineWidth: double; renderer: TCustomRenderer; endStyle: TEndStyle; joinStyle: TJoinStyle = jsAuto; miterLimit: double = 2); overload;


EndStyle


JoinStyle


Example 1
  uses Img32, Img32.Fmt.PNG, Img32.vector, Img32.Draw;
  ...
  var
    img: TImage32;
    path, path2: TPathD;
    rec: TRect;
  const
    nPoints = 5; //must be an odd number
    npDiv2  = nPoints div 2;
  begin
    img := TImage32.Create(256,256);
    rec := img.Bounds;
    Windows.InflateRect(rec, -10,-10);

    //create N pointed star
    path := Ellipse(rec, nPoints);
    SetLength(path2, nPoints);
    for i := 0 to nPoints -1 do
      path2[i] := path[((i* npDiv2) mod nPoints)];

    //draw the line
    DrawLine(img, path2, 5, clNavy32, esPolygon);

    img.SaveToFile('line1.png');
    img.Free;
  end;
    
Example 2
  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,-10);
    Windows.OffsetRect(rec, 0, 60);
    with rec do //construct a bezier curve
      path := FlattenCBezier(
        PointD(left, top), PointD(left, bottom),
        PointD(right, bottom), PointD(right, top));
    //draw the bezier curve
    DrawLine(img, path, 10, clMaroon32, esRound);

    img.SaveToFile('line2.png');
    img.Free;
  end;
    
Example 3
  uses Img32, Img32.Fmt.PNG, Img32.vector, Img32.Draw;
  ...
  var
    img: TImage32;
    imageRender: TImageRenderer;
    path, path2: TPathD;
    rec: TRect;
  const
    nPoints = 5; //must be an odd number
    npDiv2  = nPoints div 2;
  begin
    img := TImage32.Create(256, 256);
    rec := img.Bounds;
    Windows.InflateRect(rec, -10,-10);

    //create N pointed star
    path := Ellipse(rec, nPoints);
    SetLength(path2, nPoints);
    for i := 0 to nPoints -1 do
      path2[i] := path[((i* npDiv2) mod nPoints)];

    imageRender := TImageRenderer.Create;
    imageRender.Image.LoadFromResource('TILE', 'BMP');
    imageRender.Image.Resize(10, 10);
    DrawLine(img, path2, 10, imageRender, esPolygon);
    imageRender.Free;
    
    img.SaveToFile('line3.png');
    img.Free;
  end;
    

See Also

TEndStyle, TJoinStyle