Skip to content
Member Filters
Show Inherited
Show Protected
Show abstract
GR32_LowLevel🞂TestClipFunction

TestClip

Orders two range coordinates and clips them to a specified interval.

Declarations ​

pascal
function TestClip(var A, B: Integer; const Size: Integer): Boolean; overload;
function TestClip(var A, B: Integer; const Start, Stop: Integer): Boolean; overload;
Overload Details

Overload 1 ​

pascal
function TestClip(var A, B: Integer; const Size: Integer): Boolean; overload;

Orders A and B, then clips them to interval [0..Size-1].

ParameterTypeDescription
A, BIntegerVariables to order and clip to range [0..Size-1].
SizeIntegerUpper size constraint (defines interval [0..Size-1]).
TypeDescription
BooleanReturns True if the clipped range overlaps with [0..Size-1]; False otherwise.

Overload 2 ​

pascal
function TestClip(var A, B: Integer; const Start, Stop: Integer): Boolean; overload;

Orders A and B, then clips them to interval [Start..Stop].

ParameterTypeDescription
A, BIntegerVariables to order and clip to range [Start..Stop].
StartIntegerStart boundary of interval.
StopIntegerStop boundary of interval.
TypeDescription
BooleanReturns True if the clipped range overlaps with [Start..Stop]; False otherwise.

Description ​

TestClip first ensures A <= B (swapping them if necessary using TestSwap), and then clips both A and B to fit within the specified bounds ([0..Size-1] or [Start..Stop]).

It returns True if the resulting interval [A..B] has common points with the target bounding range, or False if the range lies entirely outside.

See also ​