about summary refs log tree commit diff stats
path: root/src/img
Commit message (Collapse)AuthorAgeFilesLines
* Refactor img/*bptato2024-09-153-648/+0
| | | | | I've moved most image logic to adapter, so it doesn't really make sense to have this subdir anymore.
* utils: add twtunibptato2024-09-081-3/+3
| | | | | | | | | | | | | | | | | | | std/unicode has the following issues: * Rune is an int32, which implies overflow checking. Also, it is distinct, so you have to convert it manually to do arithmetic. * QJS libunicode and Chagashi work with uint32, interfacing with these required pointless type conversions. * fastRuneAt is a template, meaning it's pasted into every call site. Also, it decodes to UCS-4, so it generates two branches that aren't even used. Overall this lead to quite some code bloat. * fastRuneAt and lastRune have frustratingly different interfaces. Writing code to handle both cases is error prone. * On older Nim versions which we still support, std/unicode takes strings, not openArray[char]'s. Replace it with "twtuni", which includes some improved versions of the few procedures from std/unicode that we actually use.
* canvas: make sure we don't link to QJSbptato2024-09-012-33/+25
|
* path: fix swap bug, refactor linesbptato2024-09-011-15/+19
|
* canvas: move to separate CGI scriptbptato2024-09-013-68/+62
| | | | | | | | | | * stream: and passFd is now client-based, and accessible for buffers * Bitmap's width & height is now int, not uint64 * no more non-network Bitmap special case in the pager for canvas I just shoehorned it into the static image model, so it still doesn't render changes after page load. But at least now it doesn't crash the browser.
* Fixes for Nim 2.2bptato2024-07-291-6/+10
| | | | | | | | | * xmlhttprequest: fix missing import * painter: generic tuple workaround * dynstream: merge module with implementations (so it will work with vtables) Not enabling vtables yet since it doesn't work with refc.
* img, loader: add image resizing, misc fixesbptato2024-06-281-1/+2
| | | | | | | | | | | | | | | * resize images with stb_image_resize * use tee for output handle redirection (redirectToFile blocks) * cache original image files * accept lseek in sandbox * misc stbi fixes For now, I just pulled in stb_image_resize v1. v2 is an extra 150K in size, not sure if it's worth the cost. (Either way, we can always switch later if needed, since the API is almost the same.) Next step: move sixel/kitty encoders to CGI, and cache their output in memory instead of the intermediate RGBA representation.
* img: use stb_image, drop zlib as dependencybptato2024-06-202-9/+15
| | | | | | | Now we have decoders for gif, jpeg, bmp. Also, the in-house PNG decoder has been replaced in favor of the stbi implementation; this means we no longer depend on zlib, since stbi comes with a built in inflate implementation.
* img, loader: separate out png codec into cgi, misc improvementsbptato2024-06-203-512/+6
| | | | | | | | | | | | | | | * multi-processed and sandboxed PNG decoding & encoding (through local CGI) * improved request body passing (including support for output id as response body) * simplified & faster blob()/text() - now every request starts suspended, and OngoingData.buf has been replaced with loader's buffering capability * image caching: we no longer pull bitmaps from the container after every single getLines call Next steps: replace our bespoke PNG decoder with something more usable, add other decoders, and make them stream.
* css/values -> css/cssvaluesbptato2024-05-161-1/+1
| | | | for consistency
* img: rename SEGMENT_*bptato2024-05-091-16/+15
|
* png: fix check in readU8bptato2024-04-271-1/+1
| | | | i + 1 must be > reader.limit, so >= is needed to avoid the addition
* png: fix indexed color with tRNSbptato2024-04-271-5/+7
|
* color: RGBAColor -> ARGBColorbptato2024-04-263-21/+21
|
* Remove unnecessary unsigned castsbptato2024-04-261-16/+16
| | | | | Unsigned operations and conversions to unsigned types always wrap/narrow without checks, so no need to manually mask/cast/etc. them.
* png: fix off by onebptato2024-04-251-3/+1
| | | | + remove outdated comment
* Initial image supportbptato2024-04-251-18/+49
| | | | | | | | | | | | | | | | | * 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
* Update code stylebptato2024-04-174-102/+102
| | | | | | * separate params with ; (semicolon) instead of , (colon) * reduce screaming snake case use * wrap long lines
* Remove unnecessary std/math importsbptato2024-04-081-5/+3
|
* Allow non-RGB colors in CSSbptato2024-02-241-1/+1
| | | | | | | | | | | The -cha-ansi color type now sets ANSI colors in CSS. Also, color correction etc. has been improved a bit: * don't completely reset output state in processFormat for new colors * defaultColor is now separated from ANSI color type 0 * bright ANSI colors are no longer replaced with bold + dark variant * replaced ANSI color map to match xterm defaults
* Use errDOMException template everywherebptato2024-01-111-6/+6
|
* Use std/* imports everywherebptato2024-01-073-6/+6
|
* Compile with styleCheck:usagesbptato2023-12-281-2/+2
| | | | much better
* warn on eprint in release modebptato2023-10-211-1/+2
| | | | Maybe it's easier to avoid accidentally including like this
* move around more modulesbptato2023-09-141-1/+1
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* path: remove ellipseLinesbptato2023-08-281-26/+0
| | | | | | | It was unused. (Or more precisely, indefinitely not implemented. TODO: implement it one day.)
* javascript: refactorbptato2023-08-281-1/+1
| | | | | | | Split out parts of the JS module, because it was starting to confuse the compiler a little. (Peakmem is back at 750M. Interesting.)
* png: print zstream errorsbptato2023-07-041-1/+5
|
* painter: fix off by one error in getCharBmpbptato2023-07-041-2/+2
|
* png: fix grayscale regressionbptato2023-06-291-1/+1
| | | | it's 0x1, not 0x11. oops
* Move CanvasFillRule from bitmap to painterbptato2023-06-262-4/+4
|
* png: fix 4 bit grayscale & <8 bit indexed colorbptato2023-06-251-6/+17
|
* Get rid of the .jserr pragmabptato2023-06-191-12/+17
|
* Make Result.text, json return promisebptato2023-06-131-1/+0
|
* Fix various layout bugs, prepare for image supportbptato2023-06-121-3/+3
|
* Add indexed color, other png improvementsbptato2023-06-091-22/+71
|
* Refactor bitmap, add png color modesbptato2023-06-063-591/+623
| | | | | Now PNG encoding/decoding, painting, etc. are done in separate files. Plus we support all color modes except indexed color.
* Fix stupid overflowbptato2023-06-051-3/+3
|
* Fix 16bit grayscale bugbptato2023-06-051-1/+1
|
* Add support for canvas and multipartbptato2023-06-052-0/+1050
Quite incomplete canvas implementation. Crucially, the layout engine can't do much with whatever is drawn because it doesn't support images yet. I've re-introduced multipart as well, with the FormData API. For the append function I've also introduced a hack to the JS binding generator that allows requesting the JSContext pointer in nim procs. Really I should just fix the union generator thing and add support for overloading. In conclusion, for now the only thing canvas can be used for is exporting it as PNG and uploading it somewhere. Also, we now have PNG encoding and decoding too. (Now if only we had sixels as well...)