about summary refs log tree commit diff stats
path: root/src/io/bufwriter.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-04-25 01:06:43 +0200
committerbptato <nincsnevem662@gmail.com>2024-04-25 01:20:58 +0200
commit14b871eb7eaf329b67b71385597f114f8782318a (patch)
treeac7b4655124b4579ad27d56116d9a2dee63cd31e /src/io/bufwriter.nim
parent62944ac7abc6e37475739a1667ed5a0240fedf66 (diff)
downloadchawan-14b871eb7eaf329b67b71385597f114f8782318a.tar.gz
Initial image support
* png: add missing filters, various decoder fixes
* term: fix kitty response interpretation, add support for kitty image
  detection
* buffer, pager: initial image display support

Emphasis on "initial"; it only "works" with kitty output and PNG input.
Also, it's excruciatingly slow, and repaints images way too often.

Left undocumented intentionally it for now, until it actually becomes
useful.  In the meantime, adventurous users can find out themselves why:

[[siteconf]]
url = "https://.*"
images = true
Diffstat (limited to 'src/io/bufwriter.nim')
-rw-r--r--src/io/bufwriter.nim8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/io/bufwriter.nim b/src/io/bufwriter.nim
index 75da4190..0957d3e8 100644
--- a/src/io/bufwriter.nim
+++ b/src/io/bufwriter.nim
@@ -6,11 +6,11 @@ import std/sets
 import std/tables
 
 import io/dynstream
-
 import types/blob
+import types/color
 import types/formdata
-import types/url
 import types/opt
+import types/url
 
 type BufferedWriter* = object
   stream: DynStream
@@ -77,6 +77,7 @@ proc swrite*(writer: var BufferedWriter; part: FormDataEntry)
 proc swrite*(writer: var BufferedWriter; blob: Blob)
 proc swrite*[T](writer: var BufferedWriter; o: Option[T])
 proc swrite*[T, E](writer: var BufferedWriter; o: Result[T, E])
+proc swrite*(writer: var BufferedWriter; c: RGBAColor) {.inline.}
 
 proc writeData(writer: var BufferedWriter; buffer: pointer; len: int) =
   let targetLen = writer.bufLen + len
@@ -181,3 +182,6 @@ proc swrite*[T, E](writer: var BufferedWriter; o: Result[T, E]) =
   else:
     when not (E is void):
       writer.swrite(o.error)
+
+proc swrite*(writer: var BufferedWriter; c: RGBAColor) =
+  writer.swrite(uint32(c))