brightness function

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

Implementation

void brightness(Uint8List bytes, num adj) {
  adj = (adj > 1) ? 1 : adj;
  adj = (adj < -1) ? -1 : adj;
  adj = ~~(255 * adj).round();
  for (int i = 0; i < bytes.length; i += 4) {
    bytes[i] = clampPixel(bytes[i] + (adj as int));
    bytes[i + 1] = clampPixel(bytes[i + 1] + adj);
    bytes[i + 2] = clampPixel(bytes[i + 2] + adj);
  }
}