interactive 2D vector graphics protocol

ctx is an interactive 2D vector graphics protocol, providing remote backends and process multiplexing integrated with a terminal emulator/window manager; providing an end-to-end vector rendering framework suitable for serial links. It aims for rendering quality and performance with minimal footprint and resource usage, suitable for bare-metal use on 32bit microcontrollers without additional dependencies and scaling to handling PDF, floating point buffer, CMYK and multi-threaded rendering.

The ctx rasterizer is fast, portable and compact with a wide range of supported pixel encodings from 1bit to 32bit per pixel, in grayscale, RGB and CMYK. For microcontrollers using C or micropython. ctx renders to lower bitdepth RGB332, RGB565 variants as well as 1,2 and 4 bit per pixel grayscale is handled. Combined with floating point pixel encoding support and color management ctx scales to meet GEGL and GIMPs needs.

ctx provides abstractions for event injection and dispatch. It provides hit-detection, this allows abstracting over multiple input devices/buttons with a mouste+keyboard abstraction. In the event method callback both absolute and local (At time of callback registration) coordinates are provided.

The same API can also be used for writing applications that run inside the ctx terminal, which provides escape sequences that enable drawing 2D vector graphics both inline, and for full-window applications taking over the terminal using the ctx protocol, or even on webpages using webassembly, for now single threaded - and without the potential acceleration through reuse of the rasterizer of the HTML5 Canvas.

The ctx renderer is written in portable C, without inline assembly or SIMD intrinsics - but is still fast (and can make good use of cpu capabilities known by the C compiler. The single threaded rendering performance rendering performance is often better than engines with more dedicated/manual SIMD handling.

Below is ctx compiled to WASM with emscripten (without SIMD support). Operating on a 640x480 canvas.

license and funding

The terminal is available under GPLv3+, and ctx.h is available under LGPLv3+ you can encourage continued development of ctx and dissimilar technologies by financially supporting me, Øyvind Kolås who is doing independent pro-bono R&D through patreon and similar. If my income through such sources is above 4000USD per month for a year, or a similar amount in shorter time I want to relicense the rasterizer and protocol parts of ctx under the ISC license. If you'd rather have this R&D applied to cairo; because it furthers interests, I am willing to offer a 2 month stint for 25000 USD; that would result in patches significantly improving the performance of cairo's rasterizer or maybe adding a ctx based alternative image surface inside cairo.