Re: How to render/update a small rectangle of GdkImlibImage in a GnomeCanvasImage ?



>  I need a fast update of small, rectangular region of a GdkImlibImage,
>  which is displayed via a GnomeCanvasImageItem.
>  
>  I tryed the following calls:
>  
>  [it is:
>   GdkImlibImage *gimg; 
>   GnomeCanvas *area;
>   GnomeCanvasItem *gitem;
>  ]
>  
>  // change rgb data:
>      gimg->rgb_data[...]=...;
>  
>  // tell imlib that data has changed...
>  // Doese someone know how to tell Imlib which rectangle was changed ? (I
>  found no function)
>      gdk_imlib_changed_image(gimg);

There is no way to tell imlib about a local change.

>  // this does not refresh "line i":
>      gnome_canvas_request_redraw( GNOME_CANVAS(area), 0., i,
>  gimg->rgb_width, i);
>  
>  // This works, but it is quite slow, because is repaints the whole
>  image:
>      gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(gitem));

Application code should never ever call the
gnome_canvas_request_redraw() and update() family of functions.  These
are meant to be used only by canvas item implemenations.

You should simply tell the image item that the image changed:

	gnome_canvas_item_set (gitem,
			       "image", gimg,
			       NULL);

This will redraw the whole image.  Right now there is no way to tell
it about a small change, though.  This is really not possible with
imlib, since its dithering algorithm requires a recalculation of the
whole image.

Now that GnomeCanvasImage supports GdkPixbuf, it would make sense to
have a function to notify it about a local change.  I'll look into it.

  Federico



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