API / Core / Uint8clampedarray

Uint8ClampedArray

t

RESCRIPT
type t = Core__TypedArray.t<int>

The Uint8ClampedArray typed array represents an array of 8-bit unsigned integers clamped to 0-255. See Uint8ClampedArray on MDN

fromArray

RESCRIPT
let fromArray: array<int> => t

fromArray creates a Uint8ClampedArray from an array of values. See TypedArray constructor on MDN

fromBuffer

RESCRIPT
let fromBuffer: Core__ArrayBuffer.t => t

fromBuffer creates a Uint8ClampedArray from an ArrayBuffer.t. See TypedArray constructor on MDN

Note: This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds.

fromBufferToEnd

RESCRIPT
let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t

fromBufferToEnd creates a Uint8ClampedArray from an ArrayBuffer.t, starting at a particular offset and continuing through to the end. See TypedArray constructor on MDN

Note: This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds.

fromBufferWithRange

RESCRIPT
let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t

fromBufferWithRange creates a Uint8ClampedArray from an ArrayBuffer.t, starting at a particular offset and consuming length bytes. See TypedArray constructor on MDN

Note: This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds.

fromLength

RESCRIPT
let fromLength: int => t

fromLength creates a zero-initialized Uint8ClampedArray to hold the specified count of numbers; this is not a byte length. See TypedArray constructor on MDN

Note: This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds.

fromArrayLikeOrIterable

RESCRIPT
let fromArrayLikeOrIterable: 'a => t

fromArrayLikeOrIterable creates a Uint8ClampedArray from an array-like or iterable object. See TypedArray.from on MDN

fromArrayLikeOrIterableWithMap

RESCRIPT
let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t

fromArrayLikeOrIterableWithMap creates a Uint8ClampedArray from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See TypedArray.from on MDN