home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume8 / xfig2.8 / part09 / FORMAT1.4 < prev    next >
Text File  |  1990-07-03  |  9KB  |  285 lines

  1. ****** This is the old format 1.4. ******
  2.  
  3. The following is the format of fig output (fig 1.4).
  4.  
  5. (1) The very first line is a comment line containing the name and version:
  6.     #FIG 1.4
  7.  
  8.     The character # at the first column of a line indicates that the line
  9.     is a comment line which will be ignored.
  10.  
  11. (2) The first non-comment line consists of two numbers :
  12.  
  13.     int    fig_resolution        (pixels/inch)
  14.     int    coordinate_system    (1 : origin is at the lower left corner
  15.                      2 : Upper left)
  16.  
  17.     Fig_resolution is the resolution fig is using for the current file.
  18.     It may not be the same as screen resolution (which can be higher or
  19.     lower).  I assume that a pixel is square, therefore this number
  20.     represents drawing resolution in both direction.  I've experimented
  21.     with fig automatically changing this number according to the resolution
  22.     of the monitor it is running on (The screen resolution, width and height
  23.     in pixels, not pixel/inch, can be done by doing a ioctl on the /dev/fb).
  24.     I've found that for monitors with higher resolution but same size
  25.     (19" diagonal), I preferred using the pixels for other things than
  26.     having fig occupying most of the screen.  Thus I opted for a fixed
  27.     pixel-per-inch number which make fig window smaller on higher resolution
  28.     monitor (than the standard sun monitor).  This however may change in
  29.     the future version.
  30.  
  31. (3) The rest of the file contains various objects.  An object can be one
  32.     of six classes (or types).
  33.  
  34.       i)    Arc.
  35.      ii)    Ellipse which is a generalization of circle.
  36.     iii)    Polyline which includes polygon and box.
  37.      iv)    Spline which includes closed/open control/interpolated spline.
  38.       v)    Text.
  39.      vi)    Compound object which is composed of one or more objects.
  40.  
  41.     In the following elaboration on object formats, every value of fig
  42.     output are separated by blank characters or new line ('\n').  The
  43.     value of the not-used parameters will be -1.
  44.  
  45.     A number of values are described as unused or not applicable to some
  46.     object even though they are defined for those objects.  These value
  47.     will (hopefully) be used in the future version of fig.  The intention
  48.     of their uses are the following.
  49.  
  50.     Value            Usage
  51.     -----            -----
  52.     area_fill    The stipple pattern (which will be align) for
  53.             filling object internals.  For example, an filled
  54.             arc will look like a piece of pie.
  55.  
  56.     pen        This will be a structure defining the shape of
  57.             pen used in drawing objects.  It also includes
  58.             the the stipple pattern for line filling.
  59.             The default pen is a circular pen with black
  60.             filling.
  61.  
  62.     thickness    Every pen has the thickness of one.
  63.             Thickness scales the size of a pen. 
  64.  
  65.     depth        This value adds a half dimension to fig.
  66.             It is useful when we have overlapping filled
  67.             objects and we want one to obliterate another.
  68.             An object can have only one depth (including
  69.             compound object).  An object that is in less
  70.             depth can obscure the one with greater depth
  71.             if they overlap.
  72.     
  73.     line_style    Only polyline (including polygon and box) can
  74.             be rendered with dashed line.  However the
  75.             objects created when the dash-line mode was on
  76.             will be recorded as such.  Currently the filter
  77.             f2ps (1) is able to render the desired line style
  78.             effect on hard copy.  Three line styles are defined.
  79.  
  80.                 0 : SOLID_LINE
  81.                 1 : DASH_LINE
  82.                 2 : DOTTED_LINE
  83.  
  84.     style_val    For dash style, it is the length of a dash.
  85.             For dotted line it indicates the approximated
  86.             gap of consecutive dots. 
  87.  
  88.     (3.1) ARC
  89.  
  90.     First line :
  91.     type    name            (brief description)
  92.     ----    ----            -------------------
  93.     int    object_code        (always 5)
  94.     int    sub_type        (always    1)
  95.     int    line_style        (See the end of this section)
  96.     int    line_thickness        (pixels, not used)
  97.     int    color            (not used)
  98.     int    depth            (not used)
  99.     int    pen            (not used)
  100.     int    area_fill        (not used)
  101.     float    style_val        (pixels, not used)
  102.     int    direction        (0 : clockwise, 1 : counterclockwise)
  103.     int    forward_arrow        (0: no forward arrow, 1: on)
  104.     int    backward_arrow        (0: no forward arrow, 1: on)
  105.     float    center_x, center_y    (center of the arc)
  106.     int    x1, y1            (pixels, the 1st point the user entered)
  107.     int    x2, y2            (pixels, the 2nd point)
  108.     int    x3, y3            (pixels, the last point)
  109.  
  110.     Forward arrow line (Optional; absent if forward_arrow is 0) :
  111.     type    name            (brief description)
  112.     ----    ----            -------------------
  113.     int    arrow_type        (not used)
  114.     int    arrow_style        (not used)
  115.     int    arrow_thickness        (not used)
  116.     int    arrow_width        (pixels)
  117.     int    arrow_height        (pixels)
  118.  
  119.     Backward arrow line (Optional; absent if backward_arrow is 0) :
  120.     type    name            (brief description)
  121.     ----    ----            -------------------
  122.     int    arrow_type        (not used)
  123.     int    arrow_style        (not used)
  124.     int    arrow_thickness        (not used)
  125.     int    arrow_width        (pixels)
  126.     int    arrow_height        (pixels)
  127.  
  128.     (3.2) COMPOUND
  129.  
  130.     A line with object code 6 signifies the start of a compound.
  131.     There are four more numbers on this line which indicate the
  132.     upper right corner and the lower left corner of the bounding
  133.     box of this compound.  A line with object code -6 signifies
  134.     the end of the compound.  Compound may be nested.
  135.  
  136.     First line :
  137.     type    name            (brief description)
  138.     ----    ----            -------------------
  139.     int    object_code        (always 6)
  140.     int    upperright_corner_x    (pixels)
  141.     int    upperright_corner_y    (pixels)
  142.     int    lowerleft_corner_x    (pixels)
  143.     int    lowerleft_corner_y    (pixels)
  144.  
  145.     Subsequent lines :
  146.     objects
  147.     .
  148.     .
  149.  
  150.     Last line :
  151.     -6
  152.  
  153.     (3.3) ELLIPSE
  154.  
  155.     First line :
  156.     type    name            (brief description)
  157.     ----    ----            -------------------
  158.     int    object_code        (always 1)
  159.     int    sub_type        (1 : ellipse defined by radiuses
  160.                      2 : ellipse defined by diameters
  161.                      3 : circle defined by radius
  162.                      4 : circle defined by diameter)
  163.     int    line_style        (See the end of this section)
  164.     int    thickness        (pixels, not used)
  165.     int    color            (not used)
  166.     int    depth            (not used)
  167.     int    pen            (not used)
  168.     int    area_fill        (not used)
  169.     float    style_val        (pixels, not used)
  170.     int    direction        (always 1)
  171.     float    angle            (radian, the angle of the x-axis)
  172.     int    center_x, center_y    (pixels)
  173.     int    radius_x, radius_y    (pixels)
  174.     int    start_x, start_y    (pixels; the 1st point entered)
  175.     int    end_x, end_y        (pixels; the last point entered)
  176.  
  177.     (3.4) POLYLINE
  178.  
  179.     First line :
  180.     type    name            (brief description)
  181.     ----    ----            -------------------
  182.     int    object_code        (always 1)
  183.     int    sub_type        (1 : polyline, 2 : box, 3 : polygon)
  184.     int    line_style        (See the end of this section)
  185.     int    thickness        (pixels, not used)
  186.     int    color            (not used)
  187.     int    depth            (not used)
  188.     int    pen            (not used)
  189.     int    area_fill        (not used)
  190.     float    style_val        (pixels)
  191.     int    forward_arrow        (0: off, 1: on)
  192.     int    backward_arrow        (0: off, 1: on)
  193.  
  194.     Forward arrow line : same as ARC object
  195.  
  196.     Backward arrow line : same as ARC object
  197.  
  198.     Points line :
  199.     type    name            (brief description)
  200.     ----    ----            -------------------
  201.     int    x1, y1            (pixels)
  202.     int    x2, y2            (pixels)
  203.       .
  204.       .
  205.     int    xn, yn            (this will be the same as the 1st
  206.                     point for polygon and box)
  207.     int    x, y            (always 9999, 9999; marks the end of
  208.                     point for polygon and box)
  209.  
  210.     (3.5) SPLINE
  211.  
  212.     First line :
  213.     type    name            (brief description)
  214.     ----    ----            -------------------
  215.     int    object_code        (always 1)
  216.     int    sub_type        (1 : open spline
  217.                      2 : closed spline
  218.                      3 : open interpolated spline
  219.                      4 : closed interpolated spline)
  220.     int    line_style        (See the end of this section)
  221.     int    thickness        (pixels, not used)
  222.     int    color            (not used)
  223.     int    depth            (not used)
  224.     int    pen            (not used)
  225.     int    area_fill        (not used)
  226.     float    style_val        (pixels, not used)
  227.     int    forward_arrow        (0: off, 1: on)
  228.     int    backward_arrow        (0: off, 1: on)
  229.  
  230.     Forward arrow line : same as ARC object
  231.  
  232.     Backward arrow line : same as ARC object
  233.  
  234.     Points line : same as POLYLINE object
  235.  
  236.     Control points line (absent if sub_type is 1 or 2) :
  237.     Control points of interpolated spline.  There are two control
  238.     points for each knots.  A section i, of the spline is drawn
  239.     using Bezier cubic with the following four points:
  240.         (x ,y ), (rx ,ry ), (lx      , ly   ), (x   , y   ).
  241.           i  i        i    i      i+1    i+1     i+1   i+1
  242.     For closed interpolated spline the last pair of control points,
  243.     (lxn,lyn) and (rxn,ryn) (which can be ignored), are the same as
  244.     (lx1,ly1) and (rx1,ry1) respectively.
  245.  
  246.     type    name            (brief description)
  247.     ----    ----            -------------------
  248.     float    lx1, ly1        (pixels)
  249.     float    rx1, ry1        (pixels)
  250.     float    lx2, ly2        (pixels)
  251.     float    rx2, ry2        (pixels)
  252.       .
  253.       .
  254.     float    lxn, lyn        (pixels)
  255.     float    rxn, ryn        (pixels)
  256.  
  257.     (3.6) TEXT
  258.     type    name            (brief description)
  259.     ----    ----            -------------------
  260.     int    object             (always 4)
  261.     int    sub_type        (0 : Left justified
  262.                      1 : Center justified
  263.                      2 : Right justified)
  264.     int    font             (not used)
  265.     int    font_size         (not used)
  266.     int    pen            (not used)
  267.     int    color            (not used)
  268.     int    depth            (not used)
  269.     int    angle            (radian, not used, the angle of the
  270.                     the base line of the string)
  271.     int    font_style        (not used)
  272.     int    height            (pixels)
  273.     int    length            (pixels)
  274.     int    x, y            (pixels, coordinate of the origin
  275.                      of the string.  If sub_type = 0, it is
  276.                      the lower left corner of the string.
  277.                      If sub_type = 1, it is the lower
  278.                      center.  Otherwise it is the lower
  279.                      right corner of the string.)
  280.     char    string[]        (ascii characters; starts after a blank
  281.                     character following the last number and
  282.                     ends before the character '\1'.  This
  283.                     character is not part of the string.
  284.                     Note that the string may contain '\n'.)
  285.