vector graphics framework

ctx is an interactive 2D vector graphics, audio, text- canvas and terminal, with an 2D vector drawing API directly mapping to a vector graphics protocol for terminal/network support and deferred multi-threaded rendering. The rendering API/protocol aims to be a superset of the capabilities/needs of GEGL, SVG, HTML5 Canvas 2D context, and cairo.

The ctx rasterizer is fast, and supports compositing color managed results directly to RGBA8, GRAYA8, GRAYAF, RGBAF and CMYKAF pixel formats, the 8bit formats are presumed to be for display and allows; though tries to avoid; small sacrifices of precision for performance, while the floating point code yields accurate math with natrual expression of the compositing math. For micocontrollers rendering to lower bitdepth RGB332, RGB565 variants as well as 1,2 and 4 bit per pixel grayscale is handled.

The ctx renderer is written in portable C, without inline assembly or SIMD intrinsics - but is still fast. The single threaded rendering performance for 8bit RGBA is comparable with and often faster than the rendering engines in Qt/cairo that are using SIMD like SSE2/AVX/Neon for compositing. The next parts of ctx to be refactored for performance while trying to keep the code mictrocontroller friendly, is anyways not the compositing - but the rasterizer itself.

The most optimized code in ctx is for the normal source-over combination with all possible paint sources, color, linear and radial gradients and textures. For most other blending and compositing modes, slower runtime code is used. Combinations of blend mode+compositing mode + texture source can be inlined and compiled into pre-compiled functions. Trading of compiliation time and resulting code-size for performance.

Programs using the ctx SDK are able to run as clients of the ctx terminal/other ctx applications or can run directly on top of SDL2, linux framebuffer/DRM and alsa. When using these backends there is additional caching and threading that helps boost performance.

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.