linearRgbAt method
Returns linear RGB for a point.
Coordinates are given in percent and must be between 0 and 1. Throws ArgumentError if the coordinates are out of range. ColorTriplet by default is in linear RGB color space. Convert to RGB before using the color. See ColorTripletExtensions.toRgb.
Implementation
ColorTriplet linearRgbAt(double x, double y) {
if (x < 0.0 || x > 1.0 || y < 0.0 || y > 1.0) {
throw ArgumentError('Coordinates must be between [0, 1].');
}
var sum = ColorTriplet(0, 0, 0);
for (var j = 0; j < numCompY; j++) {
for (var i = 0; i < numCompX; i++) {
sum += components[j][i] * cos(pi * i * x) * cos(pi * j * y);
}
}
return sum;
}