Re: Brainy person needed for scrolling canvas problem!



Hi John,

On 2 July 2010 16:04, John Emmas <johne53 tiscali co uk> wrote:
Now for the problem....  when in "playback" mode, I'd like the viewport to have a vertical "now line" 
(similar to the play head on a tape recorder).

I doubt I count as brainy, but one simple technique would be to render
the screen in layers.

You would have an offscreen pixbuf with the current view, minus the
now line. On an expose event, you copy the relevant parts of the
offscreen buffer to the display, then draw the now line over that.
Because of gtk's double-buffering, this will be flicker-free.

To scroll 100 pixels to the right, you blit your offscreen buffer by
100 pixels, draw just the objects in the exposed area of pixels, then
queue an expose for the whole widget.

This means you have to handle all the scrolling yourself, but it's not
so hard. Just connect your 'scroll by x pixels' function to the adjust
signal on a scrollbar.

If you need more speed (though I think it'd be quick enough on most
machines) you'd probably need to use opengl.

John



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