Blend2D is a high-quality 2D vector graphics engine written in C++. It has a built-in JIT compiler that generates optimized pipelines at runtime. In addition, the engine features a brand new rasterizer that has been written from scratch to deliver superior quality and performance. The quality is comparable to rasterizers used by AGG and FreeType and the performance is much better due to using an innovative approach to index data that is built during rasterization and scanned during composition. The rasterizer is robust and excels in rendering complex vector art and text.
Blend2D is written in C++, but provides both C and C++ APIs. Public functions use only C interface so each feature of the library is directly available to both C and C++ users. The primary goal of C API is to make it possible to use Blend2D from programming languages that can interface with C either natively or through FFI. The primary goal of C++ API is to make the library easy-to-use in C++ projects without the need of manual resource management. The C++ API is built on top of the C API and turns all objects that require initialization and finalization into smart objects that handle it automatically. The C++ API should be considered zero-cost and it even allows to interchange C and C++ objects if that's what is needed.
The following snippets provide an insight into the C and C++ APIs provided by Blend2D. Please note that both snippets were written to be comparable line-by-line and designed to be as narrow as possible.
Blend2D provides similar paint styles as defined by SVG and HTML <canvas>, which include solid colors, gradients, and patterns. It uses a slot-based approach that allows to specify both fill and stroke styles separately. Gradients and patterns also support extend modes so it's possible to specify whether they should be padded, repeated, or reflected. Extend modes of patterns can be configured independently of X and Y.
Blend2D supports all Porter & Duff compositing operators and a wide range of blend modes defined by SVG, CSS, and PDF specifications. Composition and blending modes can be applied to any rendering operation including fills, strokes, and image blits.
After a successful alpha testing Blend2D will enter its beta phase soon. At the moment there is only few remaining tasks to be done before the source code goes public. All public parts of Blend2D were rewritten to offer both C and C++ APIs and this task took a lot of time to plan and execute. At the moment it's almost done and most time is spent on improving text support and vector geometry processing.
Beta release will be the first open-source version of Blend2D released under ZLIB license and is expected to happen at the end of February or beginning of March 2019.