A thin layer of graphic data types
When creating graphic libraries you most likely end up dealing with points and rectangles. If you're particularly unlucky, you may end up dealing with affine matrices and 2D transformations. If you're writing a graphic library with 3D transformations, though, you are going to hit the jackpot: 4x4 matrices, projections, transformations, vectors, and quaternions.
Most of this stuff exists, in various forms, in other libraries, but it has the major drawback of coming along with the rest of those libraries, which may or may not be what you want. Those libraries are also available in various languages, as long as those languages are C++; again, it may or may not be something you want.
For this reason, I decided to write the thinnest, smallest possible layer needed to write a canvas library; given its relative size, and the propensity for graphics libraries to have a pun in their name, I decided to call it Graphene.
This library provides types and their relative API; it does not deal with windowing system surfaces, drawing, scene graphs, or input. You're supposed to do that yourself, in your own canvas implementation, which is the whole point of writing the library in the first place.
Graphene has minimal dependencies.
Graphene contains optimizations for speeding up vector operations; those optimizations are optional, and used only if both Graphene was compiled with support for them and if the system you're running on has them. Currently, Graphene supports the following platform-specific fast paths:
In the remote case in which none of these optimizations are available, Graphene will fall back to a naïve scalar implementation.
Graphene can, optionally, provide types for integrating with GObject properties and signals, as well as introspection information for its use with other languages through introspection-based bindings.
In order to build and install Graphene you will need development tools and the headers of the dependencies.
First of all, clone the Git repository:
$ git clone git://github.com/ebassi/graphene $ cd graphene
$ mkdir _build $ meson _build . $ ninja -C _build $ ninja -C _build test # ninja -C _build install
If you find a bug (which I'm sure there will be plenty), or if you want to add your own pet feature, then follow these steps:
That's pretty much it.
Please, respect the coding style when writing patches for Graphene.
Graphene provides common types needed to handle 3D transformations:
All types can be placed on the stack, but provide allocation/free functions for working on the heap as well. The contents of all structure types, unless noted otherwise, should be considered private, and should never be accessed directly.
The full API reference for the for Graphene is available online.
Graphene is released under the terms of the MIT/X11 license.