Re: pix buf and colormaps





-------- Original Message --------
Subject: Re: pix buf and colormaps
Date: Thu, 28 Jun 2012 15:14:27 +0200
From: Kees Kling <ckling upcmail nl>
To: Kjell Ahlstedt <kjell ahlstedt bredband net>


On 06/27/2012 04:26 PM, Kjell Ahlstedt wrote:
2012-06-26 11:44, Kees Kling skrev:
Hi,

I have created a pix_buf from 8 bits data with the function
create_from_data (const guint8* data, Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height, int rowstride).

It displays fine, but only in greyscale, so I must attach a colortable, which maps a 8 bits value to an RGB color and preferable to an RGBA color. What the best way to do this, I can't find much documentation.


Regards

Kees Kling
The documentation of the C module gdk-pixbuf is located at http://developer.gnome.org/gdk-pixbuf/stable/.
Perhaps you can find some information there, e.g. in "The GdkPixbuf Structure" section at
http://developer.gnome.org/gdk-pixbuf/stable/gdk-pixbuf-The-GdkPixbuf-Structure.html.

When I look at that documentation and a small part of the gdk-pixbuf source code, I get the impression that each pixel is represented by 3 or 4 bytes, called either channels or samples: one byte each for red, green, blue, and an optional byte for an alpha channel. But if that's the whole truth, I don't understand why you get only greyscale pictures.

Kjell
Hi Kjell,

my data is just one byte and I want to display it as a color image. So for that I'm going to use a colortable with 255 entrys and in fact I have to translate every byte value in  3 or 4 bytes found in the colortable. It is nothing new, because I think bmp format does the same. Off coarse it is possible to do just a one by one pixel translation, but my data  could be rather big, so there is a time and mem penalty. I should like to know if there is a better way

Regards

Kees



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]