AggPas - Anti-Grain Geomertry for Object Pascal

TAgg2D.RoundedRect(x1, y1, x2, y2, r)
TAgg2D.RoundedRect (x1, y1, x2, y2, rx, ry)
TAgg2D.RoundedRect (x1, y1, x2, y2, rxBottom, ryBottom, rxTop, ryTop)

Description

Draws rectangle with rounded corners at defined coordinates.

Parameters

x1: double

X coordinate of rectangle's Top Left corner [in subpixels].

y1: double

Y coordinate of rectangle's Top Left corner [in subpixels].

x2: double

X coordinate of rectangle's Bottom Right corner [in subpixels].

y2: double

Y coordinate of rectangle's Bottom Right corner [in subpixels].

r: double

Uniform radius of arc for all rectangle corners [in subpixels].

rx: double

Width of the radius of arc for all rectangle corners [in subpixels].

ry: double

Height of the radius of arc for all rectangle corners [in subpixels].

rxBottom: double

Width of the radius of arc for bottom rectangle corners [in subpixels].

ryBottom: double

Height of the radius of arc for bottom rectangle corners [in subpixels].

rxTop: double

Width of the radius of arc for top rectangle corners [in subpixels].

ryTop: double

Height of the radius of arc for top rectangle corners [in subpixels].

Example

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

  VG.ClearAll(255, 255, 255);

  // Colors and line width
  VG.LineWidth(5);
  VG.LineColor($FF, $00, $00);
  VG.FillColor($00, $FF, $00);

  // Rounded rectangle 
  VG.RoundedRect(15, 15, ClientWidth - 15, ClientHeight - 15, 40, 30, 20, 10);

end;

Screenshot: example