sepia function

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

Implementation

void sepia(Uint8List bytes, num adj) {
  for (int i = 0; i < bytes.length; i += 4) {
    int r = bytes[i], g = bytes[i + 1], b = bytes[i + 2];
    bytes[i] = clampPixel(
        ((r * (1 - (0.607 * adj))) + (g * .769 * adj) + (b * .189 * adj))
            .round());
    bytes[i + 1] = clampPixel(
        ((r * .349 * adj) + (g * (1 - (0.314 * adj))) + (b * .168 * adj))
            .round());
    bytes[i + 2] = clampPixel(
        ((r * .272 * adj) + (g * .534 * adj) + (b * (1 - (0.869 * adj))))
            .round());
  }
}