Re: How to convert a jpg image to a GtkImage ?



Gregory Hosler wrote:
Hi all,

I have an application, that amoung other things, is receiving a jpg file
from a network connection. Once that file is in memory (it's relatively
small), I wish to load it into a GtkImage (so that I can display it,
e.g. by adding the GtkImage to a vbox, or something like that).

I've been thru the Dev Help pages, and I have some questions:

1) If the image were in an actual file, I could load it e.g. with
   gtk_image_new_from_file(). It's not intuitive to me which
   function to use to load my in memory file into a GtkImage,
   and I am reluctant to save the image to a file, just to load it,
   and then delete the file...

2) I'm seeing the following fnctions, and, well, I'm confused.

      I see GtkImage & the related gtk_image functions.
      I see GdkPixbuf & the related gdk_pixbuf functions.
      I see GtkPixmap & the related gtk_pixmap functions.

   When do I use which ?

(and in order to display my jpg image in a v/h-box, is GtkImage really
the proper widget to use ?)

My first impulse is that you will need to drag libjpeg into this (pretty
standard everywhere) and delegate image decoding over to that module.
Then create a new image in memory with gdk_image_new() and copy the
decoded RGB data over.

-- 
        -Mike Melanson



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