Board index » delphi » Paint methods, virtual screens and fast scrolling in TPW

Paint methods, virtual screens and fast scrolling in TPW

Hi there,

I'm writeing a program that will want to display some text and graphics in a
window, and it'll probably be  more data than can fit into a standard window.
At the moment I use that standard paint method in TPW to redraw the screen. How
ever this is kinda slow for scrolling. I was wondering if there was a way to
like draw the stuff onto a sort of virtual screen and then just scroll around
that, so I would only have to draw it once, and I could then just copy
rectangular bits of that to the screen as the user scrolls about. Is this
possible or I just being needlessly pedantic?

TTFN and TC, Michael Dales, official nice person.
----------------------------------------------------------------------------
Home page editor for    email : 94021...@udcf.gla.ac.uk
Glasgow University      voice : 0141-776 5789
HTML Association        snail : 97 Iona Way, Kirkintilloch,
(WebSoc).                       Glasgow, G66 3PU.
So there.               URL   : http://www.gla.ac.uk/Clubs/WebSoc/~9402198d/
----------------------------------------------------------------------------

 

Re:Paint methods, virtual screens and fast scrolling in TPW


Quote
Michael Dales wrote:

> At the moment I use that standard paint method in TPW to redraw the screen. How
> ever this is kinda slow for scrolling. I was wondering if there was a way to
> like draw the stuff onto a sort of virtual screen and then just scroll around

You need to create a Memory Device Context. Real fun stuff.... :*)
Drawing on that instead of the screen (using the exact same functions/methods)
you have a bitmap of the drawing which you can BitBlt to the screen in WM_PAINT.
The real problem is when do you do the actual drawing. If you first draw on the
memory DC, and the BitBlt, there'll be a nice pause while your app draws off-screen.
If you draw first on-screen and then off-screen you'll get the same prob., but
now the user has something to look at.
If you draw on the screen and then BitBlt that to the memory DC, you'll have
interesting effects if there's an 'Always-On-Top' window 'above' your client
area (like Clock.EXE or something). Not a very nice problem. You might actually
consider drawing each 'thing' (line, point, whatever) first on-screen and then
off-screen, but that'll be slooooow.... :*)

Good luck!!! You'll need it... :*)

M.

--
Martin Larsson, author of several unknown utilities for DOS and Windows.
mailto:martin.lars...@delfi-data.msmail.telemax.no
http://www.delfi.infonet.no
X.400:G=martin;S=larsson;O=delfi-data;P=msmail;A=telemax;C=no

Re:Paint methods, virtual screens and fast scrolling in TPW


Quote
Michael Dales wrote:

> At the moment I use that standard paint method in TPW to redraw the screen. How
> ever this is kinda slow for scrolling. I was wondering if there was a way to
> like draw the stuff onto a sort of virtual screen and then just scroll around

First, RTFM (search for scrolling functions).  Second, if you're making, say, a
fast scrolling game, where speed is paramount, consider the MS game SDK (wings).

Hope this helps,

- Alf

Other Threads