startDecode method

  1. @override
DecodeInfo? startDecode(
  1. List<int> bytes
)
override

Start decoding the data as an animation sequence, but don't actually process the frames until they are requested with decodeFrame.

Implementation

@override
DecodeInfo? startDecode(List<int> bytes) {
  info = TgaInfo();
  input = InputBuffer(bytes, bigEndian: true);

  final header = input.readBytes(18);
  if (header[2] != 2) {
    return null;
  }
  if (header[16] != 24 && header[16] != 32) {
    return null;
  }

  info!.width = (header[12] & 0xff) | ((header[13] & 0xff) << 8);
  info!.height = (header[14] & 0xff) | ((header[15] & 0xff) << 8);
  info!.imageOffset = input.offset;
  info!.bpp = header[16];

  return info;
}