Movatterモバイル変換


[0]ホーム

URL:


Graphene

A thin layer of graphic data types


Project maintained byEmmanuele BassiHosted on GitHub Pages — Theme bymattgraham

When creating graphic libraries you most likely end up dealing with pointsand rectangles. If you're particularly unlucky, you may end up dealingwith affine matrices and 2D transformations. If you're writing a graphiclibrary 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 ithas 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 availablein various languages, as long as those languages are C++; again, it may ormay not be something you want.

For this reason, I decided to write the thinnest, smallest possible layerneeded to write a canvas library; given its relative size, and thepropensity for graphics libraries to have a pun in their name, I decidedto call it Graphene.

This library provides types and their relative API; it does not deal withwindowing system surfaces, drawing, scene graphs, or input. You'resupposed to do that yourself, in your own canvas implementation, which isthe whole point of writing the library in the first place.

Dependencies

Graphene has minimal dependencies.

Graphene contains optimizations for speeding up vector operations; thoseoptimizations are optional, and used only if both Graphene was compiledwith support for themand 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 withGObjectproperties and signals, as well as introspection information for its usewith other languages through introspection-based bindings.

Installation

In order to build and install Graphene you will need development tools andthe headers of the dependencies.

Graphene uses theMeson build system togenerateNinja build files. You must installNinja and Meson before building Graphene.

First of all, clone the Git repository:

$ git clone git://github.com/ebassi/graphene$ cd graphene

Then run:

$ mkdir _build$ meson _build .$ ninja -C _build$ ninja -C _build test# ninja -C _build install

Contributing

If you find a bug (which I'm sure there will be plenty), or if you wantto add your own pet feature, then follow these steps:

  1. Fork theebassi/graphene repo
  2. Fix bugs or add new features and push them to your clone
  3. Opena new issue
  4. Opena pull request
  5. Wait for me to give feedback on the pull request
  6. Celebrate when your code gets merged

That's pretty much it.

Please, respectthe coding style when writing patches for Graphene.

Documentation

Available types

Graphene provides common types needed to handle 3D transformations:

Graphene also provides its low-levelSIMDvector andmatrix types, which areused to implement the API above.

All types can be placed on the stack, but provide allocation/free functionsfor working on the heap as well. The contents of all structure types, unlessnoted otherwise, should be considered private, and should never be accesseddirectly.

The full API reference for the for Graphene isavailable online.

License

Graphene is released under the terms of theMIT/X11 license.


[8]ページ先頭

©2009-2025 Movatter.jp