about summary refs log tree commit diff stats
path: root/src/img/bitmap.nim
Commit message (Collapse)AuthorAgeFilesLines
* 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-201-8/+14
| | | | | | | 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-201-1/+5
| | | | | | | | | | | | | | | * 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.
* color: RGBAColor -> ARGBColorbptato2024-04-261-5/+5
|
* Update code stylebptato2024-04-171-3/+3
| | | | | | * separate params with ; (semicolon) instead of , (colon) * reduce screaming snake case use * wrap long lines
* Move CanvasFillRule from bitmap to painterbptato2023-06-261-4/+0
|
* Refactor bitmap, add png color modesbptato2023-06-061-591/+3
| | | | | 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-051-0/+620
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...)