setPixelRgba method
Set the color of the Pixel at the given coordinates to the given
color values r
, g
, b
, and a
.
Implementation
@override
void setPixelRgba(int x, int y, num r, num g, num b, num a) {
final index = y * width * numChannels + (x * numChannels);
data[index] = Float16.doubleToFloat16(r);
if (numChannels > 1) {
data[index + 1] = Float16.doubleToFloat16(g);
if (numChannels > 2) {
data[index + 2] = Float16.doubleToFloat16(b);
if (numChannels > 3) {
data[index + 3] = Float16.doubleToFloat16(a);
}
}
}
}