isValidFile method

  1. @override
bool isValidFile(
  1. List<int> data
)
override

Is the given file a valid TGA image?

Implementation

@override
bool isValidFile(List<int> data) {
  final input = InputBuffer(data, bigEndian: true);

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

  return true;
}