image static method
Implementation
static List<int> image(Uint8List imageData, int width, int mode) {
// Este es un ejemplo simplificado. La implementación real dependerá
// del formato específico de imagen y cómo la impresora lo procesa.
List<int> commands = [];
// Comando GS v 0 - Impresión de mapa de bits
commands.add(0x1D);
commands.add(0x76);
commands.add(0x30);
commands.add(mode); // Modo (0-3)
// Ancho en bytes (cada byte = 8 píxeles horizontales)
int widthBytes = (width + 7) ~/ 8;
commands.add(widthBytes & 0xFF);
commands.add((widthBytes >> 8) & 0xFF);
// Alto en píxeles
int height = imageData.length ~/ widthBytes;
commands.add(height & 0xFF);
commands.add((height >> 8) & 0xFF);
// Datos de la imagen
commands.addAll(imageData);
return commands;
}