Re: A few drawing questions



Correct me if I'm wrong, but if you're using GDK, I think you should
use pixmaps instead of GdkPixBufs. The docs say that pixbufs are
client-side, while pixmaps are server side, so redrawing a pixbuf will
be more expensive. I also take this to mean that it's possible for an
X server to store a pixmap in on-screen memory, which can then be
copied very fast. However, when I tried some experiments to see which
was faster, I could not make out a difference on my box (which has an
nvidia accellerated server). My app (a radar data display) doesn't
need the speed of a game, though.

Anyway, to get a semi-transparent floating overlay atop the tiled
background, you could consider using GdkPixBuf's composite functions.
They're fairly slow, but if you only need to redraw when the tiles
beneath the overlay change, you can probably get acceptable speeds.

About tile redrawing, there should be lots of text files from the
fidonet era, written by various "sceners" describing how you can do
4-way scrolling with a limited amount of redrawing of all the tiles
(see www.scene.org ). In a nutshell, most of them ended up with a
bitmap slightly larger than the screen size, which could be panned
around when the user wanted to scroll. When you reach the edge of the
larger bitmap, repaint the edge which just got uncovered. Fullscreen
VGA games used the hardware to show a part of the video memory and to
implement the scrolling, with GTK I guess you can emulate it with the
various bitmap copy functions.



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