home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!malgudi.oar.net!hyperion!desire.wright.edu!jmatthews
- From: jmatthews@desire.wright.edu
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: QuickDraw
- Message-ID: <1993Jan2.000714.6391@desire.wright.edu>
- Date: 2 Jan 93 00:07:14 EST
- References: <1992Dec31.012947.10273@wuecl.wustl.edu> <1993Jan1.042143.12852@nntp.hut.fi>
- Organization: Wright State University
- Lines: 36
-
- In article <1993Jan1.042143.12852@nntp.hut.fi>, jmunkki@vipunen.hut.fi (Juri Munkki) writes:
- > In article <1992Dec31.012947.10273@wuecl.wustl.edu> ppc1@cec2.wustl.edu (Peter Pui Tak Chiu) writes:
- >>plane while i am showing a frame and then when the new frame is done, i set
- >>the viewing rectangle to the newly drawn frame and draw the next frame
- >>somewhere else.
- > Things do not work this way in QuickDraw. The way you do something like this
- > in QuickDraw is by creating an offscreen bitmap, pixmap or gworld. Instead
- > of thinking in terms of one huge page, think of various small pieces of paper,
- > some of which are visible (the screen bitmap[s]/pixmap[s]) and some of which
- > you can only copy to other places (like the screen).
-
- A related paradigm is to maintain a document sized offscreen gWorld. If
- the window in which you wish to display this document is smaller than
- the document itself (in either dimension), you can get fairly smooth
- scrolling by maintaining a "viewRect" whose size is that of the window's
- portRect but whose co-ordinates are relative to the gWorld's portRect.
- Updates are mostly just a call to CopyBits, eg.:
-
- CopyBits(GrafPtr(gWorldPtr)^.portBits,
- GrafPtr(windowPtr)^.portBits,
- viewRect, windowPtr^.portRect,
- srcCopy, nil);
-
- and scrolling is just OffsetRect(viewRect, dh, dv) followed by an
- update (either direct or via InvalRect).
-
- The document can anything from a printed page to a game map; the scheme
- works best when the document is fairly static but has to move/scroll
- quickly. The overhead for a big offscreen map may be prohibitive and
- there's the problem of handling insufficient memory cases, but it's nice
- conceptually.
-
- o----------------------------------------------------------------------------o
- | John B. Matthews, jmatthews@desire.wright.edu, disclaimer:= myViews <> WSU |
- | "Whom the gods would destroy, they first invite to program in C" |
- o----------------------------------------------------------------------------o
-