home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!mips!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!quads!jcav
- From: jcav@quads.uchicago.edu (JohnC)
- Subject: Re: Question: memory allocation in OpenPic()
- Message-ID: <1992Jul22.155456.3054@midway.uchicago.edu>
- Sender: news@uchinews.uchicago.edu (News System)
- Reply-To: jcav@midway.uchicago.edu
- Organization: The Royal Society for Putting Things on Top of Other Things
- References: <1992Jul22.063600.12458@midway.uchicago.edu>
- Date: Wed, 22 Jul 1992 15:54:56 GMT
- Lines: 49
-
- In article <1992Jul22.063600.12458@midway.uchicago.edu> blis@midway.uchicago.edu writes:
- >If I might indulge upon the patience of the fair readership of
- >comp.sys.mac.programmer, it would be to ask about OpenPic(), whose
- >full discription I do not know, as neither I or the nearest bookstores
- >has IM I.
- >
- >pascal PicHandle OpenPicture(const Rect *picFrame)
- >presumably sets the picSize element of the PicHandle based on
- ^^^^^^^
- The picSize field contains (for historic reasons) the low-order word of the
- 32-bit byte count of the picture data. You shouldn't use it anymore, but
- should instead call _GetHandleSize on the picture handle. You should also be
- aware that the size of the picture data bears little relation to the picFrame
- rectangle.
-
- >picFrame, but by what formula and what scale? I ask because it is
- >not clear to me how OpenPicture() allocates the appropriate memory
- >for the PicHandle, and what this appropriate amount would be.
-
- Between your _OpenPicture and _ClosePicture calls, all (well, most)
- Quickdraw calls are recorded into the picture, like a tape recorder. As
- each call is made, new data is added to the end of the picture, and the
- handle size increases as needed, a little (or a lot) at a time.
-
- >I naively hoped that something like
- >Rect myRet;
- >PicHandle picture;
- >
- >myRec.left=0;
- >myRec.right=500;
- >myRec.top=0;
- >myRec.bottom=300;
- >picture=OpenPicture(&myRec);
- > /*bunch of MoveTo, LineTo, etc..*/
- >ClosePicture();
- >
- >would work, but apparently I was wrong. This code seems to work
- >if I create an application instead of running from inside TC.
- >Have I done something stupid in configuring TC? Or have
- >I instead done something stupid in the code.
-
- Your code seems just fine. Could you be more specific as to what is going
- wrong?
-
- --
- John Cavallino | EMail: jcav@midway.uchicago.edu
- University of Chicago Hospitals | John_Cavallino@uchfm.bsd.uchicago.edu
- Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953
- B0 f++ c+ g++ k s++ e+ h- pv | Chicago, IL 60637
-