1. New dll/so project

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

new topic     » topic index » view message » categorize

2. Re: New dll/so project

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: New dll/so project

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: New dll/so project

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)

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu