From: Kevin Lamonte Date: Fri, 30 Aug 2019 22:59:30 +0000 (-0500) Subject: #57 add raster information X-Git-Tag: fanfix-3.0.1^2~34 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=741b75d7dda9ab4078bdaf273f45cab45b948670;p=fanfix.git #57 add raster information --- 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());