"ghost" image on canvas

Hello all.

I'm (still :-( ) having problems with gdk pixbuffs and canvas.
I've been able to put a jpg and a pnm on a canvas, but when I move the
png the first time, it leaves a ghost image. After that, I can move it
without problems (and without ghosts).

GdkPixbuf *pb=gdk_pixbuf_new_from_file("/path/to/file.png");
double dx=-(gdk_pixbuf_get_width(pb))/2;
double dy=-(gdk_pixbuf_get_height(pb))/2;
GnomeCanvasItem *o=gnome_canvas_item_new(gnome_canvas_root(gc),
gnome_canvas_pixbuf_get_type(), "pixbuf", pb, "x", dx, "y", dy, NULL));

Here the pixbuf is placed correctly, centered at 0,0 - only the 4th
quadrant is visible. If now I do

gnome_canvas_item_move(GNOME_CANVAS_ITEM(o), x, y);

the pixbuff moves, but I still see the previous position too.
I'm sure I'm doing something stupid, but can't find WHAT.
I tried whithout dx and dy when creating the item, hiding and
redisplaying it before/after moving... And noticed that even if I don't
redisplay it the ghost is there, like it's been copied on the existing
item's bitmap...

I know, I'm a chicken, but I can't avoid it :-)


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