clamp abstract method

P clamp(
  1. P pixel
)

Clamps a pixel to the valid range of values for the pixel format.

The operation does not have a canonical meaning; the only guarantee is that for a given pixel format, the result will be a valid pixel and will be idempotent and always return the same result for the same input.

Example

print(abgr8888.clamp(-1)); // 0xFFFFFFFF
print(floatRgba.clamp(Float32x4(2.0, 2.0, 2.0, 2.0))); // [1.0, 1.0, 1.0, 1.0]

Implementation

P clamp(P pixel);