clause method

  1. @override
CommandClause clause()
override

Implementation

@override
CommandClause clause() {
  var processer = Pbita(
    command: 'esc',
    compress: _compress,
    reverse: _reverse,
    gray: true
  );
  var info = processer.processWithBytes(Uint8List.fromList(_image));
  var fimage = info.result;
  if (fimage == null) {
    throw Exception('Wrong image data');
  }
  int width = fimage.width;
  int height = fimage.height;

  return BinaryCommand(header())
      .appendNumber((width % 256))
      .appendNumber(width ~/ 256)
      .appendNumber((height % 256))
      .appendNumber(height ~/ 256)
      .appendListInt(fimage.data)
      .clause();
}