Sparta is an almost stateless vector graphics API for Pharo that provides bindings to the Moz2D rendering backend. Moz2D is the extracted graphical engine from Mozilla Firefox compiled as standalone shared library together with the extern C bindings required to call the engine from Pharo.
(All images are rendered using Sparta in Pharo)
Moz2D, and as result Sparta, has support of native OS graphic engines, as well as cross platform ones.
On all platforms Sparta provides support of Cairo and Skia. Additionally, high performant CoreGraphics and CoreGraphics Accelerated on Mac OS and Direct2D on Windows. In total Sparta supports 5 different rendering backends.
One of the biggest improvements compared to existing graphics engines from Pharo is advanced high quality text rendering with multi-language support.
The current Pharo text rendering engines draw a piece of text with one concrete font and style. If the font does not have an appropriate character, a stub glyph will be rendered instead. Sparta introduces a notion of font groups that allow us to achieve a smooth fallback font detection based on the selected font style, language and missing glyphs. Fallback font support requires more complex text measurement, as multiple fonts faces are involved to render a single piece of text.
Since Sparta is based on the Moz2D backend that was designed for web browsers, we can get support for a wide variety of filter primitives. Sparta provides an ability to compose multiple filter primitives to get a single, advanced filter. For example, with the help of ColorMatrix and TableTransfer filters we can simulate some popular Instagram-like filters, for example Nashville, Inkwell or Brannan.
We should not forget that first of all Sparta is a vector graphics engine. It allows developers to create, fill and stroke custom paths and shapes. Together with gaussian blur, we can achieve astonishing results that were not possible before.
Download and Install
Prepared image+vm for Mac OSX: Sparta-v1.1.zip
Sparta requires an additional shared library that can be compiled from sources on Mac OS and Linux.