decodeFrame method
Decode a single frame from the data that was set with startDecode.
If frame
is out of the range of available frames, null is returned.
Non animated image files will only have frame
0. An Image
is returned, which provides the image, and top-left coordinates of the
image, as animated frames may only occupy a subset of the canvas.
Implementation
@override
Image? decodeFrame(int frame) {
if (_info == null || _data == null) {
return null;
}
if (_info is PvrAppleInfo) {
return _decodeRgba4bpp(_info!.width, _info!.height, _data!);
} else if (_info is Pvr2Info) {
return _decodePvr2(_data!);
} else if (_info is Pvr3Info) {
return _decodePvr3(_data!);
}
return null;
}