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



You probably want to look at the gdkrgb code.  It is used in the
antialiased canvas to draw to the screen, and is also used in all versions
of gimp that work with gtk+-1.2.

With it, you can render rgb, greyscale or indexed image data to a 
drawable, and you do not need to worry about visuals.

If you do not need the other features of the canvas, you may want to use
a GtkDrawingArea to display the image.  If you need the other canvas
features, and the level of control you want it may be necessary to write a
custom canvas item.

James Henstridge.

--
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/


On Tue, 3 Aug 1999, Percy Zahl wrote:

> Federico Mena Quintero wrote:
> > 
> > >  I need a fast update of small, rectangular region of a GdkImlibImage,
> > >  which is displayed via a GnomeCanvasImageItem.
> > >
> [...]
> > 
> > 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);
> 
> I see. It´s Ok so far, but I can not be satisfied to redraw a 800x800 or 
> even bigger Image every few seconds I got a new Line of data...
> 
> It is nessesary to see the aquired data online.
> 
> I´m rewriting my STM/AFM (Scanning Tunneling Microscopy/Atomic Force
> Microscopy) 
> Software from the libxforms-0.88...
> 
> My previously solution was a selfbuild xforms object, where I do my own
> "rendering"
> for (supporting 8/15/16/24bit) and palette mapping using the xlib
> directly
> (with MIT-SHM support).
> My object has some very fast inline functions to set single pixels/lines
> and
> uses calls like
> 
>   if(NoShm)
>     XPutImage(disp, win, gc, ximage, xs,ys, x0+xs,y0+ys, w,h);
>   else    
>     XShmPutImage(disp, win, gc, ximage, xs,ys, x0+xs,y0+ys, w,h, False);
>   XFlush(disp); 
> 
> to refresh the image... after I changed some data in ximage...
> 
> > 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.
> 
> If there is a nice and fast way solving my problem, I´ll be very 
> happy to forget about xlib hacking....
> 
> PS: Who knows how gimp does the drawing/refreshing in a area ?
> 
>     Percy Zahl
>                                                   .^.
>                                                   /V\    www.linux.org
> Email: zahl@fkp.uni-hannover.de                  // \\   www.gnome.org
>  http://www.fkp.uni-hannover.de                 /(   )\  www.gnu.org
>                                                  ^^-^^   metager.de
> Institut f"ur Festk"orperphysik, Appelstr. 2, D-30167 Hannover
> Tel.Labor: +49 (0)511/762-4825, Fax: -4877
> 
> 
> -- 
>         FAQ: Frequently-Asked Questions at http://www.gnome.org/gnomefaq
>          To unsubscribe: mail gnome-list-request@gnome.org with 
>                        "unsubscribe" as the Subject.
> 



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