Re: gnome/gtkcanvas



Alexandre Mathy wrote:

Hey..
Ok so I've decided to go with gnomecanvas.
I'm having trouble drawing images to the canvas though...
Here's the code:
	
GdkImlibImage *Image = gdk_imlib_load_image ("mypng.png");

/* create a new canvas */
	gtk_widget_push_visual (gdk_imlib_get_visual ());
    gtk_widget_push_colormap (gdk_imlib_get_colormap ());
	canvas = gnome_canvas_new();	
  gtk_widget_pop_visual();
  gtk_widget_pop_colormap();
.
.
.
.
	 gnome_canvas_item_new (gnome_canvas_root(canvas),
					       gnome_canvas_image_get_type (),
					       "image", Image,
					       "x", 0,
					       "y", 0,
"width",(double)Image->rgb_width, "height", (double)Image->rgb_height,
					       NULL);



You should use
"x", 0.0,
"y", 0.0,
This is to respect the correct type an int is not a float...

and perhaps put an anchor for your image, I can't remember if it's
necessary.
"anchor", GTK_ANCHOR_...


--
Florent DEVIN, 33 (0)3 20 43 47 30, Fax (33) (0)3 20 43 65 66 (Fax LIFL)
LIFL, Laboratoire d'Informatique Fondamentale de LILLE
USTL, Bureau 326, Batiment M3, 59655 Villeneuve d'Ascq Cedex





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