Project

gd2-ffij

0.03
No release in over 3 years
Low commit activity in last 3 years
gd2-ffij is a refactoring of the Ruby/GD2 library implemented with FFI
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.0.0
 Project Readme

gd2-ffij - Ruby FFI Bindings for Thomas Boutell’s gd 2.x Graphics Library¶ ↑

The gd2-ffij project page can be found at github.com/dark-panda/gd2-ffij .

Why FFI¶ ↑

DL just doesn’t want to work correctly on my x86_64 linux boxes and on OSX, so here’s a refactoring using FFI.

These modifications were partly inspired by Patrick Stenmark’s work, which can be found at github.com/spatrik/gd2-ffi/, although the goal of these modifications are a complete GD2 Ruby library using FFI. I’ve also included the beginning of a test suite, although coverage isn’t quite complete yet.

This GD2 library should “just work” as a replacement for Robert’s original GD2 library, although without a complete test suite and the time and resources to do complete testing, it is difficult to know for sure. Reports on successful test runs are welcomed.

Robert’s Original Notes¶ ↑

“I wrote this Ruby library because I wasn’t satisfied with the existing Ruby/GD extension library. Among other things, it had no support for creating images from PNG or JPEG data already in memory.

Ruby/GD2 is 100% Ruby and uses dl to link with the gd shared library. Most of the gd API is supported in some way, however the interface is quite different so that we can do things The Ruby Way as much as possible.

Most of the documentation for this library is now in RDoc form.“

Troubleshooting¶ ↑

gd2-ffij should “just work”; however, it may have trouble finding LibGD or (if you have multiple versions if the library installed) find the wrong LibGD. You can point it at the correct lib in one of the following ways:

  1. Before importing gd2-ffij, set global variable $GD2_LIBRARY_FULL_PATH to the absolute path to the shared library.

  2. Set environment variable GD2_LIBRARY_FULL_PATH to the absolute path of the LibGD shared object (i.e. the .so/.dylib/.dll file).

  3. On *nix (including macOS), you can also set GD2_LIBRARY_PATH to a glob pattern that matches the shared object file.

Contributing¶ ↑

Patches, bug reports, pull requests, and all other good stuff can be performed via the project GitHub page at github.com/dark-panda/gd2-ffij .

License¶ ↑

See the COPYRIGHT file for details.