hueSaturation function

void hueSaturation(
  1. Uint8List bytes,
  2. num adj
)

Implementation

void hueSaturation(Uint8List bytes, num adj) {
  for (int i = 0; i < bytes.length; i += 4) {
    var hsv = rgbToHsv(bytes[i], bytes[i + 1], bytes[i + 2]);
    hsv[1] = (hsv[1] ?? 0) * adj;
    var rgb = hsvToRgb(hsv[0]!, hsv[1]!, hsv[2]!);
    bytes[i] = clampPixel(rgb[0] as int);
    bytes[i + 1] = clampPixel(rgb[1] as int);
    bytes[i + 2] = clampPixel(rgb[2] as int);
  }
}