' From: weber@brand.UUCP (Allan G. Weber)  Newsgroups: net.micro.mac $ Subject: Info on MacDraw file format Message-ID: <292@brand.UUCP> Date: 13 Sep 86 00:20:33 GMT% Date-Received: 17 Sep 86 22:08:03 GMT  Distribution: na+ Organization: U. of So. Calif., Los Angeles 
 Lines: 168  H I have seen some requests go by for information on the format of MacDrawL data files.  I deciphered some of the format while in the process of writingD a MacDraw to Impress program for printing MacDraw pictures on ImagenF printers.  The following is a files of notes I made on the format.  IfI anybody can fill in the holes or find mistakes I would appreciate hearing 	 about it.    				Allan Weber  				Weber%Brand@USC-ECL % 				...sdcrdcf!usc-oberon!brand!weber    -----------------------------    	MacDraw data file information   	Allan Weber (Weber@USC-ECLC) * 	USC Signal and Image Processing Institute   	Last edit: 16-Dec-85   I This file contains a description of the data records produced by "Macdraw J Version 1.7 3/18/85".  Some of the information in the data records has not= yet been deciphered and is indicated below by question marks.   G Note:  Many of the data structures for points and rectangles use 4-byte I "fixed-point numbers" instead of the normal 2-byte integers.  Fixed-point J numbers are described in "Inside Macintosh", page MI-11.  They are similarJ to integers with the addition of a 2-byte fractional part, thus yielding a1 number with the same range but greater precision.     J A MacDraw file starts with a 512 byte header.  There does not appear to beK any information in the header required for recreating the image on a device  like a laser printer.      			File header (512 bytes)   Offset	 0..213		? = 214..229	Enclosing rectangle for entire drawing (Fixed-point) 
 230..511	?      K After the file header is a sequence of data records, one for each object in H the image.  Each object data record starts with an 8-byte record header,J followed in most cases by varible-length object-dependent data.  The firstL byte in each of the record headers indicates the type of object.  At the end, of the file is a terminator (type 0) record.      		       Record header (8 bytes)   Offset  0	code 	0 = terminator		1 = text* 		2 = right angle vector	3 = sloped vector$ 		4 = rectangle		5 = round rectangle 		6 = ellipse		7 = arc 		8 = curve		9 = polygon1 		10= group	       11 = PICT data (from MacPaint)  1	lock	0 = unlocked, 1 = locked  2	?  3	? < 4	line	width code:  1 = 0 pixels, 2 = 1 pixel, 3 = 2 pixels, 		4 = 4 pixels, 5 = 6 pixels 5	pen	pattern number: 1..36  6	fill	pattern number: 1..36	 7	special  		for vectors, the arrow type 2 		 0 = ------, 1 = ----->, 2 = <-----, 3 = <----->* 		for round rectangles, the corner radius:7 		1 = 0", 2 = 1/8, 3 = 3/16, 4 = 1/4, 5 = 5/16, 6 = 3/8 ? 8..	An object-specific record (if any) follows after the header     2 	     Object Specific Data (follows record header)  $ 		    0: Terminator record (0 bytes)  E A terminator record is used to mark the end of the list of objects or < the end of a set of objects that have been grouped together.    2 	     1: Text record (20 bytes + length of string)   0..3	?C 4	style	0 = plain, 1 = bold, 2 = italic, 4 = underline, 8 = hollow, 
 		16 = shadow E 5	font	1 = Chicago, 2 = Geneva, 3 = New York, 4 = Monaco, 5 = Venice,  		6 = London, 7 = AthensA 6	size	1 = 9 pt, 2 = 10 pt, 3 = 12 pt, 4 = 14 pt, 5 = 18 pt, etc. 2 7	spacing	1 = single, 2 = three halves, 3 = double' 8	align	1 = left, 2 = center, 3 = right ' 9	angle	0 = normal		4 = flip horizontal $ 		1 = rotate right	5 = flip vertical6 		2 = upsidedown		6 = rotate right and flip horizontal6 		3 = rotate left		7 = rotate left and flip horizontal) 10:11	Number of characters in text string ( 12:19	Rectangle enclosing text (Integer)E 	(Note: the rectangle gives the location of the text BEFORE doing any / 	rotating and/or flipping according to byte 9.) 2 20	Start of text string (not terminated with null)    $ 		     2,3: Vector record (16 bytes)   0:7	Start point (Fixed-point)  8:15	End point (Fixed-point)    4 	    4,5,6: Rectangles and Ellipse record (16 bytes)  - 0:15	Rectangle enclosing object (Fixed-point)     ! 		       7: Arc record (20 bytes)   C 0:15	Rectangle enclosing ellipse used to generate arc (Fixed-point)  16:17	Start angle (degrees)  18:19	Extent of arc (degrees)     1 	      8: Curve record (32 bytes + 2 bytes/point)    0..1	?% 2:3	Number of bytes in rest of record I 4:5	Number of points in curve including start point and ending null point , 6:21	Rectangle enclosing curve (Fixed-point)8 22	1 = make closed (add final point same as first point) 23	? 24:31	Start point (Fixed-point) ? 32	Start of X,Y increment pairs (2 bytes/pair), 2's complement, $ 	terminated by a pair of zero bytes.    2 	     9: Polygon record (24 bytes + 8 bytes/point)   0..1	?% 2:3	Number of bytes in rest of record  4:5	Number of points in polygon , 6:21	Rectangle enclosing curve (Fixed-point)8 22	1 = make closed (add final point same as first point) 	2 = smoothed polygon  23	?D 24	Start of list of points in the polygon (Fixed-point), 8 bytes/pnt    # 		      10: Group record (32 bytes)   K A group record is used to indicate the beginning of a collection of objects I that have been grouped together using the Group command under the Arrange G menu.  The group contains all the following objects until a terminator   record is encountered.  ? 0:15	Rectangle enclosing all members in the group (Fixed-point)  16..31	?     			 11: PICT record (42+)    0..3	? 4:11	? Rectangle (Integer)/ 12:27	Rectangle enclosing picture (Fixed-point)  28..31	? 32:33	Width of picture in bytes  34:41	? Rectangle (Integer)  42..	Bitmap % ------------------------------------- 