Re: Where can I find any samples about using jpeg in gtk?



Hi Ronald,

Thanks for the link.

I've already found a solution to display a jpeg image file using GTK+.

I have used the the IJG code to read the jpeg file into an RGB buffer
and then call the gdk_draw_rgb_image().

Here's the code snippet:
===========================================
pic=malloc(3*320*240)

jpegread("filename", &width, &height, pic); //refer to libjpeg.doc at www.ijg.org <http://www.ijg.org>

gdk_draw_rgb_image (pixmap,
drawing_area->style->white_gc, 0, 0, 320,
240, GDK_RGB_DITHER_NORMAL, pic,
960);

free (pic);
==========================================

You need to have the jpeglib.h and libjpeg.a to compile successfully.


Regards,
Dennis

Ronald S. Bultje wrote:

Hi Dennis,

On Fri, 2004-11-19 at 12:57, Dennis Gajudo wrote:
Where can I find any samples about using jpeg in gtk?

Have a look at GdkPixbuf and the GtkImage widget in Gtk+-2.0. They're
what you're looking for. See the Gtk+ website (http://www.gtk.org/) for
code examples.

Ronald






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