hueRotation function
Implementation
RGBA hueRotation(RGBA color, int degrees) {
double U = cos(degrees * pi / 180);
double W = sin(degrees * pi / 180);
num r = color.red, g = color.green, b = color.blue;
return new RGBA(
red: clampPixel(((.299 + .701 * U + .168 * W) * r +
(.587 - .587 * U + .330 * W) * g +
(.114 - .114 * U - .497 * W) * b)
.round()),
green: clampPixel(((.299 - .299 * U - .328 * W) * r +
(.587 + .413 * U + .035 * W) * g +
(.114 - .114 * U + .292 * W) * b)
.round()),
blue: clampPixel(((.299 - .3 * U + 1.25 * W) * r +
(.587 - .588 * U - 1.05 * W) * g +
(.114 + .886 * U - .203 * W) * b)
.round()),
alpha: color.alpha,
);
}