"Clamping" means that values below 0 become 0 and values above 0xff become 0xff when stored into the Uint8ClampedList
. Any value in the range 0..0xff can be stored into the list without change.
This differs from other typed lists where the value is instead just truncated to the low 8 (or 16 or 32) bits.
The clamped list (and the name itself) mirrors the Uint8ClampedArray of JavaScript.
One usage of clamping that I have seen is for RGB(A) color images, where really over-saturated colors (e.g., and R value > 255) would be capped at the maximum value instead of wrapping around and becoming dark. It allows you to make some transformations on the values without having to care about handling overflow. See the Uint8ClampedArray specification - it was introduced to have an array type matching the behavior of an existing canvas type.