[comp.sys.mac.programmer] Maybe I'm dumb but...

omh@nancy (Owen M. Hartnett) (02/26/88)

I can't figure out why this doesn't work:

Draw a Picture in MacPaint, save to Scrapbook, copy it out of Scrapbook
with ResEdit and paste into my application.

Still in ResEdit, open the picture (Open general) and alter the picFrame 
rectangle so that it is relative to point 0,0 (i.e. change the left coordinate
to 0 and adjust the right coordinate so that it maintains the same width, do
likewise for top and bottom).

Now, from my application, Get the picture, and call 
	DrawPicture(myPic,myPic^^.picFrame);

Now, wouldn't you expect the picture to get drawn in the upper left corner
of your window?  Nah...  It's somewhere in your window.

I've even done:

	FrameRect(myPic^^,picFrame);
	DrawPicture(myPic,myPic^^.picFrame);

and the Picture is *not* inside the Rectangle.

...and, if you try to install myPic in the windowPic field of your window,
you don't know where it's going to go, either.

Any ideas?




Owen Hartnett
Brown University Computer Science

omh@cs.brown.edu.CSNET 
omh%cs.brown.edu
{ihnp4,allegra}!brunix!omh

"Don't wait up for me tonight because I won't be home for a month."
			-W.C. Fields

lsr@Apple.COM (Larry Rosenstein) (03/02/88)

In article <23120@brunix.UUCP> omh@brunix.UUCP (Owen M. Hartnett) writes:
>
>alter the picFrame rectangle so that it is relative to point 0,0
>
>Now, from my application, Get the picture, and call 
>	DrawPicture(myPic,myPic^^.picFrame);
>
>Now, wouldn't you expect the picture to get drawn in the upper left corner
>of your window?  Nah...  It's somewhere in your window.

I think you should not modify the picture resource, but simply specify the
appropriate rectangle to DrawPicture.

If I had to guess at what was happening, I would say that the picture bytes
specify absolute coordinates and since the rectangle in the picture is the
same as that in the call to DrawPicture, Quickdraw would not offset the
coordinates when drawing the picture.

-- 
		 Larry Rosenstein,  Object Specialist
 Apple Computer, Inc.  20525 Mariani Ave, MS 32E  Cupertino, CA 95014
	    AppleLink:Rosenstein1    domain:lsr@Apple.COM
		UUCP:{sun,voder,nsc,decwrl}!apple!lsr