about summary refs log tree commit diff stats
path: root/adapter/img
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-09-28 18:17:25 +0200
committerbptato <nincsnevem662@gmail.com>2024-09-28 18:24:54 +0200
commitbe86473ba4e39bafcf92b4c9f52e7fb2df767719 (patch)
treebf3b745f0a6038d034e2694d073d5b977e007539 /adapter/img
parent1dea3e9fbe4a902db6325195df0d7a465f82cfc5 (diff)
downloadchawan-be86473ba4e39bafcf92b4c9f52e7fb2df767719.tar.gz
loader: send headers for tocache requests too
This lets us send the transparency bit as a header, and also halves the
number of header parsers in loader.
Diffstat (limited to 'adapter/img')
-rw-r--r--adapter/img/sixel.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/adapter/img/sixel.nim b/adapter/img/sixel.nim
index 3552004b..11625547 100644
--- a/adapter/img/sixel.nim
+++ b/adapter/img/sixel.nim
@@ -376,11 +376,13 @@ proc encode(img: openArray[RGBAColorBE]; width, height, offx, offy, cropw: int;
   var transparent = false
   var root = img.quantize(palette, transparent)
   # prelude
-  var outs = "Cha-Image-Dimensions: " & $width & 'x' & $height & "\n\n"
+  var outs = "Cha-Image-Dimensions: " & $width & 'x' & $height & "\n"
+  if transparent:
+    outs &= "Cha-Image-Sixel-Transparent: 1\n"
+  outs &= '\n'
   let preludeLenPos = outs.len
   if halfdump: # reserve size for prelude
     outs &= "\0\0\0\0"
-    outs &= char(transparent)
   else:
     outs &= DCS & 'q'
     # set raster attributes