build method

Uint8List build()

FWSヘッダ + 蓄積したタグ列 + Endタグ。

Implementation

Uint8List build() {
  final widthTwips = widthPx * _twipsPerPixel;
  final heightTwips = heightPx * _twipsPerPixel;

  final headerBw = BitWriter();
  _writeRect(headerBw, 0, widthTwips, 0, heightTwips);
  headerBw.writeUI16((frameRate * 256).round());
  headerBw.writeUI16(_frameCount);

  final body = <int>[
    ...headerBw.toBytes(),
    ..._tagBytes,
    ..._endTagBytes,
  ];

  final fileBw = BitWriter();
  fileBw.writeBytes('FWS'.codeUnits);
  fileBw.writeUI8(version);
  fileBw.writeUI32(8 + body.length);
  fileBw.writeBytes(body);
  return fileBw.toBytes();
}