[comp.sys.mac] Displaying 'PICT's in Think Pascal 2.03

steelem@boulder.Colorado.EDU (STEELE MARK ALLEN) (03/04/90)

I am trying to write a program in Think Pascal 2.03 that will display a 
PICT resource. The problem is as follows: I created a resource with ResEdit
pasted the picture into the PICT resource number 400, I checked the size
of the rectangle, then in my project I used the command GetPicture(400) to
get the pict resource ( I remebered to check the box in the run options...)
then I set up a rectangle of the same size as the picture.rectangle, then
copied the picture into that rectangle on the screen as ugh!!! the mess 
that displays on the screen is nothing near what the PICT should be.
What am I forgetting?????
			-Mark Steele

omh@cs.brown.edu (Owen M. Hartnett) (03/04/90)

In article <17714@boulder.Colorado.EDU> steelem@boulder.Colorado.EDU (STEELE MARK ALLEN) writes:
>I am trying to write a program in Think Pascal 2.03 that will display a 
>PICT resource. The problem is as follows: I created a resource with ResEdit
>pasted the picture into the PICT resource number 400, I checked the size
>of the rectangle, then in my project I used the command GetPicture(400) to
>get the pict resource ( I remebered to check the box in the run options...)
>then I set up a rectangle of the same size as the picture.rectangle, then
>copied the picture into that rectangle on the screen as ugh!!! the mess 
>that displays on the screen is nothing near what the PICT should be.
>What am I forgetting?????
>			-Mark Steele

1) for starters, remember to lock down the picture handle before you draw.
(Yes, Virginia, DrawPicture does move memory).  

2) Are you *sure* that the rectangle is the same size as the picFrame
rectangle?

3) If you haven't got enough memory, the picture won't load in.  This will
give you a nil handle, which you should check for.

-Owen



Owen Hartnett				omh@cs.brown.edu.CSNET
Brown University Computer Science	omh@cs.brown.edu
					uunet!brunix!omh
"Don't wait up for me tonight because I won't be home for a month."

rcfische@polyslo.CalPoly.EDU (Raymond C. Fischer) (03/05/90)

In article <17714@boulder.Colorado.EDU> steelem@boulder.Colorado.EDU (STEELE MARK ALLEN) writes:
>I am trying to write a program in Think Pascal 2.03 that will display a 
>PICT resource. The problem is as follows: I created a resource with ResEdit
>pasted the picture into the PICT resource number 400, I checked the size
>of the rectangle, then in my project I used the command GetPicture(400) to
>get the pict resource ( I remebered to check the box in the run options...)
>then I set up a rectangle of the same size as the picture.rectangle, then
>copied the picture into that rectangle on the screen as ugh!!! the mess 
>that displays on the screen is nothing near what the PICT should be.
>What am I forgetting?????

It's hard to say just from your description, but it looks like you're _copying_
the PICT instead of _drawing_ it.  To display a PICT in a window do ...

pic := GetPicture (picId);
DrawRect := pic^^.picFrame;
DrawPicture (pic, DrawRect);

The picture will appear in the current window.  If the DrawRect is not the
same size as the original picture, then the result will be scaled accordingly.

Ray Fischer
rcfische@polyslo.calpoly.edu