Skip to content
Member Filters
Show Inherited
Show Protected
Show abstract
GR32🞂TBitmap32🞂FillRectMethodPublic
Inherited from:TCustomBitmap32.FillRect

TBitmap32.FillRect

Fills a rectangular area with a specified 32-bit ARGB color using integer coordinates or TRect bounds, supporting optional boundary clipping and alpha blending.

Declaration ​

pascal
procedure FillRect(X1, Y1, X2, Y2: Integer; Value: TColor32);
procedure FillRectS(X1, Y1, X2, Y2: Integer; Value: TColor32); overload;
procedure FillRectS(const ARect: TRect; Value: TColor32); overload;
procedure FillRectT(X1, Y1, X2, Y2: Integer; Value: TColor32);
procedure FillRectTS(X1, Y1, X2, Y2: Integer; Value: TColor32); overload;
procedure FillRectTS(const ARect: TRect; Value: TColor32); overload;

Parameters ​

ParameterTypeDescription
X1, Y1, X2, Y2IntegerRectangle corner coordinates.
ARectTRectTarget TRect.
ValueTColor3232-bit ARGB color.

Description ​

The FillRect methods fill a rectangular region bounded by coordinates (X1, Y1, X2, Y2) or a TRect record ARect with a 32-bit ARGB color Value.

Method variants provide combinations of direct unclipped memory fill (FillRect), boundary clipping against ClipRect (S), and alpha blending (T).

Note

By convention, FillRect includes the left and top borders, but excludes the right and bottom borders of the rectangle.

This means that if X1 >= X2 or Y1 >= Y2, then nothing is drawn.

See also: Why are RECTs endpoint-exclusive? - The Old New Thing

Variants ​

VariantCoordinate / BoundsModifiersDescription
FillRect(X1, Y1, X2, Y2)DirectFast direct fill without boundary clipping or alpha blending. Coordinates must be within bitmap bounds.
FillRectS(X1, Y1, X2, Y2) or TRectSafeFills rectangle clipped against ClipRect.
FillRectT(X1, Y1, X2, Y2)TransparentFills rectangle with alpha blending using DrawMode / CombineMode. Unclipped.
FillRectTS(X1, Y1, X2, Y2) or TRectTransparent + SafeFills rectangle clipped against ClipRect with alpha blending using DrawMode / CombineMode.

Example ​

pascal
// Direct unclipped solid fill
Bitmap.FillRect(0, 0, 100, 100, clRed32);

// Clipped alpha-blended fill
var r := Rect(20, 20, 150, 150);
Bitmap.FillRectTS(r, clTrBlue32);

See also ​