rlReadTexturePixels method

Uint8List rlReadTexturePixels(
  1. num id,
  2. num width,
  3. num height,
  4. RlPixelFormat format,
)

Implementation

Uint8List rlReadTexturePixels(
  num id,
  num width,
  num height,
  RlPixelFormat format,
) => run(
  () => 'rlReadTexturePixels($id, $width, $height, ${format.name})',
  () {
    final size = rlGetPixelDataSize(
      width.toInt(),
      height.toInt(),
      format,
    );
    final pixels = rl.Rlgl.rlReadTexturePixels(
      id.toInt(),
      width.toInt(),
      height.toInt(),
      format.value,
    );
    return pixels.cast<Uint8>().asTypedList(size);
  },
);