renderToRawImageData method
Renders the skeleton drawable's current pose to a RawImageData
, with the given width
and height
.
Uses bgColor
, a 32-bit ARGB color value, to paint the background.
Scales and centers the skeleton to fit the within the bounds of width
and height
.
Implementation
Future<RawImageData> renderToRawImageData(double width, double height, int bgColor) async {
final recorder = renderToPictureRecorder(width, height, bgColor);
var rawImageData =
(await (await recorder.endRecording().toImage(width.toInt(), height.toInt())).toByteData(format: ImageByteFormat.rawRgba))!
.buffer
.asUint8List();
return RawImageData(rawImageData, width.toInt(), height.toInt());
}