Path: utzoo!mnetor!uunet!husc6!mit-eddie!mit-amt!mit-caf!lsrhs!schmidt
From: schmidt@lsrhs.UUCP (Chris Schmidt)
Newsgroups: comp.sys.mac
Subject: Re: PICT's in LSC
Message-ID: <667@lsrhs.UUCP>
Date: 11 Dec 87 17:36:43 GMT
References:     <2592@cbdkc1.ATT.COM>
Reply-To: schmidt@lsrhs.UUCP (Chris Schmidt)
Organization: Lincoln-Sudbury Regional High School, Sudbury, MA
Lines: 40
Keywords: Stress! Frustration!

In article <2592@cbdkc1.ATT.COM> joe@cbdkc1.UUCP (Joseph !. Judge) writes:


>WHY don't these work?  WHAT specific code, exactly, would take a PICT rsrc and
>show it in a screen???????

Ok, let's see how good my memory is.  Once I drew PICT resources all over the
screen of my original Mac 128k using Mainstay's Assembler (nigh on two year
ago -- pull up a seat sunny, toast them dogs nearer the fire . . .)

You've done the right thing creating the PICT resource.  Now your code's
gotta do something *like* the following.

	PicHandle	mypic;
	Handle		myres;
	Rect		destrec;


	ClipRect(destrec); 		/*an odd, but necessary thing*/
	mypic = OpenPic(destrec);
	myres = GetResource("\pPICT",ID);

	/* Careful now -- I don't know if your compiler will regard
	*mypic as a proper lvalue -- I'm translating from assembly . . .*/

	*mypic = *myres;
	DrawPicture(mypic);

Basically, you're fooling the machine into thinking that that resource is a 
picture record you've defined on the fly.  Obviously, to make this more
secure, you should do copy the resource data, not just juggle pointers.
Again, it works in assembly, where you can swap the contents of one address
register for another -- I'm a little uncomfortable with the way it looks
in C (and I'm WAY too lazy to try it myself). Hope this is helpful.

	
-- 
------------------------------------------------------------------------
Chris Schmidt/Lincoln-Sudbury High School/390 Lincoln Rd/Sudbury/Ma/01776
	(617) 926-3242 ----->   mit-caf!lsrhs!schmidt@eddie.mit.edu