Re: Horiz motion: What is faster/better than redrawing pic moved 1 pixel to left 100x?
- From: John Cupitt ng-london org uk
- To: seberino spawar navy mil
- Cc: gtk-list gnome org
- Subject: Re: Horiz motion: What is faster/better than redrawing pic moved 1 pixel to left 100x?
- Date: Tue, 29 Jan 2002 13:33:17 -0000
Chris Seberino wrote:
> Suppose I want to simulate a picture moving
> across a widget/pixmap. I *could* erase it and
> redraw it moving it 1 pixel at a time.....
>
> but...
>
> is there a better/faster way to simulate movement
> regarding a picture???
Hi Chris, there are many, many techniques:
- use gtkcanvas
high level OO canvas widget will do all the work
for you ... it won't be the quickest thing ever
though, since the compositing work is
done on the application side (I think)
- double buffer
make an offscreen pixmap inside the X server
and do all your erase/redraw there ... when you
want to update the screen, just copy the changed
areas to the display
pretty quick, and no flicker
- eor
make an offscreen pixmap one pixel wider than your
sprite, draw your sprite to that, then eor your
sprite over itself, but offset by 1 pixel ... now
draw your sprite to the display, then eor your
offscreen pixmap over the top ... it moves!
I'm not sure it's possible to go faster than
this
John
==========================================================
Coming soon:
Aelbert Cuyp 13 February - 12 May 2002
For information and tickets:
http://www.nationalgallery.org.uk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]