GifImageDesc constructor

GifImageDesc(
  1. InputBuffer input
)

Implementation

GifImageDesc(InputBuffer input) {
  x = input.readUint16();
  y = input.readUint16();
  width = input.readUint16();
  height = input.readUint16();

  final b = input.readByte();

  final bitsPerPixel = (b & 0x07) + 1;

  interlaced = (b & 0x40) != 0;

  if (b & 0x80 != 0) {
    colorMap = GifColorMap(1 << bitsPerPixel);

    for (var i = 0; i < colorMap!.numColors; ++i) {
      colorMap!
          .setColor(i, input.readByte(), input.readByte(), input.readByte());
    }
  }

  _inputPosition = input.position;
}