Skip to content
Member Filters
Show Inherited
Show Protected
Show abstract
GR32🞂TCustomBitmap32🞂FrameRectMethodPublic

TCustomBitmap32.FrameRect

Draws 1-pixel wide rectangular outline frames around specified coordinates or TRect bounds with optional clipping, alpha blending, and stippling.

Declaration ​

pascal
procedure FrameRectS(X1, Y1, X2, Y2: Integer; Value: TColor32); overload;
procedure FrameRectS(const ARect: TRect; Value: TColor32); overload;
procedure FrameRectTS(X1, Y1, X2, Y2: Integer; Value: TColor32); overload;
procedure FrameRectTS(const ARect: TRect; Value: TColor32); overload;
procedure FrameRectTSP(X1, Y1, X2, Y2: Integer);

Parameters ​

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

Description ​

The FrameRect methods draw a 1-pixel wide rectangular outline frame around a bounding box specified by coordinates (X1, Y1, X2, Y2) or a TRect record ARect.

Method variants provide boundary clipping against ClipRect (S), alpha blending (T), and pattern stippling (P).

Note

By convention, FrameRect 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
FrameRectS(X1, Y1, X2, Y2) or TRectSafeDraws a 1-pixel clipped rectangular frame using color Value.
FrameRectTS(X1, Y1, X2, Y2) or TRectTransparent + SafeDraws a 1-pixel clipped rectangular frame with alpha blending using DrawMode / CombineMode.
FrameRectTSP(X1, Y1, X2, Y2)Transparent + Safe + StippleDraws a 1-pixel clipped alpha-blended rectangular frame using the active stipple pattern.

Example ​

pascal
// Clipped 1-pixel outline frame
Bitmap.FrameRectS(10, 10, 100, 100, clBlack32);

// Alpha-blended frame using TRect
var r := Rect(20, 20, 150, 150);
Bitmap.FrameRectTS(r, clTrRed32);

See also ​