unormLevel function
value, clamped to [0, 1], as the RGBA8 level a GPU stores for it:
round(value × 255), the product in f32 and ties to even.
Implementation
int unormLevel(double value) {
final clamped = value.isNaN ? 0.0 : value.clamp(0.0, 1.0);
return roundHalfEven(roundToF32(clamped * 255.0)).toInt();
}