brightness function

void brightness (Uint8List bytes, 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);
    bytes[i + 1] = clampPixel(bytes[i + 1] + adj);
    bytes[i + 2] = clampPixel(bytes[i + 2] + adj);
  }
}