DrawLine

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

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

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

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


Example 1
  uses Image32, Image32_PNG, Image32_vector, Image32_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, esClosed);

    img.SaveToFile('line1.png');
    img.Free;
  end;
            

Example 2
  uses Image32, Image32_PNG, Image32_vector, Image32_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);
    //draw a couple of 'points'
    DrawPoint(img, PointD(32,25) , 25, clBlue32);
    DrawPoint(img, PointD(256-32,25) , 25, clBlue32);

    img.SaveToFile('line2.png');
    img.Free;
  end;
            

Example 3
  uses Image32, Image32_PNG, Image32_vector, Image32_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, esClosed);
    imageRender.Free;
    
    img.SaveToFile('line3.png');
    img.Free;
  end;
            

See Also

TEndStyle, TJoinStyle