Saturday, February 13, 2010

gnocl::pixBuf #2

Spent some time, too much time, today and yesterday working on this module. Its not so much the final C code that takes the time but getting to grip with how Gtk+ does things (or rather doesn't do them). The lack of clear, working examples is a bind although the contributions made to the Gtk Forum wiki are great help. The past couple of days has seen me working on getting the framework in place to construct pixbuf commands. These are the one's that I've been working on.

pixbuf commands
   save filename 
   fill colour

The key code itself it running well and is bug-free but I haven't yet quite cracked how to complete the fill command. Here's the relevant snippet from my test script:

$pb1 fill red
$pb1 fill  #aaabbbcccddd
$pb1 fill green
$pb1 fill blue
$pb1 fill white
$pb1 fill black

$pb1 fill  #fff000000fff
$pb1 fill  #000fff000fff

All the named colours are working well, ie not causing errors, but the resultant saved files are not of the right colours. It must be something to do with converting colours to a guint32 number. Tadej at Gtk Forum recommends others to use Cairo to complete such drawing operations, perhaps that's the route I might eventually take. Peter Baum produced a few support functions for colour manipulaiton which are found in the parseoptions.c module. These, however, don't handle the guint32 format. I've had enough of it for today and so will leave it for the next time.

No comments: