Re: RE: Scrolling a drawing area

On Wed, 2008-05-21 at 19:40 +0300, Dov Grobgeld wrote:
> For what it is worth, the DovImageViewer (which is part of giv), does
> a single redraw based on a call to:
> gint  dov_image_viewer_zoom_around_fixed_point   (DovImageViewer *
> self,
>                     double new_scale_x,
>                     double new_scale_y,
>                     double old_x,
>                     double old_y,
>                     double new_x,
>                     double new_y);
> It will transfer the old widget coordinate (old_x,old_y) to
> (new_x,new_y) while zooming in (or out) to (new_scale_x, new_scale_y).
> If adjustments have been attached to the widget, then these are
> updated as well.
> Since the entire GdkPixbuf is prepared before it is being exposed in
> the window through a call to gdk_draw_pixbuf() the result is quite
> smooth. (At this point the user of the widget can connect to a signal
> and add annotations to the pixbuf, before it is being shipped to the
> screen.)
> Am I still missing something? I agree it wasn't easy to get coordinate
> systems correct in the widget implementation, but there is nothing
> intrinsic in gtk that hinders it.

no, thats precisely what i mean. existing GTK widgets do not provide
this function, and instead use gdk_move_window() (because they don't
realize that a complete redraw is to follow). that is, when you zoom
around, say, the center of a GtkLayout or GtkViewPort, you end up first
doing a scroll to reposition the visible part of the child window, and
then, ***duh*** you redraw the entire child window.

your custom widget does the right thing, and this is what other widgets
that could potentially be the site of zoom-around-fixed-point need to

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