pack method
Corresponding parser should be called from frame_app data handler
Implementation
@override
Uint8List pack() {
if (_spriteLines.isEmpty) {
throw Exception('_spriteLines is empty: no image to pack()');
}
// pack the width and height of the image (Uint16 each)
int widthMsb = width >> 8;
int widthLsb = width & 0xFF;
int heightMsb = height >> 8;
int heightLsb = height & 0xFF;
// store the spriteLineHeight (Uint16)
int spriteLineHeightMsb = spriteLineHeight >> 8;
int spriteLineHeightLsb = spriteLineHeight & 0xFF;
// special marker for Block header 0xFF, width and height of the block, spriteLineHeight, progressive rendering flag, updatable flag
return Uint8List.fromList([
0xFF,
widthMsb,
widthLsb,
heightMsb,
heightLsb,
spriteLineHeightMsb,
spriteLineHeightLsb,
_progressiveRender ? 1 : 0,
_updatable ? 1 : 0,
]);
}