TestClip

Graphics32

TestClip

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

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

Description

First version: Exchange A <-> B only if B < A, then restrict both to [0..Size-1] range. Returns true if resulting range has common points with [0..Size-1] range.

Second version: Exchange A <-> B only if B < A, then restrict both to [Start..Stop-1] range. Returns true if resulting range has common points with [Start..Stop-1] range.

See Also

Clamp, Constrain