[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-app-devel
Subject:    Re: How to convert a jpg image to a GtkImage ?
From:       Mike Melanson <mike () multimedia ! cx>
Date:       2007-08-31 21:11:15
Message-ID: 46D883F3.3000907 () multimedia ! cx
[Download RAW message or body]

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
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic