Re: gdk_put_image() and ColorMap



Hi,

On Thu, 26 Aug 2004 18:57:42 +0300, John Que <qwejohn hotmail com> wrote:
I have an X application which displays an XImgae instance.
Now , I do display this image correctly using XLib app (without gtk).
I should port this to gtk/gdk.

I made this change a few years ago. The magic API you want is
gdk_draw_rgb_image():

http://developer.gnome.org/doc/API/gdk/gdk-gdkrgb.html

It takes a buffer of 8-bit RGB pixels and renders them to any X
drawable, ditheriing etc. as required. If shared memory is available,
it'll use that to send the pixels to the server for you. No need to
mess about with visuals/colormaps/etc, although if you want to control
that stuff you still can.

It's pretty quick too. There's a benchmark program in the gtk+-1.2
distribution (testrgb I think) which will give you megapixels/sec
numbers. If it's an option, gtk2 has a higher level API (gdkpixbuf)
which can directly display image files for you.

John



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