1. New dll/so project
- Posted by xecronix Apr 27, 2009
- 1071 views
I'm planning to start a new dll/so binding project. I want to use libgd with Euphoria.
libgd
For those who have done Eu dll binding, do you have any advise before I get started? Are there any tools I should consider to help the job go smoother? Any special concerns I should have in terms of conventions, packaging, distribution, etc?
Ronald Weidner
2. Re: New dll/so project
- Posted by ghaberek (admin) Apr 27, 2009
- 1084 views
GD seems pretty self-contained. I would stick as close to its own layout as possible. Mind your #define macros. Some are constants, but others are functions...
this...
#define gdAlphaMax 127 #define gdAlphaOpaque 0 #define gdAlphaTransparent 127 #define gdRedMax 255 #define gdGreenMax 255 #define gdBlueMax 255 #define gdTrueColorGetAlpha(c) (((c) & 0x7F000000) >> 24) #define gdTrueColorGetRed(c) (((c) & 0xFF0000) >> 16) #define gdTrueColorGetGreen(c) (((c) & 0x00FF00) >> 8) #define gdTrueColorGetBlue(c) ((c) & 0x0000FF)
becomes...
global constant gdAlphaMax = 127, gdAlphaOpaque = 0, gdAlphaTransparent = 127, gdRedMax = 255, gdGreenMax = 255, gdBlueMax = 255 global function gdTrueColorGetAlpha( atom c ) return floor( and_bits(c, #7F000000) / power(2, 24) ) end function global function gdTrueColorGetRed( atom c ) return floor( and_bits(c, #FF0000) / power(2, 16) ) end function global function gdTrueColorGetGreen( atom c ) return floor( and_bits(c, #00FF00) / power(2, 8) ) end function global function gdTrueColorGetBlue( atom c ) return and_bits( c, #0000FF ) end function
(Note the use of c / power( 2, x ) which is c shifted right x bits, or the C ">>" operator.)
-Greg
3. Re: New dll/so project
- Posted by JansekVillaria Apr 28, 2009
- 1075 views
Do have a look at Elliott Sales de Andrade wrapper for GD.
It has worked nicely for me in the past but needs updating.
http://wingzone.tripod.com/gd.htm
Jansek
4. Re: New dll/so project
- Posted by xecronix May 01, 2009
- 1020 views
Thanks for both responses. Jansek, that was a huge help. I've downloaded at tested what was there. It seems to work well. In any case, as I update the wrapper, I now have a convention to follow as a guide. (Not to mention a great deal of work already done)