Re: [Gqview-devel] gqview image visualization widget inotherapplications
Brought to you by:
gqview
From: John E. <jo...@ve...> - 2005-03-21 22:36:05
|
DANIELLLANO wrote: > [snip] > > The tiles patch (plus many fixes) will be in GQview 2.1.0 (releasing as I type > > this). > > > > A good example is the new 'Pan View' in pan-view.c, although it is still a work > > in progress, and has an ugly name. > > I think the API you released won't work for me because I don't want to > block the mainloop while fetching tiles over the web and I also want to > be able to fetch multiple tiles in parallel. > > I'd need ImageTileRequestFunc to just give a hint to the tile requestor > that it needs a title and the tile requestor would give the tile to the > ImageTile widget whenever it's ready (or even multiple times while > progressive loading). > > So the current API is: > typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y, > gint width, gint height, GdkPixbuf *pixbuf, gpointer); > > The API I'd like to see: > typedef gint (* ImageTileRequestFunc)(ImageWindow *imd, gint x, gint y, gpointer); > and a: > void image_tile_set(ImageWindow *imd, gint x, gint y, gint width, gint height, GdkPixbuf *pixbuf); > > I'm not sure about the width & height in ImageTileRequestFunc, leave them if you want. They are needed for two cases where the width and height may not match the tile size: 1) The region is at the right or bottom of the 'canvas' and the dimensions you had set (with image_tile_set) is not a factor of the tile size. 2) You called image_area_changed() with an image region that is not aligned to a tile, or is larger/smaller than a tile. > Anyway the pan-view seems to work very well. > Is your API OK and I'm missing something? The pan view does avoid blocking on ImageTileRequestFunc, you may notice that thumbnails are not immediately displayed when you scroll to a new region - what happens is this: - ImageTileRequestFunc is called to ask for the tile - The pan view code draws what it currently has (all but image/thumbnail pixels) onto the tile, and adds the relevent image/thumbnails to a load queue. - The tile is drawn with whatever ImageTileRequestFunc had just given it. - pan view notices idle time and loads the next thumbnail in the load queue - when the thumbnail is ready the pan view calls: pixbuf_renderer_area_changed(PixbufRenderer *pr, gint x, gint y, gint width, gint height) If you load a tile at a time use the same x,y and width,height as was given in ImageTileRequestFunc (the function name change I will address below). - pixbuf_renderer_area_changed will result in another ImageTileRequestFunc for that tile, but since you have the tile (you did keep it somewhere?) you can now properly draw the tile when requested. In addition, when the image view no longer thinks it needs a tile it will call ImageTileDisposeFunc so that you can free any data you keep around for that tile. The only downside of the current implementation is that if your data it exactly the size of the tiles you are keeping two sets of the tile in memory (one app side and one image renderer side), to fix it you could hack ImageTileRequestFunc to return a GdkPixbuf instead of allocating it's own (for simplicity it would have to allocate one if you return a NULL GdkPixbuf when you do not yet have the data). Then it is just a matter of properly refing and unrefing your GdkPixbuf tiles in the right places (request/dispose handlers and your apps data load/free). The next release will separate out the core image renderer into PixbufRenderer as a true GtkWidget. The drawing 'stuff' will all be a single set of files pixbuf-renderer.[ch] and need no other parts of the GQview code base (you will need to undefine GQVIEW_BUILD in pixbuf-renderer.c - all it does is disable the retrieval of the shift-click scroller icon, resulting in it being a black square). If you can not wait or want to take a look the changes are in the sourceforge cvs: http://sourceforge.net/cvs/?group_id=4050 You could also download pixbuf-renderer.[ch] using viewcvs if you are adverse to a cvs setup: http://cvs.sourceforge.net/viewcvs.py/gqview/gqview/src/ Usual disclaimer: The sourceforge CVS is not where I actually do any coding, but I do try to keep in sync with current development when I can (or at least I have been keeping it in sync since 2.0). Greetings, John -- John Ellis <jo...@ve...> http://gqview.sourceforge.net <GQview> | http://hideseek.sourceforge.net http://gqmpeg.sourceforge.net <GQmpeg> | <Preferences Hide and Seek> |