AggPas - Anti-Grain Geomertry for Object Pascal

TAgg2D.Triangle(x1, y1, x2, y2, x3, y3)

Description

Draws triangle at defined coordinates.

Parameters

x1: double

X coordinate of triangle's first corner [in subpixels].

y1: double

Y coordinate of triangle's first corner [in subpixels].

x2: double

X coordinate of triangle's second corner [in subpixels].

y2: double

Y coordinate of triangle's second corner [in subpixels].

x3: double

X coordinate of triangle's third corner [in subpixels].

y3: double

Y coordinate of triangle's third corner [in subpixels].

Example

if VG.Attach(Image1.Picture.Bitmap) then begin

  VG.ClearAll(255, 255, 255);
  Randomize;

  // Draw 100 random triangles
  for i := 1 to 100 do begin

    VG.LineColor(random(255), random(255), random(255), random(255));
    VG.FillColor(random(255), random(255), random(255), random(255));
    VG.LineWidth(random(100) / 10);

    VG.Triangle(random(ClientWidth - 20) + 10.5, random(ClientHeight - 20) + 10.5,
     random(ClientWidth - 20) + 10.5, random(ClientHeight - 20) + 10.5,
     random(ClientWidth - 20) + 10.5, random(ClientHeight - 20) + 10.5);

  end;
end;

Screenshot: example