Re: Image process in gdk



Le dimanche 20 mai 2007 17:45, Luis Ramirez a écrit :
Hello

I am just a beginner in gtk and after working with the excellent samples
available I wanted to begin with a simple program that loads an image and
applies different processes on it (brightness, B&W, rotate, ...).
If I load and process the image before gtk_main() everything goes right but
if I link the call_back of a Button to a function, the image does not
change.
I have tried to use the widget expose_event but it works with a widget
created with gtk_drawing_area_new(), but not with a widget created with
gdk_pixbuf_new_from_file().

It looks like you are confusing GdkPixbuf and GtkPixbuf. A GdkPixbuf is not a 
widget but only an object storing a bitmap, while a GtkPixbuf is a widget 
displaying a GdkPixbuf. Anyway, GtkPixbuf is deprecated so you should use 
GtkImage instead.
If it's not enough for your needs, you'll have to create your own widget 
extending GtkDrawingArea, see the Gtk tutorial (section 'Writing your own 
widgets') for more infos about that.

Do you have any simple example about it?. It is simpler to show images with
cairo?

There's also a complete example in the tutorial (scribble).

Cairo is a vector graphics lib, which is very different from bitmap graphics. 
I never used it, so I don't know if it's easier, it's just another world and 
the choice depends on what you want to do.

-- 
Cédric Lucantis



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