~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to dotneato/XFIG_FORMAT3.2.txt

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
This specification document was obtained from:
 
2
        http://duke.usask.ca/~macphed/soft/fig/FORMAT3.2.txt
 
3
on 17 May 1999 by ellson@lucent.com
 
4
===========================================================================
 
5
 
 
6
/*
 
7
 * FIG : Facility for Interactive Generation of figures
 
8
 * Copyright (c) 1985 by Supoj Sutanthavibul
 
9
 * Parts Copyright (c) 1994 by Brian V. Smith
 
10
 * Parts Copyright (c) 1991 by Paul King
 
11
 * Parts Copyright (c) 1995 by C. Blanc and C. Schlick
 
12
 *
 
13
 * The X Consortium, and any party obtaining a copy of these files from
 
14
 * the X Consortium, directly or indirectly, is granted, free of charge, a
 
15
 * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
 
16
 * nonexclusive right and license to deal in this software and
 
17
 * documentation files (the "Software"), including without limitation the
 
18
 * rights to use, copy, modify, merge, publish, distribute, sublicense,
 
19
 * and/or sell copies of the Software, and to permit persons who receive
 
20
 * copies from any such party to do so, with the only requirement being
 
21
 * that this copyright notice remain intact.  This license includes without
 
22
 * limitation a license to do the foregoing actions under any patents of
 
23
 * the party supplying this software to the X Consortium.
 
24
 */
 
25
 
 
26
The new components in protocol 3.2 are the paper size, magnification,
 
27
single/multiple page indicator and transparent color for GIF export in the
 
28
header.
 
29
 
 
30
The other modification between version 3.1 and version 3.2 of the
 
31
protocol is the mathematical model used for splines. The new version
 
32
uses X-splines which allows the user to mix interpolation and approximation
 
33
points in a same curve. More precisely, it means that an X-spline curve
 
34
is neither an interpolated spline nor an approximated one, it is BOTH
 
35
(the behaviour of each point is controlled by one single parameter
 
36
called "shape factor"). For additional information about X-splines, see:
 
37
 
 
38
  "X-Splines: A Spline Model Designed for the End User"
 
39
  by C. Blanc and C. Schlick, Proceedings of SIGGRAPH'95
 
40
 
 
41
Caveat: Because spline models of previous versions (quadratic B-splines
 
42
and Bezier with hidden points) are no longer supported, curves that are
 
43
present in version 3.1 and older files are automatically converted to
 
44
X-splines. This translation is only an approximation process. It means
 
45
that the converted curves are not exactly the same as the original ones.
 
46
Though the translation usually provides almost identical curves, some
 
47
hand-fitting may be needed in some pathological cases.
 
48
 
 
49
-------------------------------------------------------------------------------
 
50
Description of the Fig Format Follows
 
51
-------------------------------------------------------------------------------
 
52
 
 
53
(1) The very first line is a comment line containing the name and version:
 
54
        #FIG 3.2
 
55
 
 
56
    The character # at the first column of a line indicates that the line
 
57
    is a comment line which will be ignored.
 
58
 
 
59
(2) The first non-comment line consists of the following:
 
60
 
 
61
        int     fig_resolution          (Fig units/inch)
 
62
        string  orientation             ("Landscape" or "Portrait")
 
63
        string  justification           ("Center" or "Flush Left")
 
64
        string  units                   ("Metric" or "Inches")
 
65
        string  papersize               ("Letter", "Legal", "Ledger", "Tabloid",
 
66
                                         "A", "B", "C", "D", "E",
 
67
                                         "A4",   "A3", "A2", "A1", "A0" and "B5")
 
68
        float   magnification           (export and print magnification, %)
 
69
        string  multiple-page           ("Single" or "Multiple" pages)
 
70
        int     transparent color       (color number for transparent color for GIF
 
71
                                         export. -2=None, -1=background, 0-31 for
 
72
                                         standard colors or 32- for user colors)
 
