home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / lisp / mcl / 1104 < prev    next >
Encoding:
Internet Message Format  |  1992-07-31  |  2.1 KB

  1. Path: sparky!uunet!olivea!apple!cambridge.apple.com!@explorer.dgp.toronto.edu:markt@dgp.toronto.edu
  2. From: markt@dgp.toronto.edu ("Mark A. Tapia")
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re:  Trying to resize PICT using GWorlds (fwd)
  5. Message-ID: <92Jul30.210515edt.144121@explorer.dgp.toronto.edu>
  6. Date: 31 Jul 92 01:05:13 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 40
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10. Original-To: info-mcl-request@cambridge.apple.com
  11. Original-Cc: info-mcl@cambridge.apple.com
  12.  
  13. Marty Kenner (makenner@mmm.com) writes about problems creating a picture:
  14.  I am again (still?) working on an application making heavy use of PICTs
  15.  and I need to be able to scale a PICT and write it to a file.
  16.  
  17.   I was trying to do what I do in C -
  18.  
  19.         get source picture from file
  20.         create an offscreen GWorld
  21.         lock its pixels
  22.         cliprect the target rectangle
  23.         draw the source PICT into the target rectangle
  24.         open a new PICT
  25.         copybits the pixmap of the offscreen GWorld onto itself
  26.         close the new PICT and write to file
  27.   ...
  28.   with the result that the picture is damaged and contains garbage 
  29.   (unimplemented commands).
  30.  
  31. He then mentions that he uses the oodles of utils calls to create the
  32. GWorld and using the call to copy bits.
  33.  
  34. One solution is to use the pict-svm and resource-svm methods for drawing
  35. scaled versions of pictures (and pict resources).  The code is in oodles-of
  36. utils in the mixin-madness in simple-view-mixins. Another way is to
  37. use the following steps:
  38.     get source picture from file
  39.     cliprect the target rectangle
  40.     create a picture:
  41.       #_openPicture (with the appropriate rect)
  42.       #_drawPicture (with the appropriate rect for scaling)
  43.       #_closePicture
  44.       return the resulting picture
  45.         write the picture to the file
  46. The resulting picture is a true picture with all of the calls in
  47. place. If you're picture is color you'll have to use the correct
  48. color "window". For an example of a program that saves and restores
  49. portions of the screen bit map, see menu-enhancements.hqx (in
  50. the contrib directory) which contains oou-utils.lisp.
  51.  
  52. mark
  53.