Per Westermark wrote:
> This is how graphics works in most graphical environments, i.e. it is u=
p
> to the application to keep track of what is drawn and to repaint the
> window on request.
>=20
> Paint to a bitmap and redraw the bitmap suitably scrolled whenever the
> window gets a repaint command. Or work with vector graphics, i.e. keep =
a
> list of all draw commands needed to redraw the graphics and then walk
> through the list and repaint all lines, circles, characters.
Added to this:
Note that Windows can move the entire contents of a window, and you only =
need to repaint=20
the "invalid" rectangle (a small portion) of your window, giving you grea=
t speedups (and=20
to avoid flicker). Though you have to calculate that rectangle yourself. =
Process the=20
scrollbar messages, and retrieve the amount that was scrolled, then use t=
he=20
ScrollWindowEx() function to move the contents of your window (your lines=
, etc.), then=20
repaint the invalid rectangle (using BitBlt if you painted to a bitmap, o=
r any other=20
method). The invalid rectangle is what you scrolled into view.
The functions you should take a look at at the windows docs:
ScrollWindowEx()
BitBlt()
StretchBlt() // for zooming, maybe later
And of course "Bitmaps" in general.
The windows GDI functions will be more than sufficient for most drawings,=
and I assume it=20
will be enough for you too (no need for additional libraries).
--
Greetings,
Bal=E1zs
|