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

Clamp

Clamps an integer value to a specified range.

Declarations ​

pascal
function Clamp(const Value: Integer): Integer; overload;
function Clamp(Value, Max: Integer): Integer; overload;
function Clamp(Value, Min, Max: Integer): Integer; overload;
Overload Details

Overload 1 ​

pascal
function Clamp(const Value: Integer): Integer; overload;

Clamps an integer value to byte range [0..255].

ParameterTypeDescription
ValueIntegerInteger value to clamp.
TypeDescription
IntegerValue clamped to range [0..255].

Overload 2 ​

pascal
function Clamp(Value, Max: Integer): Integer; overload;

Clamps an integer value to range [0..Max].

ParameterTypeDescription
ValueIntegerInteger value to clamp.
MaxIntegerMaximum upper boundary.
TypeDescription
IntegerValue clamped to range [0..Max].

Overload 3 ​

pascal
function Clamp(Value, Min, Max: Integer): Integer; overload;

Clamps an integer value to range [Min..Max].

ParameterTypeDescription
ValueIntegerInteger value to clamp.
MinIntegerMinimum lower boundary.
MaxIntegerMaximum upper boundary.
TypeDescription
IntegerValue clamped to range [Min..Max].

Description ​

Clamp restricts an integer value to fit within a specified range.

  • The single-parameter overload Clamp(Value) clamps to byte channel range [0..255].
  • The two-parameter overload Clamp(Value, Max) clamps to [0..Max].
  • The three-parameter overload Clamp(Value, Min, Max) clamps to [Min..Max].

See also ​