read static method
Implementation
static IcoInfo? read(InputBuffer input) {
if (input.readUint16() != 0) {
return null;
}
final t = input.readUint16();
if (t >= IcoType.values.length) {
return null;
}
final type = IcoType.values[t];
if (type == IcoType.cur) {
// CUR format not yet supported.
return null;
}
final imageCount = input.readUint16();
final images = List<IcoInfoImage>.generate(
imageCount,
(e) => IcoInfoImage(
width: input.readByte(),
height: input.readByte(),
colorPalette: input.readByte(),
// ignore 1 byte
colorPlanes: (input..skip(1)).readUint16(),
bitsPerPixel: input.readUint16(),
bytesSize: input.readUint32(),
bytesOffset: input.readUint32(),
));
return IcoInfo(type: type, numFrames: imageCount, images: images);
}