From 741b75d7dda9ab4078bdaf273f45cab45b948670 Mon Sep 17 00:00:00 2001 From: Kevin Lamonte Date: Fri, 30 Aug 2019 17:59:30 -0500 Subject: [PATCH] #57 add raster information --- src/jexer/backend/ECMA48Terminal.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/jexer/backend/ECMA48Terminal.java b/src/jexer/backend/ECMA48Terminal.java index 9884835..75c4ce4 100644 --- a/src/jexer/backend/ECMA48Terminal.java +++ b/src/jexer/backend/ECMA48Terminal.java @@ -3083,6 +3083,10 @@ public class ECMA48Terminal extends LogicalScreen } image = palette.ditherImage(image); + // Collect the raster information + int rasterHeight = 0; + int rasterWidth = image.getWidth(); + // Emit the palette, but only for the colors actually used by these // cells. boolean [] usedColors = new boolean[sixelPaletteSize]; @@ -3159,6 +3163,9 @@ public class ECMA48Terminal extends LogicalScreen data += 32; break; } + if ((currentRow + j + 1) > rasterHeight) { + rasterHeight = currentRow + j + 1; + } } } assert (data >= 0); @@ -3198,6 +3205,9 @@ public class ECMA48Terminal extends LogicalScreen // Kill the very last "-", because it is unnecessary. sb.deleteCharAt(sb.length() - 1); + // Add the raster information + sb.insert(0, String.format("\"1;1;%d;%d", rasterWidth, rasterHeight)); + if (saveInCache) { // This row is OK to save into the cache. sixelCache.put(cells, sb.toString()); -- 2.27.0