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

Wrap

Constrains a coordinate or scalar value to a range using modular wrap-around indexing.

Declarations ​

pascal
function Wrap(Value, Max: Integer): Integer; overload;
function Wrap(Value, Min, Max: Integer): Integer; overload;
function Wrap(Value, Max: Single): Single; overload;
Overload Details

Overload 1 ​

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

Wraps an integer value to closed range [0..Max].

ParameterTypeDescription
ValueIntegerInteger value to wrap.
MaxIntegerInclusive upper bound.
TypeDescription
IntegerWrapped integer within range [0..Max].

Overload 2 ​

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

Wraps an integer value to closed range [Min..Max].

ParameterTypeDescription
ValueIntegerInteger value to wrap.
MinIntegerInclusive lower bound.
MaxIntegerInclusive upper bound (Min <= Max).
TypeDescription
IntegerWrapped integer within range [Min..Max].

Overload 3 ​

pascal
function Wrap(Value, Max: Single): Single; overload;

Wraps a floating-point single value to half-open range [0..Max).

ParameterTypeDescription
ValueSingleFloating-point value to wrap.
MaxSingleExclusive upper bound.
TypeDescription
SingleWrapped floating-point value within range [0..Max).

Description ​

Wrap maps an arbitrary value into a periodic range using modular arithmetic wrap-around. It is commonly used for repeating textures, tileable bitmap sampling, and cyclical coordinate lookups.

See also ​