toFloatRgba method
- int pixel
override
Converts a pixel in this
pixel format to the floatRgba pixel format.
FLOAT_RGBA is used as the canonical floating-point pixel format, and this
method guarantees that all pixel formats can be converted to it. Loss of
precision may occur when this
pixel format has higher precision.
Example
print(floatRgba.toFloatRgba(abgr8888.red)); // [1.0, 0.0, 0.0, 1.0]
print(floatRgba.toFloatRgba(abgr8888.white)); // [1.0, 1.0, 1.0, 1.0]
Implementation
@override
Float32x4 toFloatRgba(int pixel) {
final g = getGray(pixel) / 255.0;
return Float32x4(g, g, g, 1.0);
}