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) {
return Float32x4(
getRed(pixel) / 255.0,
getGreen(pixel) / 255.0,
getBlue(pixel) / 255.0,
1.0,
);
}