Re: jpeg images



On Mon, Mar 05, 2001 at 10:40:53AM +0000, John Cupitt wrote:
> Ronald Bultje wrote:
> > I would like to display jpeg images on the screen, for example using the
> > GtkPreview or something similar. But how would I load the jpeg image from
> > the file?
> 
> Hi Ronald, libjpeg has an API for decompressing into a memory buffer. If
> you download the sources (http://www.ijg.org), the docs are included.
> Once it's in memory, you can draw it with the gdk_rgb*() functions.
> 
> If you want something higher level, GdkPixbuf and friends have jpeg
> loaders (I think) ... not used them myself though.

Indeed it does.. gdk-pixbuf is the friend of gtk+ 1.3/2.0, people that write for 1.2 use imlib though
The easiest way is probably to create a GtkDrawingArea and set it's background to the image (and size to the image size)
Put it centered in a GtkAlignment for added spiffyness.





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