24-bit-per-pixel limit to Gdk RGB ?

On Sunday, February 2, 2003, at 09:57 AM, Roland Smith wrote:

On Sat, 1 Feb 2003 18:09:48 -0300
"Individual . ." <individual mi cl> wrote:

I decided it would be great if I could learn how to plot an image to a
window, pixel by pixel. Getting the  image is no problem at all, since
I wrote a simple c++ class that uses libpng
The plotting part is what is holding me up.

I have looked at the scribble program that is given as an example, but
I must say that the lack of a chapter on drawing_area widgets in the
tutorial isn't helping me one bit!

Plotting pixel by pixel is _slow_. It's better to use GdkRGB, e.g. using gdk_draw_rgb_image(). What you have to do is read from the png file to a buffer containing an array of rgb values. This is then drawn to a drawable. See the
example in the GDK manual.

After 2 weeks of silence, I'm back. I paused my learning of Gtk and did some things in Xlib. Not pretty, as someone said. I got as far as XCreateImage, but when I handed it the image data (in 48 bit-per-pixel triplets) it spewed out a distorted, flipped and psychedelic version of the original image. I tried to find what order it wanted the data in, but no luck. I asked on the XFree86-devel list, and got no useful answer.

So it's back to Gtk. Yes, having to mess with all colour depths is not pretty.

I looked at the API reference, and saw gdk_draw_rgb_image (), but it seems to be a 24-bit-per-pixel affair. Even the one with "32" in its name only is 32 bits per pixel because of 8 padding bits.

Is there a way to display 48-bit-per-pixel image data? The API reference entry for GdkRgbDither states:

"Since GdkRGB currently only handles images with 8 bits per component, dithering on 24 bit per pixel displays is a moot point. "


I'm looking at gdk_draw_pixbuf () right now, but I don't see anything referring to max bit depth.

Thanks in advance for the help and comments.


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