clamp method

  1. @override
Float32x4 clamp(
  1. Float32x4 pixel
)
override

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

@override
Float32x4 clamp(Float32x4 pixel) => pixel.clamp(zero, max);