home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!apple!cambridge.apple.com!@explorer.dgp.toronto.edu:markt@dgp.toronto.edu
- From: markt@dgp.toronto.edu ("Mark A. Tapia")
- Newsgroups: comp.lang.lisp.mcl
- Subject: Re: Trying to resize PICT using GWorlds (fwd)
- Message-ID: <92Jul30.210515edt.144121@explorer.dgp.toronto.edu>
- Date: 31 Jul 92 01:05:13 GMT
- Sender: info-mcl-request@cambridge.apple.com
- Lines: 40
- Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
- Original-To: info-mcl-request@cambridge.apple.com
- Original-Cc: info-mcl@cambridge.apple.com
-
- Marty Kenner (makenner@mmm.com) writes about problems creating a picture:
- I am again (still?) working on an application making heavy use of PICTs
- and I need to be able to scale a PICT and write it to a file.
-
- I was trying to do what I do in C -
-
- get source picture from file
- create an offscreen GWorld
- lock its pixels
- cliprect the target rectangle
- draw the source PICT into the target rectangle
- open a new PICT
- copybits the pixmap of the offscreen GWorld onto itself
- close the new PICT and write to file
- ...
- with the result that the picture is damaged and contains garbage
- (unimplemented commands).
-
- He then mentions that he uses the oodles of utils calls to create the
- GWorld and using the call to copy bits.
-
- One solution is to use the pict-svm and resource-svm methods for drawing
- scaled versions of pictures (and pict resources). The code is in oodles-of
- utils in the mixin-madness in simple-view-mixins. Another way is to
- use the following steps:
- get source picture from file
- cliprect the target rectangle
- create a picture:
- #_openPicture (with the appropriate rect)
- #_drawPicture (with the appropriate rect for scaling)
- #_closePicture
- return the resulting picture
- write the picture to the file
- The resulting picture is a true picture with all of the calls in
- place. If you're picture is color you'll have to use the correct
- color "window". For an example of a program that saves and restores
- portions of the screen bit map, see menu-enhancements.hqx (in
- the contrib directory) which contains oou-utils.lisp.
-
- mark
-