sepia function

RGBA sepia (RGBA color, num adj)

Implementation

RGBA sepia(RGBA color, num adj) {
  int r = color.red, g = color.green, b = color.blue;
  return new RGBA(
      red: clampPixel(
          ((r * (1 - (0.607 * adj))) + (g * .769 * adj) + (b * .189 * adj))
              .round()),
      green: clampPixel(
          ((r * .349 * adj) + (g * (1 - (0.314 * adj))) + (b * .168 * adj))
              .round()),
      blue: clampPixel(
          ((r * .272 * adj) + (g * .534 * adj) + (b * (1 - (0.869 * adj))))
              .round()),
      alpha: color.alpha);
}