73
        int     coordinate_system       (1: origin at lower left corner (NOT USED)
 
74
                                         2: upper left)
 
75
 
 
76
    Fig_resolution is the resolution of the figure in the file.
 
77
    Xfig will always write the file with a resolution of 1200ppi so it
 
78
    will scale the figure upon reading it in if its resolution is different
 
79
    from 1200ppi.  Pixels are assumed to be square.
 
80
 
 
81
    Xfig will read the orientation string and change the canvas to match
 
82
    either the Landscape or Portrait mode of the figure file.
 
83
 
 
84
    The units specification is self-explanatory.
 
85
 
 
86
    The coordinate_system variable is ignored - the origin is ALWAYS the
 
87
    upper-left corner.
 
88
 
 
89
    ** Coordinates are given in "fig_resolution" units.
 
90
    ** Line thicknesses are given in 80-ths of an inch ("display units").
 
91
    ** dash-lengths/dot-gaps are given in 80-ths of an inch.
 
92
 
 
93
 
 
94
(3) The rest of the file contains various objects.  An object can be one
 
95
    of six classes (or types).
 
96
 
 
97
        0)      Color pseudo-object.
 
98
        1)      Arc.
 
99
        2)      Ellipse which is a generalization of circle.
 
100
        3)      Polyline which includes polygon and box.
 
101
        4)      Spline which includes 
 
102
                closed/open approximated/interpolated/x-spline spline.
 
103
        5)      Text.
 
104
        6)      Compound object which is composed of one or more objects.
 
105
 
 
106
    In the following elaboration on object formats, every value of fig
 
107
    output are separated by blank characters or new line ('\n').  The
 
108
    value of the unused parameters will be -1.
 
109
 
 
110
    Some fields are described as "enumeration type" or "bit vector"; the
 
111
    values which these fields can take are defined in the header file object.h.
 
112
    The pen_style field is unused.
 
113
    These values may be defined in some future version of Fig.
 
114
 
 
115
    The two color fields (pen and fill; pen only, for texts) are
 
116
    defined as follows:
 
117
 
 
118
            -1 = Default
 
119
             0 = Black
 
120
             1 = Blue
 
121
             2 = Green
 
122
             3 = Cyan
 
123
             4 = Red
 
124
             5 = Magenta
 
125
             6 = Yellow
 
126
             7 = White
 
127
          8-11 = four shades of blue (dark to lighter)
 
128
         12-14 = three shades of green (dark to lighter)
 
129
         15-17 = three shades of cyan (dark to lighter)
 
130
         18-20 = three shades of red (dark to lighter)
 
131
         21-23 = three shades of magenta (dark to lighter)
 
132
         24-26 = three shades of brown (dark to lighter)
 
133
         27-30 = four shades of pink (dark to lighter)
 
134
            31 = Gold
 
135
 
 
136
         values from 32 to 543 (512 total) are user colors and
 
137
         are defined in color pseudo-objects (type 0)
 
138
 
 
139
    For WHITE color, the area fill field is defined as follows:
 
140
        
 
141
        -1 = not filled
 
142
         0 = black
 
143
        ...  values from 1 to 19 are shades of grey, from darker to lighter
 
144
        20 = white
 
145
        21-40 not used
 
146
        41-56 see patterns for colors, below
 
147
 
 
148
    For BLACK or DEFAULT color, the area fill field is defined as follows:
 
149
        
 
150
        -1 = not filled
 
151
         0 = white
 
152
        ...  values from 1 to 19 are shades of grey, from lighter to darker
 
153
        20 = black
 
154
        21-40 not used
 
155
        41-56 see patterns for colors, below
 
156
 
 
157
    For all other colors, the area fill field is defined as follows:
 
158
 
 
159
        -1 = not filled
 
160
         0 = black
 
161
        ...  values from 1 to 19 are "shades" of the color, from darker to lighter.
 
162
                A shade is defined as the color mixed with black
 
163
        20 = full saturation of the color
 
164
        ...  values from 21 to 39 are "tints" of the color from the color to white.
 
