Gdk Pixbuf and Monochrome images
- From: Mohit Kumar <mohit kumar gmail com>
- To: gtk-list gnome org
- Subject: Gdk Pixbuf and Monochrome images
- Date: Tue, 27 Sep 2005 11:49:42 +0530
I am trying to display a monochrome image in a GdkPixbuf. I have the
monochrome data in memory and to use it for the call
"gdk_pixbuf_new_from_data" i need to convert into RGB Pixels. Hence
where ever I find 1 in bit, it is replaced with 3 bytes woth 0xFF and
whereever I find a 0 in a bit, it is replaces with 3 bytes of 0x00.
However, I am still unable to get the rendered image correctly. The following is the piece of code:
guchar bitShift = 1 << 7;
guchar bit = bitShift >>
if(bit & tempBuffer[i])
shift*3] = buf[i*24 + shift*3 + 1] = buf[i*24 + shift*3 + 2] = 0x00;
shift*3] = buf[i*24 + shift*3 +1] = buf[i*24 + shift*3 + 2] = 0xFF;
Could anyone help me with where am I going wrong?
Moreover, I find this method very inefficient as there is no use for
the user to load a monochrome image, I am using the same amount of
memory anyways. Is there a better alternative to this?
] [Thread Prev