cdrform.h

Go to the documentation of this file.
00001 // $Id: cdrform.h 751 2006-03-31 15:43:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // Structures for access to CDR data formats
00099 
00100 /*
00101 */
00102 
00103 
00104 // this is in the winoil to allow me to use the pragma pack thingy - compiler dependant
00105 
00106 #ifndef INC_CDRFORM
00107 #define INC_CDRFORM
00108 
00109 #include "cdrdata.h"
00110 
00111 #pragma pack(push, 1)   // set the compiler to pack to byte alignment - most handy!
00112                         // this must be matched by a pop at the end of the file to avoid
00113                         // things going deeply wrong.
00114 
00115 
00116 // IMPORTANT: all data in this file should be accessed through the macros in
00117 // intel\cdrdata.h, except for bytes.
00118 
00119 // Naming convention: Version 4 structures have suffix V4, version 3 suffix V3, version
00120 // 6 suffix V6. Unless a structure of the same name with the correct prefix exists for
00121 // a particular version, use the unsuffixed version 5 structure.
00122 
00123 //******************************************************************  CDR chunk types
00124 
00125 #define cdrT_CDR  0x20524443
00126 #define cdrT_CDR5 0x35524443
00127 #define cdrT_CDR4 0x34524443
00128 #define cdrT_doc  0x20636f64
00129 #define cdrT_mcfg 0x6766636d
00130 #define cdrT_page 0x65676170
00131 #define cdrT_layr 0x7279616c
00132 #define cdrT_lgob 0x626f676c
00133 #define cdrT_loda 0x61646f6c
00134 #define cdrT_obj  0x206a626f
00135 #define cdrT_grp  0x20707267
00136 #define cdrT_trfl 0x6c667274
00137 #define cdrT_trfd 0x64667274
00138 #define cdrT_filt 0x746c6966
00139 #define cdrT_fill 0x6c6c6966
00140 #define cdrT_lnkg 0x676b6e6c
00141 #define cdrT_otlt 0x746c746f
00142 #define cdrT_outl 0x6c74756f
00143 #define cdrT_arrt 0x74727261
00144 #define cdrT_arrw 0x77727261
00145 #define cdrT_lobj 0x6a626f6c
00146 #define cdrT_bpft 0x74667062
00147 #define cdrT_bmpf 0x66706d62
00148 #define cdrT_bmpt 0x74706d62
00149 #define cdrT_bmp  0x20706d62
00150 #define cdrT_stlt 0x746c7473
00151 #define cdrT_styl 0x6c797473
00152 #define cdrT_styd 0x64797473
00153 #define cdrT_vect 0x74636576
00154 #define cdrT_spnd 0x646e7073
00155 #define cdrT_bbox 0x786f6262
00156 #define cdrT_flgs 0x73676c66
00157 #define cdrT_fntt 0x74746e66
00158 #define cdrT_font 0x746e6f66
00159 #define cdrT_txsm 0x6d737874
00160 #define cdrT_tspc 0x63707374
00161 #define cdrT_ftbl 0x6c627466
00162 #define cdrT_lnkt 0x746b6e6c
00163 #define cdrT_btxt 0x74787462
00164 #define cdrT_strl 0x6c727473
00165 #define cdrT_btid 0x64697462
00166 #define cdrT_parl 0x6c726170
00167 #define cdrT_para 0x61726170
00168 #define cdrT_bnch 0x68636e62
00169 #define cdrT_bsch 0x68637362
00170 #define cdrT_envd 0x64766e65
00171 #define cdrT_CDST 0x54534443
00172 #define cdrT_CDT5 0x35544443
00173 
00174 #define DEFFOURCC(n, v) n = (((v&0xff)<<24)|((v&0xff00)<<8)|((v&0xff0000)>>8)|((v&0xff000000)>>24))
00175 
00176 enum {
00177     DEFFOURCC(cdrT_CDR6, 'CDR6'),
00178     DEFFOURCC(cdrT_CDT6, 'CDT6'),
00179     DEFFOURCC(cdrT_cmx1, 'cmx1')
00180 };
00181 
00182 //******************************************************************  Document global
00183 
00184 #define CDRCOORDS_TO_MILLIPOINTS    72
00185 
00186 typedef struct {
00187     WORD PageX;             // size of page
00188     WORD PageY;
00189     WORD unknown1;
00190     WORD Orientation;       // orientation of page - doesn't affect pagex and pagey
00191     BYTE unknown2[48];
00192 } cdrfPageInfo;             // in a doc.mcfg chunk
00193 
00194 typedef struct {
00195     WORD unknown[2];
00196     WORD PageY;             // size of page divided by two
00197     WORD PageX;
00198 } cdrfPageInfoV3;           // version 3, in page.mcfg
00199 
00200 #define cdrf_ORIENTATION_LANDSCAPE  1
00201 #define cdrf_ORIENTATION_PORTRAIT   0
00202 
00203 typedef struct {
00204     WORD Size;
00205     WORD unknown[15];
00206     BYTE Name[32];
00207 } cdrfMasterLayerInfo;      // only gets the name on a master page
00208 
00209 #define cdrfLAYERFLAGS_INVISIBLE    0x0100
00210 #define cdrfLAYERFLAGS_LOCKED       0x0010
00211 
00212 typedef struct {
00213     WORD Size;
00214     BYTE unknown[23];
00215     BYTE Name[32];
00216 } cdrfMasterLayerInfoV3;
00217 
00218 typedef struct {
00219     SWORD X, Y;
00220 } cdrfCoord;
00221 
00222 typedef struct {
00223     SWORD x0, y0, x1, y1;
00224 } cdrfBBox;
00225 
00226 //******************************************************************  General offset header
00227 
00228 typedef struct {
00229     WORD Size;
00230     WORD NOffsets;          // number of offsets 
00231     WORD OffsetsOffset;     // offset to list of offsets
00232     WORD TypesOffset;       // offset to list of types (reverse order)
00233     WORD ObjectType;
00234 } cdrfOffsetHeader;
00235 
00236     // offset types, for objects
00237 #define cdrfOBJOFFSETTYPE_COORDS        0x001e
00238 #define cdrfOBJOFFSETTYPE_FILL          0x0014
00239 #define cdrfOBJOFFSETTYPE_LINE          0x000a
00240 #define cdrfOBJOFFSETTYPE_TRANSFORM_V3  0x0064
00241 #define cdrfOBJOFFSETTYPE_STYLE         0x00c8
00242 #define cdrfOBJOFFSETTYPE_LENS          0x1f40          // only in version 5
00243 
00244 #define cdrfOBJOFFSETTYPE_PATHTEXT1     0x0bb8
00245 #define cdrfOBJOFFSETTYPE_PATHTEXT2     0x0bc2
00246 #define cdrfOBJOFFSETTYPE_POWERCLIP     0x1f45
00247 
00248 //******************************************************************  Transformations
00249 
00250 typedef struct {
00251     WORD Size;
00252     WORD NTransforms;           // number of transformations
00253     WORD unknown[3];
00254     WORD TransformOffsets[4];   // offsets to the transformations
00255 } cdrfTransform;                // trfd chunk
00256 
00257 typedef struct {
00258     WORD Type;                  // type of transformation
00259 } cdrfTransformHeader;
00260 
00261 #define cdrfTRANSFORMTYPE_ENVELOPE      1
00262 #define cdrfTRANSFORMTYPE_PERSPECTIVE   2
00263 #define cdrfTRANSFORMTYPE_EXTRUDE       4
00264 #define cdrfTRANSFORMTYPE_MATRIX        8
00265 
00266 typedef struct {
00267     WORD Type;
00268     BYTE Transform[8*6];        // elements, stored as 8 byte IEEE floats, but last 4
00269                                 // bytes first
00270 } cdrfTransformMatrix;
00271 
00272 typedef struct {
00273     WORD unknown[2];
00274     SWORD Ox0, Oy1, Ox1, Oy0;
00275     cdrfCoord NewCorners[4];
00276 } cdrfPerspectiveTransform;
00277 
00278 typedef struct {
00279     WORD Type;
00280     cdrfPerspectiveTransform Trans;
00281 } cdrfPerspectiveEntry;
00282 
00283 typedef struct {
00284     WORD Size;
00285     WORD NTransforms;
00286     WORD OffsetsStart;
00287 } cdrfTransformV4;
00288 
00289 typedef struct {
00290     WORD Type;
00291     WORD Transform[2*6];        // stored as fixed point 16.16 numbers for a, b, d and e
00292                                 // and doc coords for c and f.
00293 } cdrfTransformMatrixV4;
00294 
00295 typedef struct {
00296     WORD unknown;
00297     WORD NTransforms;
00298 } cdrfTransformV3;      // followed by transform entries
00299 
00300 typedef struct {
00301     WORD Type;
00302     WORD unknown[2];
00303     WORD Offset;
00304     WORD unknown2;
00305 } cdrfTransformEntryV3;
00306 
00307 typedef struct {
00308     WORD Transform[2*6];        // as for V4
00309 } cdrfTransformMatrixV3;
00310 
00311 typedef struct {
00312     WORD unknown[2];
00313     SWORD Ox0, Oy0, Ox1, Oy1;
00314     WORD unknown2[4];
00315     WORD NCoords;               // number of coordinates following
00316     cdrfCoord Coords[25];
00317 } cdrfTransformEnvelopeV3;
00318 
00319 #define cdrfTRANSFORMTYPE_MATRIX_V3         0x8c
00320 #define cdrfTRANSFORMTYPE_EXTRUDE_V3        0x3c
00321 #define cdrfTRANSFORMTYPE_PERSPECTIVE_V3    0x28
00322 #define cdrfTRANSFORMTYPE_ENVELOPE_V3       0x14
00323 
00324 // perspective in 4 and 5 files...
00325 
00326 typedef struct {
00327     WORD Type;
00328     WORD unknown[2];
00329     WORD Ox0, Oy0, Ox1, Oy1;
00330     WORD Corners[4];                // coords numbers of the corners of the mould
00331 } cdrfTransformEnvelope;
00332 
00333 // and the number of coords is in the object type field
00334 #define cdrfENVELOPEOFFSETTYPE_COORDS   0x001e
00335 #define cdrfENVELOPEOFFSETTYPE_TYPES    0x0028
00336 
00337 typedef struct
00338 {
00339     WORD    cf11a;
00340     SWORD   cf11b;
00341     WORD    cf21a;
00342     SWORD   cf21b;
00343     WORD    cf31a;
00344     SWORD   cf31b;
00345     FLOAT4  f41;
00346     WORD    cf12a;
00347     SWORD   cf12b;
00348     WORD    cf22a;
00349     SWORD   cf22b;
00350     WORD    cf32a;
00351     SWORD   cf32b;
00352     FLOAT4  f42;
00353     WORD    cf13a;
00354     SWORD   cf13b;
00355     WORD    cf23a;
00356     SWORD   cf23b;
00357     WORD    cf33a;
00358     SWORD   cf33b;
00359     FLOAT4  f43;
00360 
00361     SWORD   nXRotation;
00362     SWORD   nYRotation;
00363     SWORD   nZRotation;
00364     SWORD   Cx,Cy;
00365     SDWORD  Cz;         // camera positions
00366 } cdrfTransformExtrudeV3;
00367  
00368 typedef struct          // versions 4,5,6
00369 {
00370     WORD    Type;                   // from it's header
00371     WORD    cf11a;
00372     SWORD   cf11b;
00373     WORD    cf21a;
00374     SWORD   cf21b;
00375     WORD    cf31a;
00376     SWORD   cf31b;
00377     SDWORD  f41;
00378     WORD    cf12a;
00379     SWORD   cf12b;
00380     WORD    cf22a;
00381     SWORD   cf22b;
00382     WORD    cf32a;
00383     SWORD   cf32b;
00384     SDWORD  f42;
00385     WORD    cf13a;
00386     SWORD   cf13b;
00387     WORD    cf23a;
00388     SWORD   cf23b;
00389     WORD    cf33a;
00390     SWORD   cf33b;
00391     SDWORD  f43;
00392 
00393     SWORD   nXRotation;
00394     SWORD   nYRotation;
00395     SWORD   nZRotation;
00396     SWORD   Cx,Cy;
00397     SDWORD  Cz;         // camera positions
00398 } cdrfTransformExtrude;
00399 
00400 //******************************************************************  Object types
00401 
00402 #define cdrfLINKTYPE_EXTRUDE    0x8
00403 #define cdrfLINKTYPE_CONTOUR    0xf
00404 #define cdrfLINKTYPE_POWERLINE  0xd
00405 #define cdrfLINKTYPE_BLEND      0x7
00406 
00407 //******************************************************************  Object types
00408 
00409 // version 3 numbers are one less than in other versions!
00410 #define cdrfOBJTYPE_V3ADD       1
00411 
00412 #define cdrfOBJTYPE_RECTANGLE   1
00413 #define cdrfOBJTYPE_ELLIPSE     2
00414 #define cdrfOBJTYPE_PATH        3
00415 #define cdrfOBJTYPE_TEXT        4
00416 #define cdrfOBJTYPE_BITMAP      5
00417 #define cdrfOBJTYPE_TEXTSTORY   6
00418 
00419 //******************************************************************  Colour definitions
00420 
00421 #define cdrfCOLOURTYPE_PANTONE_SPOT     0x0001
00422 #define cdrfCOLOURTYPE_CMYK             0x0002
00423 #define cdrfCOLOURTYPE_CMYK255          0x0003
00424 #define cdrfCOLOURTYPE_CMY              0x0004
00425 #define cdrfCOLOURTYPE_RGB              0x0005
00426 #define cdrfCOLOURTYPE_HSV              0x0006
00427 #define cdrfCOLOURTYPE_GREYSCALE        0x0009
00428 #define cdrfCOLOURTYPE_LAB              0x000C
00429 
00430 #define cdrfCOLOURSUBTYPE_FOCOLTONE     0x0008
00431 #define cdrfCOLOURSUBTYPE_PANTONE_PROC  0x0002
00432 #define cdrfCOLOURSUBTYPE_TRUMATCH      0x0001
00433 
00434 #define cdrfCOLOURTYPEV4_PANTONE_SPOT   0x0000
00435 #define cdrfCOLOURTYPEV4_CMYK           0x0001
00436 
00437 #define cdrfCOLOURTYPEV3_PANTONE        0x0000
00438 #define cdrfCOLOURTYPEV3_CMYK           0x0001
00439 
00440 typedef struct {
00441     BYTE Type;
00442     union {
00443         struct {
00444             BYTE C, M, Y, K;
00445         } CMYK;
00446         struct {
00447             WORD ColourNumber;
00448             WORD Tint;
00449         } Pantone;
00450     } Data;
00451 } cdrfColourV3;
00452 
00453 typedef struct {
00454     union {
00455         struct {
00456             WORD  type;
00457             WORD  subtype;
00458             WORD  unknown[2];
00459             union {
00460                 struct {
00461                     BYTE c, m, y, k;  /* range 0 - 100 */
00462                 } cmyk;
00463                 struct {
00464                     BYTE b, g, r;     /* range 0 - 255 */
00465                 } rgb;
00466                 struct {
00467                     WORD h;
00468                     BYTE s, v;        /* range 0 - 255 */
00469                 } hsv;
00470                 struct {
00471                     BYTE i;           /* range 0 - 255 */
00472                 } greyscale;
00473                 struct {
00474                     WORD colournumber;
00475                     WORD tint;        /* range 0 - 100 */
00476                 } pantone_spot;
00477             } data;
00478         } v5;
00479         struct {
00480             WORD type;
00481             union {
00482                 struct {
00483                     WORD c, m, y, k;     /* range 0 - 100 */
00484                 } cmyk;
00485                 struct {
00486                     WORD colournumber;
00487                     WORD tint;
00488                 } pantone_spot;
00489             } data;
00490         } v4;
00491         cdrfColourV3 v3;
00492     } data;
00493 } cdrfColour;
00494 
00495 
00496 //******************************************************************  Fills
00497 
00498 typedef struct {
00499     DWORD FillReference;
00500     WORD  FillType;
00501     WORD  unknown;
00502 } cdrfFillHeader;
00503 
00504 #define cdrfFILLTYPE_NONE       0x0000
00505 #define cdrfFILLTYPE_FLAT       0x0001
00506 #define cdrfFILLTYPE_GRADUATED  0x0002
00507 #define cdrfFILLTYPE_PATTERN    0x0007
00508 #define cdrfFILLTYPE_VECTOR     0x000a
00509 #define cdrfFILLTYPE_TEXTURE    0x000b
00510 
00511 typedef struct {
00512     cdrfFillHeader Header;
00513     cdrfColour Colour;
00514     WORD unknown2[5];
00515 } cdrfFillFlat;
00516 
00517 typedef struct {
00518     cdrfFillHeader Header;
00519     WORD GradFillType;
00520     WORD unknown[5];
00521     SWORD Pad;                      // percentage
00522     SWORD Angle;                        // if applicable, * 10 of actual value */
00523     SWORD HorizontalCentreOffset;   // percentage */
00524     SWORD VerticalCentreOffset;
00525     WORD unknown2;
00526     WORD ColourType;
00527     WORD NColours;                  // number of colours following */
00528 } cdrfFillGraduated;
00529 
00530 #define cdrfGRADFILLTYPE_LINEAR         1
00531 #define cdrfGRADFILLTYPE_RADIAL         2
00532 #define cdrfGRADFILLTYPE_CONICAL        3
00533 #define cdrfGRADFILLTYPE_SQUARE         4
00534 
00535 #define cdrfGRADFILLCOLOURTYPE_DIRECT                   0
00536 #define cdrfGRADFILLCOLOURTYPE_RAINBOW_CLOCKWISE        1
00537 #define cdrfGRADFILLCOLOURTYPE_RAINBOW_ANTICLOCKWISE    2
00538 #define cdrfGRADFILLCOLOURTYPE_CUSTOM                   3
00539 
00540 typedef struct {
00541     cdrfColour Colour;              // alignment problems
00542     WORD Percentage;                // percentage along line of fill this colour starts
00543 } cdrfFillGradColour;
00544 
00545 #define cdrfFILLTYPEV3_NONE     0x00
00546 #define cdrfFILLTYPEV3_FLAT     0x01
00547 #define cdrfFILLTYPEV3_LINEAR   0x02
00548 #define cdrfFILLTYPEV3_RADIAL   0x04
00549 #define cdrfFILLTYPEV3_PATTERN  0x07
00550 #define cdrfFILLTYPEV3_VECTOR   0x0a
00551 
00552 typedef struct {
00553     BYTE Type;
00554     union {
00555         struct {
00556             cdrfColourV3 Colour;
00557         } Flat;
00558         struct {
00559             SWORD Angle;
00560             cdrfColourV3 Colour1;
00561             cdrfColourV3 Colour2;
00562             BYTE unknown[7];
00563             SWORD Pad;
00564             SWORD HorizontalCentreOffset;
00565             SWORD VerticalCentreOffset;
00566         } Grad;
00567         struct {
00568             DWORD Reference;
00569             SWORD SizeX;
00570             SWORD SizeY;
00571             SWORD OffsetX;
00572             SWORD OffsetY;
00573             BYTE unknown[3];
00574             cdrfColourV3 Colour1;
00575             cdrfColourV3 Colour2;   
00576         } Pattern;
00577         struct {
00578             WORD Reference;
00579             SWORD SizeX;
00580             SWORD SizeY;
00581             SWORD OffsetX;
00582             SWORD OffsetY;
00583         } Vector;
00584     } Data;
00585 } cdrfFillV3;
00586 
00587 typedef struct {
00588     cdrfFillHeader Header;
00589     DWORD Reference;            // reference of the pattern
00590     WORD SizeX, SizeY;          // size of tile (CDR units)
00591     SWORD OffsetX, OffsetY;     // percent size of tile offsets
00592     SWORD TileOffsets;          // percent offset in tiles (sort of staggers them)
00593     WORD TileOffsetType;        // row or column
00594     cdrfColour Colour1;
00595     cdrfColour Colour2;
00596 } cdrfFillPattern;
00597 
00598 #define cdrfTILEOFFSETTYPE_ROW      0
00599 #define cdrfTILEOFFSETTYPE_COLUMN   1
00600 
00601 typedef struct {
00602     cdrfFillHeader Header;
00603     WORD VectorReference;       // reference of the vectors we need to fill the
00604                                 // thing with
00605                                 // names an parameters of the texture follow    
00606 } cdrfFillTexture;
00607 
00608 typedef struct {
00609     cdrfFillHeader Header;
00610     WORD VectorReference;       // reference to the nice (?) vector list
00611     SWORD SizeX;
00612     SWORD SizeY;                // size of tile
00613     SWORD OffsetX;
00614     SWORD OffsetY;              // offset of first tile
00615     SWORD TileOffsets;          // stagger type thing
00616 } cdrfFillVector;
00617 
00618 //******************************************************************  Lens
00619 
00620 typedef struct {
00621     BYTE Type;
00622     BYTE unknown[4];
00623     BYTE SubType;
00624     WORD Percent;
00625 } cdrfLensDefn;
00626 
00627 #define cdrfLENSTYPE_TRANSPARENT    0x01
00628 
00629 #define cdrfTRANSPARENTTYPE_MIX     0
00630 #define cdrfTRANSPARENTTYPE_STAINED 1
00631 #define cdrfTRANSPARENTTYPE_BLEACH  2
00632 #define cdrfTRANSPARENTTYPE_CONTRAST    13
00633 #define cdrfTRANSPARENTTYPE_SATURATE    16
00634 #define cdrfTRANSPARENTTYPE_DARKEN      19
00635 #define cdrfTRANSPARENTTYPE_LIGHTEN     22
00636 #define cdrfTRANSPARENTTYPE_BRIGHTNESS  25
00637 #define cdrfTRANSPARENTTYPE_LUMINOSITY  28
00638 
00639 //******************************************************************  Outlines
00640 
00641 typedef struct {
00642     DWORD OutlineReference;
00643     WORD  Flags;
00644     WORD  EndStyle;
00645     WORD  JoinStyle;
00646     WORD  LineThickness;            // in 1000ths of an inch
00647     WORD  NibStrech;                // percentage
00648     WORD  NibAngle;                 // angle * 10
00649     cdrfColour Colour;
00650     WORD  unknown[5];
00651     WORD  NDashSegments;
00652     WORD  DashSegments[10];
00653     DWORD StartArrowReference;      // or zero for no arrow
00654     DWORD EndArrowReference;
00655 } cdrfOutline;
00656 
00657 #define cdrfOUTLINE_NO_ARROWHEAD        0
00658 
00659 #define cdrfOUTLINE_DEFAULT_WIDTH (3*72)
00660 
00661 #define cdrfOUTLINEFLAGS_NOOUTLINE      0x01
00662 #define cdrfOUTLINEFLAGS_NODASH         0x02
00663 #define cdrfOUTLINEFLAGS_BEHINDFILL     0x10
00664 #define cdrfOUTLINEFLAGS_SCALEWITHOBJ   0x20
00665 
00666 #define cdrfENDSTYLE_BUTT       0
00667 #define cdrfENDSTYLE_ROUNDED    1
00668 #define cdrfENDSTYLE_SQUARE     2
00669 
00670 #define cdrfJOINSTYLE_SQUARE    0
00671 #define cdrfJOINSTYLE_ROUNDED   1
00672 #define cdrfJOINSTYLE_BEVEL     2
00673 
00674 #define cdrfOUTLINEFLAGSV3_STROKED          0x01
00675 #define cdrfOUTLINEFLAGSV3_SCALEWITHOBJECT  0x80
00676 
00677 #define cdrfMAX_DASH_ELEMENTS   10
00678 
00679 typedef struct {
00680     BYTE Flags;
00681     SWORD LineThickness;
00682     SWORD NibStrech;
00683     SWORD NibAngle;         // * 10
00684     cdrfColourV3 Colour;
00685     BYTE unknown[7];
00686     BYTE NDashSegments;     // zero for no dashes
00687     BYTE DashSegments[10];
00688     WORD JoinStyle;
00689     BYTE EndStyle;
00690     BYTE EndStyle2;         // seperate style for start and end? They always have the same value
00691     DWORD StartArrowReference;
00692     DWORD EndArrowReference;
00693 } cdrfOutlineV3;
00694 
00695 /*#define cdrfOBJFLAGSV3_NODASH 0x0800*/    // set in the objects flgs chunk if the dash pattern should be ignored
00696 
00697 // sometimes in CDR3 files (eg snowbarn) you get outline attributes with > 0 dash segements,
00698 // but the lines aren't dashed. There doesn't seem to be anything reliable marking this.
00699 
00700 //******************************************************************  Arrowheads
00701 
00702 typedef struct {
00703     DWORD ArrowheadReference;
00704     WORD Distance;              // offset in the x direction of the origin from the end of the path
00705     WORD NNodes;
00706     WORD CoordsOffset;          // - 6 for some reason
00707     WORD unknown;
00708     BYTE NodeTypes[4];          // types of node, as for paths...
00709 } cdrfArrowhead;
00710 
00711     // coordinates are in WORDs, and 500 is the width of the line...
00712     // they're not necessairly word aligned, though...
00713 #define cdrfARROWHEAD_COORDOFF_CORRECT  6
00714 
00715 #define cdrfARROWHEAD_LINEWIDTH         500
00716 
00717 //******************************************************************  Path objects
00718 
00719 typedef struct {
00720     WORD NCoords;
00721     WORD unknown2;
00722 } cdrfPathCoordHeader;      // followed by coordinate pairs then coord types
00723 
00724 #define cdrfPATHCOORDTYPE_MASK              0xc0
00725 
00726 #define cdrfPATHCOORDTYPE_MOVE              0x00
00727 #define cdrfPATHCOORDTYPE_LINETO            0x40
00728 #define cdrfPATHCOORDTYPE_CURVE             0x80
00729 #define cdrfPATHCOORDTYPE_CONTROL           0xc0
00730 
00731 #define cdrfPATHCOORDATTR_SMOOTH            0x10
00732 #define cdrfPATHCOORDATTR_CLOSE             0x08
00733 
00734 //******************************************************************  Rectangles
00735 
00736 typedef struct {
00737     SWORD Width;
00738     SWORD Height;   // both can be negative, in which case rectangle is below or left of (0,0)
00739     SWORD CornerRadius;
00740 } cdrfRectangleData;
00741 
00742 //******************************************************************  Ellipse
00743 
00744 typedef struct {
00745     SWORD Width;
00746     SWORD Height;           // can be negative...
00747 } cdrfEllipseData;
00748 
00749 //******************************************************************  Bitmap objects
00750 
00751 typedef struct {
00752     SWORD SizeX;
00753     SWORD SizeY;            // size on the page (CDR coordinates)
00754     WORD unknown[2];
00755     WORD PixelsX;
00756     WORD PixelsY;           // size in pixels
00757     WORD BitmapReference;   // reference of bitmap
00758     WORD unknown2[10];
00759     SWORD Left;
00760     SWORD Bottom;
00761     SWORD Right;
00762     SWORD Top;              // coords of the cropped edges
00763 } cdrfBitmapData;
00764                             // the top left of the bitmap is at (0,0) untransformed
00765 
00766 typedef struct {
00767     SWORD SizeX;
00768     SWORD SizeY;            // size on the page (CDR coordinates)
00769     WORD unknown[2];
00770     WORD PixelsX;
00771     WORD PixelsY;           // size in pixels
00772     WORD unknown2;
00773     WORD BitmapReference;   // the bitmap reference
00774     WORD unknown3[6];
00775     SWORD Left;
00776     SWORD Bottom;
00777     SWORD Right;
00778     SWORD Top;              // coords of the cropped edges
00779 } cdrfBitmapData3;
00780 
00781 //******************************************************************  Bitmaps
00782 
00783 // different format bitmaps for patterns (2 colour) and other bitmap type
00784 // fills and bitmaps!
00785 
00786 typedef struct {
00787     DWORD Reference;
00788     DWORD DataOffset;       // offset to palette entrys then image data
00789     DWORD SizeX;
00790     DWORD SizeY;
00791     WORD unknown[4];
00792     DWORD DataSize;
00793 } cdrfPatternBitmapHeader;
00794 
00795 typedef struct {
00796     WORD Reference;
00797     WORD unknown[5];
00798     WORD ImageOffset;       // roughly the offset... correct it
00799     WORD unknown2;
00800     WORD ImageType;
00801     WORD unknown3[3];
00802     DWORD SizeX;
00803     DWORD SizeY;
00804     WORD unknown4[2];
00805     DWORD Depth;
00806     WORD unknown5[21];
00807     WORD NPaletteEntries;
00808 } cdrfBitmapHeader;
00809     // palette entries follow (3 byte RGB)
00810 
00811 #define cdrfBitmapHeaderImageOffsetCorrect  82      // add this to ImageOffset
00812 
00813 #define cdrfBitmapGreyscaleImageStart       0x50
00814 
00815 #define cdrfBITMAPTYPE_COLOUR       0x0008
00816 #define cdrfBITMAPTYPE_GREYSCALE    0x0005
00817 
00818 typedef struct {
00819     BYTE Blue, Green, Red;
00820 } cdrfBitmapPaletteEntry;
00821 
00822 typedef struct {
00823     WORD Reference;
00824     WORD unknown[5];
00825     WORD ImageOffset;       // roughly the offset... correct it
00826     WORD unknown2[3];
00827     DWORD SizeX;
00828     DWORD SizeY;
00829     WORD unknown4[1];
00830     WORD Depth;
00831     WORD unknown5[8];
00832     WORD NPaletteEntries;
00833     WORD unknown6[3];
00834 } cdrfBitmapHeader4;
00835     // palette entries follow (3 byte RGB)
00836 
00837 typedef struct {
00838     BYTE Blue, Green, Red, unused;
00839 } cdrfBitmapPaletteEntry4;
00840 
00841 //******************************************************************  Styles
00842 
00843 typedef struct {
00844     WORD Reference;
00845 } cdrfStyleReference;
00846 
00847 typedef struct {
00848     WORD Reference;
00849     cdrfOffsetHeader Header;
00850 } cdrfStyle;
00851 
00852 #define cdrfSTYLEOFFSETTYPE_FILL    0xcd
00853 #define cdrfSTYLEOFFSETTYPE_OUTLINE 0xd2
00854 
00855 //******************************************************************  Text
00856 
00857 typedef struct {
00858     WORD unknown[8];
00859     WORD Position;
00860     WORD unknown2[2];
00861     WORD Alignment;
00862 } cdrfTextOnPathInfo;
00863 
00864 #define cdrfTEXTONPATHPOS_BOTTOM    1
00865 #define cdrfTEXTONPATHPOS_TOP       2
00866 #define cdrfTEXTONPATHPOS_CENTRE    3
00867 #define cdrfTEXTONPATHPOS_BASELINE  4
00868 
00869 #define cdrfTEXTONPATHALIGN_LEFT    1
00870 #define cdrfTEXTONPATHALIGN_RIGHT   2
00871 #define cdrfTEXTONPATHALIGN_CENTRE  3
00872 
00873 //******************************************************************  Text (version 5)
00874 
00875 // what you get in a txsm chunk:
00876 // cdrfTextInfoHdr
00877 // then paragraphs... * Hdr.NParagraphs
00878 //      cdrfTextInfoParaHdr
00879 //      cdrfTextInfoFontDefn * ParaHdr.FontDefns
00880 //      cdrfTextInfoParaInfo
00881 //      cdrfTextInfoChar * ParaInfo.NChars
00882 
00883 typedef struct {
00884     WORD Type;
00885     WORD unknown[3];
00886     WORD NParagraphs;
00887 } cdrfTextInfoHdr;
00888 
00889 typedef struct {
00890     WORD Style;             // style for this para
00891     WORD NFontDefns;        // number of font definitions following
00892 } cdrfTextInfoParaHdr;
00893 
00894 typedef struct {
00895     WORD Changes;           // what things need to change
00896     WORD FontRef;
00897     WORD FontType;
00898     WORD unknown2;
00899     struct {
00900         WORD Underline  : 3;    // use cdrfLINETYPE_* for these three
00901         WORD Overline   : 3;
00902         WORD StrikeOut  : 3;
00903         WORD Placement  : 3;    // super, sub, or what
00904     } FontAttr;
00905     WORD FontSize;          // 1000ths inch
00906     WORD Angle;             // angle of characters * 10
00907     WORD unknown3[4];
00908     WORD HorizontalShift;
00909     WORD VerticalShift;     // percentages
00910     WORD unknown4[5];
00911 } cdrfTextInfoFontDefn;
00912 
00913 #define cdrfLINETYPE_NONE               0
00914 #define cdrfLINETYPE_SINGLE_THIN        1
00915 #define cdrfLINETYPE_SINGLE_THIN_WORD   2
00916 #define cdrfLINETYPE_SINGLE_THICK       3
00917 #define cdrfLINETYPE_SINGLE_THICK_WORD  4
00918 #define cdrfLINETYPE_DOUBLE_THIN        5
00919 #define cdrfLINETYPE_DOUBLE_THIN_WORD   6
00920 
00921 #define cdrfPLACEMENTTYPE_NONE          0
00922 #define cdrfPLACEMENTTYPE_SUPERSCRIPT   1
00923 #define cdrfPLACEMENTTYPE_SUBSCRIPT     2
00924 
00925 #define cdrfTEXTINFODEFNCHANGES_FONT    0x0001
00926 #define cdrfTEXTINFODEFNCHANGES_SIZE    0x0004
00927 #define cdrfTEXTINFODEFNCHANGES_ATTR    0x0002
00928 
00929 typedef struct {
00930     WORD NChars;            // number of characters following
00931 } cdrfTextInfoParaInfo;
00932 
00933 typedef struct {
00934     SWORD XSize;
00935     WORD unknown;
00936     WORD Code;
00937     WORD Info;
00938 } cdrfTextInfoChar;
00939 
00940 #define cdrfTEXTINFOCHAR_INFO_DEFNMASK      0x0ff0
00941 #define cdrfTEXTINFOCHAR_INFO_DEFNMASKSBY   4       // number of bits to shift right
00942 
00943 typedef struct {
00944     WORD unknown;
00945     WORD XSize;
00946     WORD YSize;
00947     // lots of other stuff
00948 } cdrfTextStoryCoordData;
00949 
00950 #define cdrfTEXTSTYLE_OFFSETTYPE_FONT       0xdc
00951 #define cdrfTEXTSTYLE_OFFSETTYPE_SPACING    0xeb
00952 #define cdrfTEXTSTYLE_OFFSETTYPE_ALIGNMENT  0xe1
00953 
00954 typedef struct {
00955     WORD Reference;
00956     cdrfOffsetHeader Hdr;
00957 } cdrfTextStyleHdr;
00958 
00959 typedef struct {
00960     WORD FontRef;
00961     WORD FontSize;              // 1000ths inch
00962     WORD FontType;
00963 } cdrfTextStyleFont;
00964 
00965 typedef struct {
00966     SWORD CharacterSpacing;     // percentage
00967     SWORD WordSpacing;          // percentage
00968     SWORD LineSpacing;          // percentage
00969     WORD unknown;
00970     WORD SpacingSpecified;      // 0 = % char, 1 = pt, 2 = % pt (doesn't affect value)
00971 } cdrfTextStyleSpacing;
00972 
00973 typedef struct {
00974     WORD Alignment;
00975 } cdrfTextStyleAlignment;
00976 
00977 #define cdrfALIGNMENT_LEFT      1
00978 #define cdrfALIGNMENT_CENTRE    2
00979 #define cdrfALIGNMENT_RIGHT     3
00980 #define cdrfALIGNMENT_FULL      4
00981 
00982 typedef struct {
00983     WORD Reference;
00984     WORD unknown[8];
00985     TCHAR Name[4];              // zero terminated, as long as it takes
00986 } cdrfFontDefn;
00987 
00988 #define cdrfFONTTYPE_NORMAL     0x0040
00989 #define cdrfFONTTYPE_ITALIC     0x0080
00990 #define cdrfFONTTYPE_BOLD       0x1000
00991 #define cdrfFONTTYPE_BOLDITALIC 0x2000
00992 
00993 #define cdrfTEXT_NEWLINE        13
00994 
00995 
00996 //******************************************************************  Link table
00997 
00998 // link table - used for other things than just text
00999 
01000 typedef struct {
01001     WORD Size;
01002     WORD Entries;       // number of entries
01003     WORD OffsetsOffset; // offset to offsets
01004 } cdrfLinkTableHdr;
01005 
01006     // offsets are WORDs. Choose the closest above - an accurate offset isn't stored.
01007 
01008 #define cdrfLINKTABLEENTRYV4_TEXT   0x0061
01009 #define cdrfLINKTABLEENTRYV4_BLEND  0x0010
01010 
01011 #define cdrfLINKTABLEENTRY_TEXTONPATH   0x0040
01012 
01013 typedef struct {
01014     WORD Type;
01015     WORD Unknown;
01016     WORD TextSerialNumber;
01017     WORD PathSerialNumber;
01018 } cdrfLinkTableEntryTextOnPath;
01019 
01020 // version for CDR3 files...
01021 
01022 #define cdrfLINKTABLEENTRYV3_TEXTONPATH 0x8a68
01023 
01024 typedef struct {
01025     WORD TextSerialNumber;
01026     WORD Type;
01027     WORD PathSerialNumber;
01028     WORD TextSerialNumber2;         // seems to be a copy
01029 } cdrfLinkTableEntryTextOnPathV3;
01030 
01031 //******************************************************************  Text (version 4)
01032 
01033 typedef struct {
01034     WORD Type;
01035     WORD unknown[6];
01036     WORD TextID;        // the ID of the text
01037     WORD ObjectSerial;  // the serial number of the object we're linked to
01038 } cdrfLinkTableEntryTextV4;
01039 
01040 typedef struct {
01041     WORD Reference;
01042     TCHAR Name[4];              // zero terminated, as long as it takes
01043 } cdrfFontDefnV4;
01044 
01045 // in coords bit for paragraph text...
01046 
01047 typedef struct {
01048     WORD unknown;
01049     WORD FrameX;
01050     WORD FrameY;
01051 } cdrfParaTextHeaderV4;
01052 
01053 
01054 // in the coords bit of the object chunk...
01055 
01056 typedef struct {
01057     WORD unknown;
01058     WORD NCharacters;
01059     BYTE unknown2;
01060 } cdrfTextHeaderV4;
01061 
01062 // followed by text characters
01063 
01064 typedef struct {
01065     BYTE unknown;
01066     BYTE Info;
01067     BYTE Code;
01068 } cdrfTextCharV4;
01069 
01070 typedef struct {
01071     BYTE unknown;
01072     BYTE Info;
01073     BYTE Code;
01074     BYTE unknown2;
01075     WORD Changes;           // what's changed...
01076     WORD FontRef;
01077     WORD FontSize;
01078     WORD FontType;
01079     BYTE unknown3[13];
01080 } cdrfTextCharStyledV4;
01081 
01082 #define cdrfSTYLECHANGEV4_FONTNAME  0x0008
01083 #define cdrfSTYLECHANGEV4_FONTSIZE  0x0010
01084 #define cdrfSTYLECHANGEV4_WEIGHT    0x0020
01085 
01086 #define cdrfFONTTYPEV4_NORMAL       0x1
01087 #define cdrfFONTTYPEV4_ITALIC       0x4
01088 #define cdrfFONTTYPEV4_BOLD         0x2
01089 #define cdrfFONTTYPEV4_BOLDITALIC   0x8
01090 
01091 // in the btxt list...
01092 typedef struct {
01093     WORD Info;
01094     WORD Char;
01095 } cdrfTextListCharV4;
01096 
01097 typedef struct {
01098     WORD Info;
01099     WORD Char;
01100     WORD FontRef;
01101     WORD FontSize;
01102     struct {
01103         WORD Weight     : 4;
01104         WORD Placement  : 4;
01105     };
01106     WORD unknown[7];
01107 } cdrfTextListCharStyledV4;
01108 
01109 #define cdrfPLACEMENTV4_NONE    0x0
01110 #define cdrfPLACEMENTV4_SUPER   0x1
01111 #define cdrfPLACEMENTV4_SUB     0x2
01112 
01113 typedef struct {
01114     WORD Style;
01115     WORD unknown[2];
01116 } cdrfParaDefnV4;
01117 
01118 //******************************************************************  Text (version 3)
01119 
01120 // entries in the 'ftbl' chunk
01121 
01122 typedef struct {
01123     WORD Reference;
01124     BYTE Name[34];      // zero terminated, all lower case
01125 } cdrfFontTableEntryV3;
01126 
01127 // the 'tspc' chunk - gives font style info
01128 
01129 typedef struct {
01130     WORD Size;
01131     WORD NOffsets;
01132     WORD unknown;
01133     WORD Offsets[4];    // as many as there are,,,
01134 } cdrfFontStyleTableHeaderV3;
01135 
01136 typedef struct {
01137     WORD unknown;
01138     WORD FontRef;
01139     WORD FontSize;
01140     WORD FontStyle;
01141     WORD unknown2[2];
01142 } cdrfFontStyleTableEntryV3;
01143 
01144 #define cdrfFONTSTYLEV3_WEIGHT_MASK         0x0f
01145 #define cdrfFONTSTYLEV3_WEIGHT_NORMAL       0x01
01146 #define cdrfFONTSTYLEV3_WEIGHT_BOLD         0x02
01147 #define cdrfFONTSTYLEV3_WEIGHT_ITALIC       0x04
01148 #define cdrfFONTSTYLEV3_WEIGHT_BOLDITALIC   0x08
01149 #define cdrfFONTSTYLEV3_FLAG_SUPERSCRIPT    0x10
01150 #define cdrfFONTSTYLEV3_FLAG_SUBSCRIPT      0x20
01151 
01152 // data in an object
01153 
01154 typedef struct {
01155     BYTE unknown[3];
01156     WORD FrameX;
01157     WORD FrameY;
01158     BYTE unknown2[4];
01159     WORD NCharacters;
01160     WORD unknown3;
01161     WORD BaseFontStyle;
01162     WORD unknown4[4];
01163     BYTE Justification;
01164     BYTE unknown5[105];
01165 } cdrfTextHeaderV3;
01166 
01167 #define cdrfJUSTIFICATIONV3_LEFT    1
01168 #define cdrfJUSTIFICATIONV3_CENTRE  2
01169 #define cdrfJUSTIFICATIONV3_RIGHT   3
01170 
01171 typedef struct {
01172     BYTE unknown;
01173     BYTE Info;          // non zero if this has a style applied
01174     BYTE Code;
01175 } cdrfTextCharV3;
01176 
01177 typedef struct {
01178     BYTE unknown;
01179     BYTE Info;
01180     BYTE Code;
01181     WORD unknown2;
01182     WORD Style;
01183     BYTE unknown3[9];
01184 } cdrfTextCharStyledV3;
01185 
01186 //******************************************************************  End
01187 
01188 
01189 // This must be the last thing in the file to avoid things going nasty on us
01190 #pragma pack(pop)
01191 
01192 #endif  // INC_CDRFORM
01193 
01194 

Generated on Sat Nov 10 03:48:15 2007 for Camelot by  doxygen 1.4.4