Re: [gtk-list] resize and imlib



On  7 Feb, Ketil Froyn scribbled:
->  Hello.
->  I've made a program that uses imlib to draw images in a window. I load the
->  image, resize the window (with
->  gdk_window_resize(window->window,image->rgb_width, image->rgb_height)),
->  and then i do gdk_imlib_apply_image(image,window->window). What happens is
->  that imlib checks the window's height and width, and finds them to be what
->  they were *before* i resized, and then it scales the image to this size,
->  and draws it. Then, in the next configure_event or expose_event, the image
->  is drawn again, this time the correct size. This scaling is neither quick
->  nor very nice to look at. Any suggestions?

you have to reverse your logic.

do a gtk_widget_set_usize(widget, image->rgb_width, image->grb_height);
then (I assume its a drawig area) in the "configure_event" callback 
gtk_signal_connect(GTK_OBJECT(area), "configure_event",
                   GTK_SIGNAL_FUNC(image_cb_resize), NULL);
then do
gdk_imlib_apply_image(image, widget->window);

this is because all resizes, draws etc in gtk are DELAYED and not
immediate - you have to wait till it has been done and then respond to
it.
-- 
--------------- Codito, ergo sum - "I code, therefore I am" --------------------
raster@rasterman.com       /\___ /\ ___/||\___ ____/|/\___  raster@redhat.com
Carsten Haitzler           | _ //__\\ __||_ __\\ ___|| _ /  Red Hat Advanced
218/21 Conner Drive        || // __ \\_ \ | |   \ _/_|| /   Development Labs
Chapel Hill NC 27514 USA   ||\\\/  \//__/ |_|   /___/||\\   919 547 0012 ext 282
+1 (919) 929 9443, 801 4392   For pure Enlightenment   http://www.rasterman.com/

              \|/ ____ \|/  For those of you unaware. This face here is in fact
	      "@'/ ,. \@"   a Linux Kernel Error Message.
	      /_| \__/ |_\
		 \__U_/
							   



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