Monday, March 15, 2010

Create pixBufs properly..

When I was looking over my buffer code this morning I felt that something was not quite right. Ok, the code was fine. I did ‘what it says on the tin’, but there was something wrong. After I realised what it was, ie creating a pixbuf like this:

set pb1 [gnocl::pixBuf new {640 480 8 0} ]

I re-worked the buffer code the result of which alows the creation of this:

set pb1 [gnocl::pixBuf new \
   -width 640 -height 480 \
   -bitsPerSample 8 \
   -alpha 1 \
   -colorSpace RGB]

Much more Gnoclish! The former wasn’t wrong, there is only one command to create a buffer, and once set it cannot be re-configured like widgets. Ok, so now all is fine. Or is it? We now have an anachronistic info command, the one I blogged about this morning. Well, scrap that. Use cget instead! Ah, yes, its all coming together. Perhaps a bit of ‘weeding’ late this afternoon. In the garden? Nay, to the source code, I need to weed out all the unwanted bits of comments, debugging calls and redundant stuff.

No comments: