[comp.sys.mac.programmer] PICT1 on Mac II

lim@iris.ucdavis.edu (Lloyd Lim) (07/11/89)

I'm writing a program that creates PICT files that must be compatible with all
machines so I'm restricted to PICT1.  I was thinking of creating the file by
replacing the StdPutPic procedure with one that simply writes the bytes to a
file with the appropriate header.

However, on a Mac II, I suppose PICT2 opcodes would be generated.  To write
a PICT1 file, do I have to skip QuickDraw and process it myself?  Since Apple
always wants you to use their picture mechanisms, there must be a cleaner way
(I hope)?

+++
Lloyd Lim     Internet: lim@iris.ucdavis.edu (128.120.57.20)
              Compuserve: 72647,660
              US Mail: 146 Lysle Leach Hall, U.C. Davis, Davis, CA 95616

lsr@Apple.COM (Larry Rosenstein) (07/12/89)

In article <4868@ucdavis.ucdavis.edu> lim@iris.ucdavis.edu (Lloyd Lim) 
writes:
> I'm writing a program that creates PICT files that must be compatible 
with all
> machines so I'm restricted to PICT1.  

With the appropriate system (post-System 4.1), all machines can read PICT 
2 files, and convert the color information into black and white.  The 
result is exactly as if you displayed the color picture on a black and 
white screen attached to a Mac II.  

Machines with an older system will simply ignore the PICT 2 entirely; the 
header in a PICT 2 was designed so that older systems would not bomb, but 
would simply skip the entire picture.

> I was thinking of creating the file by
> replacing the StdPutPic procedure with one that simply writes the bytes 
to a
> file with the appropriate header.

That's the most efficient way to do it.  One thing you have to do is 
update the picSize field in the picture as you add bytes to it.  QuickDraw 
uses the picSize field to do padding in the process of building the 
picture.  (I spent a lot of time figuring that out.)

> However, on a Mac II, I suppose PICT2 opcodes would be generated.  To 
write
> a PICT1 file, do I have to skip QuickDraw and process it myself?

According to Inside Mac volume 5 (page V-86) if you create the picture in 
a black and white grafPort, you get an old style picture.  To get a PICT 
2, you would create the picture in a color grafPort.  In any event, I 
don't think you have to worry about creating new style PICT files, since 
old machine can read them.


Larry Rosenstein, Apple Computer, Inc.
Object Specialist

Internet: lsr@Apple.com   UUCP: {nsc, sun}!apple!lsr
AppleLink: Rosenstein1