165
                A tint is defined as the color mixed with white
 
166
        40 = white
 
167
        41 = 30 degree left diagonal pattern
 
168
        42 = 30 degree right diagonal pattern
 
169
        43 = 30 degree crosshatch
 
170
        44 = 45 degree left diagonal pattern
 
171
        45 = 45 degree right diagonal pattern
 
172
        46 = 45 degree crosshatch
 
173
        47 = bricks
 
174
        48 = circles
 
175
        49 = horizontal lines
 
176
        50 = vertical lines
 
177
        51 = crosshatch
 
178
        52 = fish scales
 
179
        53 = small fish scales
 
180
        54 = octagons
 
181
        55 = horizontal "tire treads"
 
182
        56 = vertical "tire treads"
 
183
 
 
184
    The depth field is defined as follows:
 
185
 
 
186
         0 ... 999 where larger value means object is deeper than (under)
 
187
                   objects with smaller depth
 
188
 
 
189
    The line_style field is defined as follows:
 
190
 
 
191
        -1 = Default
 
192
         0 = Solid
 
193
         1 = Dashed
 
194
         2 = Dotted
 
195
         3 = Dash-dotted
 
196
         4 = Dash-double-dotted
 
197
         5 = Dash-triple-dotted
 
198
 
 
199
    The style_val field is defined as the length, in 1/80 inches, of the on/off
 
200
    dashes for dashed lines, and the distance between the dots, in 1/80 inches,
 
201
    for dotted lines.
 
202
 
 
203
    The join_style field is defined FOR LINES only as follows:
 
204
 
 
205
         0 = Miter (the default in xfig 2.1 and earlier)
 
206
         1 = Bevel
 
207
         2 = Round
 
208
 
 
209
    The cap_style field is defined FOR LINES, OPEN SPLINES and ARCS only as follows:
 
210
 
 
211
         0 = Butt (the default in xfig 2.1 and earlier)
 
212
         1 = Round
 
213
         2 = Projecting
 
214
 
 
215
    The arrow_type field is defined for LINES, ARCS and OPEN SPLINES
 
216
    only as follows:
 
217
 
 
218
         0 = Stick-type (the default in xfig 2.1 and earlier)
 
219
         1 = Closed triangle:
 
220
                |\
 
221
                |  \
 
222
                |    \
 
223
                |    /
 
224
                |  /
 
225
                |/
 
226
         2 = Closed with "indented" butt:
 
227
                |\
 
228
                \  \
 
229
                 \   \
 
230
                  \    \
 
231
                  /    /
 
232
                 /   /
 
233
                /  /
 
234
                |/
 
235
         3 = Closed with "pointed" butt:
 
236
                   |\
 
237
                  /   \
 
238
                 /      \
 
239
                /         \
 
240
                \         /
 
241
                 \      /
 
242
                  \   /
 
243
                   |/
 
244
 
 
245
    The arrow_style field is defined for LINES, ARCS and OPEN SPLINES
 
246
    only as follows:
 
247
 
 
248
         0 = Hollow (actually filled with white)
 
249
         1 = Filled with pen_color
 
250
 
 
251
(3.0) OBJECT DEFINITION:
 
252
 
 
253
    (3.1) Color Pseudo-objects (user-defined colors)
 
254
          This is used to define arbitrary colors beyond the 32 standard colors.
 
255
          The color objects must be defined before any other Fig objects.
 
256
 
 
257
    First line:
 
258
        type    name                    (brief description)
 
259
        ----    ----                    -------------------
 
260
        int     object_code             (always 0)
 
261
        int     color_number            (color number, from 32-543 (512 total))
 
