[comp.sys.mac.programmer] OpenPicture PICT --> PutScrap

wb1j+@andrew.cmu.edu (William M. Bumgarner) (02/22/89)

I have been hacking at this for a while (LSC v3.0p4), and have yet to get
anything to work...

I am creating a picture on the fly w/OpenPicture and subsequent calls to QD
routines followed by a close picture.

I want this picture to be put on the clipboard as type PICT... but it refuses
to go (the type of the 'board is correct, but the data is not there).

scrapPict = OpenPicture(rect);
draw some stuff;
ClosePicture

theErr = ZeroScrap();

theErr = PutScrap(sizeof(scrapPict), ScrapType, &scrapPict);

/* ScrapType = 'PICT' */

KillPicture(scrapPict);

----

Anyway, this fails to put the generated PICT onto the 'board...

I do have error checking on both ZeroScrap and PutScrap-- no errors are
occurring.  Everything compiles fine...

What obvious oversight have I made?

b.bum
wb1j+@andrew.cmu.edu

Thanks in advance.

tim@hoptoad.uucp (Tim Maroney) (02/23/89)

In article <4Y0OgUy00UgP0Kr0F2@andrew.cmu.edu> wb1j+@andrew.cmu.edu (William M. Bumgarner) writes:
>I am creating a picture on the fly w/OpenPicture and subsequent calls to QD
>routines followed by a close picture.
>
>I want this picture to be put on the clipboard as type PICT... but it refuses
>to go (the type of the 'board is correct, but the data is not there).
>
>theErr = ZeroScrap();
>theErr = PutScrap(sizeof(scrapPict), ScrapType, &scrapPict);
>KillPicture(scrapPict);

Should be:
	ZeroScrap();
	HLock(scrapPict);
	PutScrap(GetHandleSize(scrapPict), 'PICT', *scrapPict);
	HUnlock(scrapPict);
	KillPicture(scrapPict);
-- 
Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim
"The government of the United States is not, in any sense, founded
 on the Christian religion." -- George Washington