Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcso!cunniff From: cunniff@hpfcso.HP.COM (Ross Cunniff) Newsgroups: comp.sys.amiga.tech Subject: IFF FORM DR2D for structured graphics Message-ID: <9310003@hpfcso.HP.COM> Date: 24 Oct 89 14:54:26 GMT Organization: Hewlett-Packard, Fort Collins, CO, USA Lines: 403 89/10/03 The following is the format of the DR2D IFF FORM file produced by ProVector, a 2-dimensional structured graphics program. Each chunk is described by first giving the chunk ID (both in ASCII and in hex) and then giving the structure associated with the chunk, as well as any extra definitions that make sense. Coordinates are specified in IEEE format (see note 1 for a description of the IEEE format). Note that most chunks have both a chunk Size and an object Count. I know this is redundant; however, this allows the data structures to be extended in a compatible manner if it should become necessary in the far future. Please address questions and comments to: Ross Cunniff ...{ucbvax,hplabs}!hpfcla!cunniff cunniff%hpfcrt@hplabs.HP.COM (303)-229-4644 -or- (303)-482-6077 (or you can post reponses here...) FORM (0x464F524D) /* All drawings are a FORM */ struct FORMstruct { LONG ID; LONG Size; /* Total size of the file */ }; DR2D (0x44523244) /* ID of 2D drawing */ DRHD (0x44524844) /* Drawing header */ struct DRHDstruct { LONG ID; LONG Size; /* Always 18 */ IEEE p_xmin, p_ymin, /* Minimum and maximum */ p_xmax, p_ymax; /* coordinates of the drawing area */ }; CMAP (0x434D4150) /* Color map */ struct CMAPstruct { LONG ID; LONG Size; /* Usually 256*3, or 768 */ #define NUMCOLOR(Size) (Size / 3) UBYTE ColorMap[NUMCOLOR(Size)][3]; }; PREF (0x50524546) /* Application preferences */ struct PREFstruct { LONG ID; LONG Size; SHORT NumPrefs; UBYTE PrefStrings[Size - 2]; }; /* PrefStrings is an array containing strings of the form name=value The strings are null-separated in the array. Other applications may safely ignore this chunk, although it is requested that applications that manipulate DR2D files do not delete preferences settings that they do not understand. Some possible settings include: DATE=10/28/88 COPYRIGHT=Copyright 1989 by Taliesin, Inc. PROGRAM=ProVector ARTIST=Ross Cunniff LMARGIN=1 inch ORIENT=portrait ZOOM=1.0 1.0 2.0 2.0 */ PATT (0x50415454) /* 8x8 bitmap fill patterns */ /* OBSOLETE */ struct PATTstruct { LONG ID; LONG Size; /* 2 + 10*NumPatts */ SHORT NumPatts; /* Typically 16 */ UBYTE Patterns[NumPatts][10]; }; /* The 10 bytes of the patterns are arranged as follows: The first byte is the foreground color of the pattern The second byte is the background color of the pattern The next 8 bytes are the actual rows of the pattern; the leftmost pixel in a row is 0x80, the rightmost is 0x01. */ FONT (0x464F4E54) /* Font table */ struct FONTstruct { LONG ID; LONG Size; SHORT NumFonts; CHAR FontNames[Size-2]; }; /* FontNames is an array containing the names of all the fonts used in this drawing. The names are stored as null-separated strings. */ FILL (0x46494C4C) /* Object-oriented fill pattern table */ struct FILLstruct { LONG ID; LONG Size; /* 2 + sum(sizeof(Patterns)) */ SHORT NumPatts; /* Typically 16 */ CHAR Patterns[NumPatts]; /* See note 4 */ }; /* An object-oriented fill pattern consists of an arbitrary number of objects. The objects are tiled across the bounding box of the filled object, and clipped to the boundaries of that object. */ DSYM (0x4453594D) /* Define a symbol (NOT IMPLEMENTED) */ struct DSYMstruct { LONG ID; LONG Size; SHORT SymbID; /* Unique ID for this symbol */ SHORT NumObjs; UBYTE SymbChunk[Size-4]; /* See note 4 */ }; SYMB (0x53594D42) /* Use a symbol (NOT IMPLEMENTED) */ struct SYMBstruct { LONG ID; LONG Size; /* Always 22 */ SHORT SymbID; /* Which symbol */ USHORT WhichLayer; /* Which layer it's in */ IEEE XPos, YPos, /* Where to put it */ XMag, YMag, /* How big should it be? */ Rotation; /* Angle of rotation */ }; RAST (0x52415354) /* Raster image */ struct RASTstruct { LONG ID; LONG Size; IEEE XPos, YPos, /* Virtual coords */ XSize, YSize; /* Virtual size */ SHORT NumX, NumY, Depth; /* Actual size */ UBYTE Colors[3*(1<