home *** CD-ROM | disk | FTP | other *** search
- The following is the format of fig output (fig 2.1).
-
- (1) The very first line is a comment line containing the name and version:
- #FIG 2.1
-
- The character # at the first column of a line indicates that the line
- is a comment line which will be ignored.
-
- (2) The first non-comment line consists of two numbers :
-
- int fig_resolution (pixels/inch)
- int coordinate_system (1 : origin is at the lower left corner
- 2 : Upper left)
-
- Fig_resolution is the resolution fig is using for the current file.
- It must always be 80 for compatibility with this version of Fig.
- Pixels are assumed to be square.
-
- (3) The rest of the file contains various objects. An object can be one
- of six classes (or types).
-
- i) Arc.
- ii) Ellipse which is a generalization of circle.
- iii) Polyline which includes polygon and box.
- iv) Spline which includes closed/open control/interpolated spline.
- v) Text.
- vi) Compound object which is composed of one or more objects.
-
- In the following elaboration on object formats, every value of fig
- output are separated by blank characters or new line ('\n'). The
- value of the not-used parameters will be -1.
-
- Some fields are described as "enumeration type" or "bit vector"; the
- values which these fields can take are defined in the header file object.h.
- The pen, arrow_type, and arrow_style fields are described as unused.
- These values may be defined in some future version of Fig.
-
- The color field is defined as follows:
-
- -1 = Default
- 0 = Black
- 1 = Blue
- 2 = Green
- 3 = Cyan
- 4 = Red
- 5 = Magenta
- 6 = Yellow
- 7 = White
- values from 8 to 2^30-1 = reserved for future use
-
- The depth field is defined as follows:
-
- 0 ... 999 where larger value means object is deeper than (under)
- objects with smaller depth
-
- The area fill field is defined as follows:
-
- 0 = not filled
- 1 = white
- ... values from 2 to 20 are shades of grey, from lighter to darker
- 21 = black
-
- The line_style field is defined as follows:
-
- -1 = Default
- 0 = Solid
- 1 = Dashed
- 2 = Dotted
-
- The style_val field is defined as the length, in pixels, of the on/off dashes
- for dashed lines, and the distance between the dots, in pixels, for dotted lines
-
- (3.1) ARC
-
- First line :
- type name (brief description)
- ---- ---- -------------------
- int object_code (always 5)
- int sub_type (always 1)
- int line_style (enumeration type)
- int line_thickness (pixels)
- int color (enumeration type)
- int depth (no units)
- int pen (not used)
- int area_fill (enumeration type)
- float style_val (pixels)
- int direction (0 : clockwise, 1 : counterclockwise)
- int forward_arrow (0: no forward arrow, 1: on)
- int backward_arrow (0: no forward arrow, 1: on)
- float center_x, center_y (center of the arc)
- int x1, y1 (pixels, the 1st point the user entered)
- int x2, y2 (pixels, the 2nd point)
- int x3, y3 (pixels, the last point)
-
- Forward arrow line (Optional; absent if forward_arrow is 0) :
- type name (brief description)
- ---- ---- -------------------
- int arrow_type (not used)
- int arrow_style (not used)
- float arrow_thickness (pixels)
- float arrow_width (pixels)
- float arrow_height (pixels)
-
- Backward arrow line (Optional; absent if backward_arrow is 0) :
- type name (brief description)
- ---- ---- -------------------
- int arrow_type (not used)
- int arrow_style (not used)
- float arrow_thickness (pixels)
- float arrow_width (pixels)
- float arrow_height (pixels)
-
- (3.2) COMPOUND
-
- A line with object code 6 signifies the start of a compound.
- There are four more numbers on this line which indicate the
- upper right corner and the lower left corner of the bounding
- box of this compound. A line with object code -6 signifies
- the end of the compound. Compound may be nested.
-
- First line :
- type name (brief description)
- ---- ---- -------------------
- int object_code (always 6)
- int upperright_corner_x (pixels)
- int upperright_corner_y (pixels)
- int lowerleft_corner_x (pixels)
- int lowerleft_corner_y (pixels)
-
- Subsequent lines :
- objects
- .
- .
-
- Last line :
- -6
-
- (3.3) ELLIPSE
-
- First line :
- type name (brief description)
- ---- ---- -------------------
- int object_code (always 1)
- int sub_type (1 : ellipse defined by radiuses
- 2 : ellipse defined by diameters
- 3 : circle defined by radius
- 4 : circle defined by diameter)
- int line_style (enumeration type)
- int thickness (pixels)
- int color (enumeration type)
- int depth (no units)
- int pen (not used)
- int area_fill (enumeration type)
- float style_val (pixels)
- int direction (always 1)
- float angle (radians, the angle of the x-axis)
- int center_x, center_y (pixels)
- int radius_x, radius_y (pixels)
- int start_x, start_y (pixels; the 1st point entered)
- int end_x, end_y (pixels; the last point entered)
-
- (3.4) POLYLINE
-
- First line :
- type name (brief description)
- ---- ---- -------------------
- int object_code (always 2)
- int sub_type (1 : polyline
- 2 : box
- 3 : polygon
- 4 : arc-box)
- 5 : imported-eps bounding-box)
- int line_style (enumeration type)
- int thickness (pixels)
- int color (enumeration type)
- int depth (no units)
- int pen (not used)
- int area_fill (enumeration type)
- float style_val (pixels)
- int radius (pixels)
- int forward_arrow (0: off, 1: on)
- int backward_arrow (0: off, 1: on)
-
- Forward arrow line : same as ARC object
-
- Backward arrow line : same as ARC object
-
- Points line :
- type name (brief description)
- ---- ---- -------------------
- int x1, y1 (pixels)
- int x2, y2 (pixels)
- .
- .
- int xn, yn (this will be the same as the 1st
- point for polygon and box)
- int x, y (always 9999, 9999; marks the end of
- point for polygon and box)
-
- EPS line :
- type name (brief description)
- ---- ---- -------------------
- boolean flipped orientation = normal (0) or flipped (1)
- char file[] name of eps file to import
-
- (3.5) SPLINE
-
- First line :
- type name (brief description)
- ---- ---- -------------------
- int object_code (always 3)
- int sub_type (0 : open spline
- 1 : closed spline
- 2 : open interpolated spline
- 3 : closed interpolated spline)
- int line_style (See the end of this section)
- int thickness (pixels)
- int color (enumeration type)
- int depth (no units)
- int pen (not used)
- int area_fill (enumeration type)
- float style_val (pixels)
- int forward_arrow (0: off, 1: on)
- int backward_arrow (0: off, 1: on)
-
- Forward arrow line : same as ARC object
-
- Backward arrow line : same as ARC object
-
- Points line : same as POLYLINE object
-
- Control points line (absent if sub_type is 1 or 2) :
- Control points of interpolated spline. There are two control
- points for each knots. A section i, of the spline is drawn
- using Bezier cubic with the following four points:
- (x ,y ), (rx ,ry ), (lx , ly ), (x , y ).
- i i i i i+1 i+1 i+1 i+1
- For closed interpolated spline the last pair of control points,
- (lxn,lyn) and (rxn,ryn) (which can be ignored), are the same as
- (lx1,ly1) and (rx1,ry1) respectively.
-
- type name (brief description)
- ---- ---- -------------------
- float lx1, ly1 (pixels)
- float rx1, ry1 (pixels)
- float lx2, ly2 (pixels)
- float rx2, ry2 (pixels)
- .
- .
- float lxn, lyn (pixels)
- float rxn, ryn (pixels)
-
- (3.6) TEXT
- type name (brief description)
- ---- ---- -------------------
- int object (always 4)
- int sub_type (0 : Left justified
- 1 : Center justified
- 2 : Right justified)
- int font (enumeration type)
- int font_size (points)
- int pen (not used)
- int color (enumeration type)
- int depth (no units)
- float angle (radians, the angle of the text)
- int font_flags (bit vector)
- int height (pixels)
- int length (pixels)
- int x, y (pixels, coordinate of the origin
- of the string. If sub_type = 0, it is
- the lower left corner of the string.
- If sub_type = 1, it is the lower
- center. Otherwise it is the lower
- right corner of the string.)
- char string[] (ascii characters; starts after a blank
- character following the last number and
- ends before the character '\1'. This
- character is not part of the string.
- Note that the string may contain '\n'.)
-