AggPas - Anti-Grain Geomertry for Object Pascal

TAgg2D.FillRadialGradient(x, y, r, c1, c2, c3)

Description

Radial fill gradient produces equally proportioned circles of colors increasing from the origin to the outer bound.

Gradient's origin (center point) is defined by the x:y couple and the extent of the gradient is defined with radius r.

This gradient variant has a transition consisting of three colors equally distributed from the center point to the outer circle bound.

Radial fill gradient is consequently used to fill interior of objects being drawn. If there is a need to get the filling beyond gradient radius boundary, the c3 color is used as a solid color fill.

Parameters

x: double

X coordinate of gradient center point [in subpixels].

y: double

Y coordinate of gradient center point [in subpixels].

r: double

Radius of gradient outer bound circle [in subpixels].

c1: TAggColor [*]

First color of the gradient ramp used at center point
[data sructure (r, g, b, a)].

c2: TAggColor [*]

Second color of the gradient ramp used at middle
[data sructure (r, g, b, a)].

c3: TAggColor [*]

Last color of the gradient ramp used at gradient circle bound
[data sructure (r, g, b, a)].

Example

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

  VG.ClearAll(255, 255, 255);

  // Gradient colors Blue - Green - Red
  c1.Construct($00, $00, $FF);
  c2.Construct($00, $FF, $00);
  c3.Construct($FF, $00, $00);

  // Gradient proceeds from center point
  // (ClientWidth / 2:ClientHeight / 2)
  // with extent of (ClientWidth - 30) / 2
  VG.FillRadialGradient(ClientWidth / 2, ClientHeight / 2, 
   (ClientWidth - 30) / 2, c1, c2, c3);

  // Circle
  VG.Ellipse(ClientWidth / 2, ClientHeight / 2, 
   (ClientWidth - 30) / 2, (ClientWidth - 30) / 2);

end;

Screenshot: example