Re: what is an image



Shiraz Baig wrote:
I have tried to decipher the picture rendering in GTK,
but I am not clear.  The ref documents are too brief
and the tutorials do not cover this subject well.

I have following questions.

1) We have a GtkImage and We have a GdkImage. What is
the difference between the two?
GtkImage is a widget - it is used to display a picture on the screen within GTK+ framework, like GtkLabel is used to display some text. GdkImage is a GDK object, it is used to locally hold a picture and do some manipulations with its content.

2) What is the difference between image, pixmap,
pixbuf?
GdkImage and GdkPixbuf are stored locally (inside the memory of your process), while GdkPixmap lives in the XServer's memory (this can be somewhere on the network). So the main difference is that you can directly access the pixels of GtkImage and GdkPixbuf, but if you want to change anything in GdkPixmap you have to talk to XServer.

The difference of the GtkImage and GdkPixbuf is that GdkPixbuf uses small set of predefined formats to store the pixels (like RGB 8:8:8 triplets or ARGB 8:8:8:8), while GtkImage holds raw pixels (format depends on your current hw configuration/video mode), ready to be send to video memory. GdkPixbuf has some advantages over the GtkImage, like scaling support and loading picture from file.

3) What are the function calls involved starting from
a picture stored in jpg file to rendering it on the
screen.
Function to load GtkImage (the easy way to display a picture):
http://www.gtk.org/api/2.6/gtk/GtkImage.html#gtk-image-new-from-file

Function to load GdkPixbuf:
http://www.gtk.org/api/2.6/gdk-pixbuf/gdk-pixbuf-file-loading.html#gdk-pixbuf-new-from-file
One of the functions to render GdkPixbuf to some drawable:
http://www.gtk.org/api/2.6/gdk/gdk-Pixbufs.html#gdk-pixbuf-render-to-drawable

	Olexiy



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