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

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