home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20527 < prev    next >
Encoding:
Internet Message Format  |  1993-01-02  |  2.4 KB

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