[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Graphics' (#lcl)

TCanvas.GradientFill

Fills a rectangle with a color gradient using the specified colors in a given direction.

Declaration

Source position: graphics.pp line 1136

public procedure TCanvas.GradientFill(

  ARect: TRect;

  AStart: TColor;

  AStop: TColor;

  ADirection: TGradientDirection

);

Arguments

ARect

  

TRect instance with the bounds for the rectangle.

AStart

  

TColor value used at the start of the color gradient.

AStop

  

TColor value used at the end of the color gradient.

ADirection

  

Direction for the color gradient.

Description

GradientFill fills the area inside the specified rectangle using a color gradient with the specified start and stop colors.

No actions are performed in the method when ARect has no discernible area; both the calculated height and width for the rectangle are 0 or a negative number.

The direction for the color gradient is specified in the ADirection argument. gdVertical causes the color variations to be drawn from top to bottom in the rectangle starting with the color in AStart and ending with the color in AStop. gdHorizontal causes the color variations to be draw from left to right in the rectangle, also starting with the color in AStart and ending with the color in AStop.

GradientFill decomposes color values in AStart and AStop into their Red, Green, and Blue component values. The differences between the byte values are varied evenly in the color gradient, and drawn as colored lines oriented in the direction opposite to the color gradient. The color setting in Pen is updated, and LineTo is used to draw the number of 1 pixel lines available in the gradient direction.

Please note that the settings in Pen are not stored on entry, or restored prior to exiting from the method. The Pen color will contain the color in AStop on exit.

Use FloodFill to fill a rectangular area bounded by or filled with a specified color value. Use FillRect to fill a rectangular area with the Brush for the canvas.

See also

TCanvas.Pen

  

The Pen to be used for writing in this canvas.

TCanvas.FloodFill

  

Fills an area at the specified coordinates with the current Brush for the canvas.

TCanvas.FillRect

  

Fills a rectangular area on the canvas using the current Brush settings.

TCanvas.Rectangle

  

Draws a Rectangle with the specified coordinates.

TGradientDirection

  

Represents fill directions for gradients.


Version 3.2 Generated 2024-02-25 Home