git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
#57 add raster information
[fanfix.git]
/
src
/
jexer
/
backend
/
ECMA48Terminal.java
diff --git
a/src/jexer/backend/ECMA48Terminal.java
b/src/jexer/backend/ECMA48Terminal.java
index 9884835591adba9cfa57530cca3759ee8fb6404e..75c4ce407e4b05e9bcade8af846da8b9bbb6f426 100644
(file)
--- 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);
}
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];
// 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;
}
data += 32;
break;
}
+ if ((currentRow + j + 1) > rasterHeight) {
+ rasterHeight = currentRow + j + 1;
+ }
}
}
assert (data >= 0);
}
}
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);
// 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());
if (saveInCache) {
// This row is OK to save into the cache.
sixelCache.put(cells, sb.toString());