draw method
Draws this drawable into screen within area.
Implementation
@override
void draw(Screen screen, Rectangle area) {
final cols = columns ?? area.width;
final rws = rows ?? area.height;
if (cols <= 0 || rws <= 0) return;
final sequence = KittyImage.encode(
image,
id: id,
columns: cols,
rows: rws,
quiet: quiet,
);
// Place the escape sequence in the top-left cell of the area.
// Mark all other cells in the area as "occupied" (width 0, empty content)
// so the renderer doesn't overwrite them with normal cell output.
for (var y = area.minY; y < area.minY + rws && y < area.maxY; y++) {
for (var x = area.minX; x < area.minX + cols && x < area.maxX; x++) {
if (x == area.minX && y == area.minY) {
screen.setCell(x, y, Cell(content: sequence, width: 1));
} else {
// Mark as occupied. Width 0 means it doesn't advance the cursor.
screen.setCell(x, y, Cell(content: '', width: 0));
}
}
}
}