toFloatRgba method

Float32List toFloatRgba()

Convert the framebuffer to an floating-point image, as a sequence of floats in RGBA order.

Implementation

Float32List toFloatRgba() {
  final rgba = Float32List(width * height * 4);
  final w = width;
  final h = height;
  for (var y = 0, di = 0; y < h; ++y) {
    for (var x = 0; x < w; ++x) {
      rgba[di++] = red == null ? 0.0 : red!.getFloat(x, y);
      rgba[di++] = green == null ? 0.0 : green!.getFloat(x, y);
      rgba[di++] = blue == null ? 0.0 : blue!.getFloat(x, y);
      rgba[di++] = alpha == null ? 1.0 : alpha!.getFloat(x, y);
    }
  }

  return rgba;
}