262
     hex string rgb values              (hexadecimal string describing red,
 
263
                                         green and blue values (e.g. #330099) )
 
264
 
 
265
    (3.2) ARC
 
266
 
 
267
    First line:
 
268
        type    name                    (brief description)
 
269
        ----    ----                    -------------------
 
270
        int     object_code             (always 5)
 
271
        int     sub_type                (0: pie-wedge (closed)
 
272
                                         1: open ended arc)
 
273
        int     line_style              (enumeration type)
 
274
        int     line_thickness          (1/80 inch)
 
275
        int     pen_color               (enumeration type, pen color)
 
276
        int     fill_color              (enumeration type, fill color)
 
277
        int     depth                   (enumeration type)
 
278
        int     pen_style               (pen style, not used)
 
279
        int     area_fill               (enumeration type, -1 = no fill)
 
280
        float   style_val               (1/80 inch)
 
281
        int     cap_style               (enumeration type)
 
282
        int     direction               (0: clockwise, 1: counterclockwise)
 
283
        int     forward_arrow           (0: no forward arrow, 1: on)
 
284
        int     backward_arrow          (0: no forward arrow, 1: on)
 
285
        float   center_x, center_y      (center of the arc)
 
286
        int     x1, y1                  (Fig units, the 1st point the user entered)
 
287
        int     x2, y2                  (Fig units, the 2nd point)
 
288
        int     x3, y3                  (Fig units, the last point)
 
289
 
 
290
    Forward arrow line (Optional; absent if forward_arrow is 0):
 
291
        type    name                    (brief description)
 
292
        ----    ----                    -------------------
 
293
        int     arrow_type              (enumeration type)
 
294
        int     arrow_style             (enumeration type)
 
295
        float   arrow_thickness         (1/80 inch)
 
296
        float   arrow_width             (Fig units)
 
297
        float   arrow_height            (Fig units)
 
298
 
 
299
    Backward arrow line (Optional; absent if backward_arrow is 0):
 
300
        type    name                    (brief description)
 
301
        ----    ----                    -------------------
 
302
        int     arrow_type              (enumeration type)
 
303
        int     arrow_style             (enumeration type)
 
304
        float   arrow_thickness         (1/80 inch)
 
305
        float   arrow_width             (Fig units)
 
306
        float   arrow_height            (Fig units)
 
307
 
 
308
    (3.3) COMPOUND
 
309
 
 
310
    A line with object code 6 signifies the start of a compound.
 
311
    There are four more numbers on this line which indicate the
 
312
    upper right corner and the lower left corner of the bounding
 
313
    box of this compound.  A line with object code -6 signifies
 
314
    the end of the compound.  Compound may be nested.
 
315
 
 
316
    First line:
 
317
        type    name                    (brief description)
 
318
        ----    ----                    -------------------
 
319
        int     object_code             (always 6)
 
320
        int     upperright_corner_x     (Fig units)
 
321
        int     upperright_corner_y     (Fig units)
 
322
        int     lowerleft_corner_x      (Fig units)
 
323
        int     lowerleft_corner_y      (Fig units)
 
324
 
 
325
    Subsequent lines:
 
326
        objects
 
327
        .
 
328
        .
 
329
 
 
330
    Last line:
 
331
        -6
 
332
 
 
333
    (3.4) ELLIPSE
 
334
 
 
335
    First line:
 
336
        type    name                    (brief description)
 
337
        ----    ----                    -------------------
 
338
        int     object_code             (always 1)
 
339
        int     sub_type                (1: ellipse defined by radiuses
 
340
                                         2: ellipse defined by diameters
 
341
                                         3: circle defined by radius
 
342
                                         4: circle defined by diameter)
 
343
        int     line_style              (enumeration type)
 
344
        int     thickness               (1/80 inch)
 
345
        int     pen_color               (enumeration type, pen color)
 
346
        int     fill_color              (enumeration type, fill color)
 
347
        int     depth                   (enumeration type)
 
348
        int     pen_style               (pen style, not used)
 
349
        int     area_fill               (enumeration type, -1 = no fill)
 
350
        float   style_val               (1/80 inch)
 
351
        int     direction               (always 1)
 
352
        float   angle                   (radians, the angle of the x-axis)
 
353
        int     center_x, center_y      (Fig units)
 
354
        int     radius_x, radius_y      (Fig units)
 
355
        int     start_x, start_y        (Fig units; the 1st point entered)
 
356
        int     end_x, end_y            (Fig units; the last point entered)
 
357
 
 
358
    (3.5) POLYLINE
 
359
 
 
360
    First line:
 
361
        type    name                    (brief description)
 
362
        ----    ----                    -------------------
 
363
        int     object_code             (always 2)
 
364
        int     sub_type                (1: polyline
 
365
                                         2: box
 
366
                                         3: polygon
 
367
                                         4: arc-box)
 
368
                                         5: imported-picture bounding-box)
 
369
        int     line_style              (enumeration type)
 
370
        int     thickness               (1/80 inch)
 
371
        int     pen_color               (enumeration type, pen color)
 
372
        int     fill_color              (enumeration type, fill color)
 
373
        int     depth                   (enumeration type)
 
374
        int     pen_style               (pen style, not used)
 
375
        int     area_fill               (enumeration type, -1 = no fill)
 
376
        float   style_val               (1/80 inch)
 
377
        int     join_style              (enumeration type)
 
378
        int     cap_style               (enumeration type, only used for POLYLINE)
 
379
        int     radius                  (1/80 inch, radius of arc-boxes)
 
380
        int     forward_arrow           (0: off, 1: on)
 
381
        int     backward_arrow          (0: off, 1: on)
 
382
        int     npoints                 (number of points in line)
 
383
 
 
384
    Forward arrow line: same as ARC object
 
385
 
 
386
    Backward arrow line: same as ARC object
 
387
 
 
388
    Points line:
 
389
        type    name                    (brief description)
 
390
        ----    ----                    -------------------
 
391
        int     x1, y1                  (Fig units)
 
392
        int     x2, y2                  (Fig units)
 
393
          .
 
394
          .
 
395
        int     xnpoints ynpoints       (this will be the same as the 1st
 
396
                                        point for polygon and box)
 
397
 
 
398
    PIC line:
 
399
        type    name                    (brief description)
 
400
        ----    ----                    -------------------
 
401
        boolean flipped                 orientation = normal (0) or flipped (1)
 
402
        char    file[]                  name of picture file to import
 
403
 
 
404
    (3.6) SPLINE
 
405
 
 
406
    First line:
 
407
        type    name                    (brief description)
 
408
        ----    ----                    -------------------
 
409
        int     object_code             (always 3)
 
410
        int     sub_type                (0: opened approximated spline
 
411
                                             1: closed approximated spline
 
412
                                             2: opened interpolated spline
 
413
                                             3: closed interpolated spline
 
414
                                             4: opened x-spline 
 
415
                                             5: closed x-spline)
 
416
        int     line_style              (See the end of this section)
 
417
        int     thickness               (1/80 inch)
 
418
        int     pen_color               (enumeration type, pen color)
 
419
        int     fill_color              (enumeration type, fill color)
 
420
        int     depth                   (enumeration type)
 
421
        int     pen_style               (pen style, not used)
 
422
        int     area_fill               (enumeration type, -1 = no fill)
 
423
        float   style_val               (1/80 inch)
 
424
        int     cap_style               (enumeration type, only used for open splines)
 
425
        int     forward_arrow           (0: off, 1: on)
 
426
        int     backward_arrow          (0: off, 1: on)
 
427
        int     npoints                 (number of control points in spline)
 
428
 
 
429
    Forward arrow line: same as ARC object
 
430
 
 
431
    Backward arrow line: same as ARC object
 
432
 
 
433
    Points line: same as POLYLINE object
 
434
 
 
435
    Control points line :
 
436
 
 
437
    There is one shape factor for each point. The value of this factor
 
438
    must be between -1 (which means that the spline is interpolated at
 
439
    this point) and 1 (which means that the spline is approximated at
 
440
    this point). The spline is always smooth in the neighbourhood of a
 
441
    control point, except when the value of     the factor is 0 for which
 
442
    there is a first-order discontinuity (i.e. angular point).
 
443
 
 
444
    (3.7) TEXT
 
445
        type    name                    (brief description)
 
446
        ----    ----                    -------------------
 
447
        int     object                  (always 4)
 
448
        int     sub_type                (0: Left justified
 
449
                                             1: Center justified
 
450
                                             2: Right justified)
 
451
        int     color                   (enumeration type)
 
452
        int     depth                   (enumeration type)
 
453
        int     pen_style               (enumeration , not used)
 
454
        int     font                    (enumeration type)
 
455
        float   font_size               (font size in points)
 
456
        float   angle                   (radians, the angle of the text)
 
457
        int     font_flags              (bit vector)
 
458
        float   height                  (Fig units)
 
459
        float   length                  (Fig units)
 
460
        int     x, y                    (Fig units, coordinate of the origin
 
461
                                         of the string.  If sub_type = 0, it is
 
462
                                         the lower left corner of the string.
 
463
                                         If sub_type = 1, it is the lower
 
464
                                         center.  Otherwise it is the lower
 
465
                                         right corner of the string.)
 
466
        char    string[]                (ASCII characters; starts after a blank
 
467
                                         character following the last number and
 
468
                                         ends before the sequence '\001'.  This
 
469
                                         sequence is not part of the string.
 
470
                                         Characters above octal 177 are
 
471
                                         represented by \xxx where xxx is the
 
472
                                         octal value.  This permits fig files to
 
473
                                         be edited with 7-bit editors and sent
 
474
                                         by e-mail without data loss.
 
475
                                         Note that the string may contain '\n'.)
 
476
 
 
477
    The font_flags field is defined as follows:
 
478
 
 
479
         Bit    Description
 
480
 
 
481
          0     Rigid text (text doesn't scale when scaling compound objects)
 
482
          1     Special text (for LaTeX)
 
483
          2     PostScript font (otherwise LaTeX font is used)
 
484
          3     Hidden text
 
485
 
 
486
    The font field is defined as follows:
 
487
 
 
488
        For font_flags bit 2 = 0 (LaTeX fonts):
 
489
 
 
490
         0      Default font
 
491
         1      Roman
 
492
         2      Bold
 
493
         3      Italic
 
494
         4      Sans Serif
 
495
         5      Typewriter
 
496
 
 
497
        For font_flags bit 2 = 1 (PostScript fonts):
 
498
 
 
499
        -1      Default font
 
500
         0      Times Roman
 
501
         1      Times Italic
 
502
         2      Times Bold
 
503
         3      Times Bold Italic
 
504
         4      AvantGarde Book
 
505
         5      AvantGarde Book Oblique
 
506
         6      AvantGarde Demi
 
507
         7      AvantGarde Demi Oblique
 
508
         8      Bookman Light
 
509
         9      Bookman Light Italic
 
510
        10      Bookman Demi
 
511
        11      Bookman Demi Italic
 
512
        12      Courier
 
513
        13      Courier Oblique
 
514
        14      Courier Bold
 
515
        15      Courier Bold Oblique
 
516
        16      Helvetica
 
517
        17      Helvetica Oblique
 
518
        18      Helvetica Bold
 
519
        19      Helvetica Bold Oblique
 
520
        20      Helvetica Narrow
 
521
        21      Helvetica Narrow Oblique
 
522
        22      Helvetica Narrow Bold
 
523
        23      Helvetica Narrow Bold Oblique
 
524
        24      New Century Schoolbook Roman
 
525
        25      New Century Schoolbook Italic
 
526
        26      New Century Schoolbook Bold
 
527
        27      New Century Schoolbook Bold Italic
 
528
        28      Palatino Roman
 
529
        29      Palatino Italic
 
530
        30      Palatino Bold
 
531
        31      Palatino Bold Italic
 
532
        32      Symbol
 
533
        33      Zapf Chancery Medium Italic
 
534
        34      Zapf Dingbats