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].
| Parameter | Type | Description |
|---|---|---|
Value | Integer | Integer value to wrap. |
Max | Integer | Inclusive upper bound. |
| Type | Description |
|---|---|
Integer | Wrapped 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].
| Parameter | Type | Description |
|---|---|---|
Value | Integer | Integer value to wrap. |
Min | Integer | Inclusive lower bound. |
Max | Integer | Inclusive upper bound (Min <= Max). |
| Type | Description |
|---|---|
Integer | Wrapped 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).
| Parameter | Type | Description |
|---|---|---|
Value | Single | Floating-point value to wrap. |
Max | Single | Exclusive upper bound. |
| Type | Description |
|---|---|
Single | Wrapped 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.