|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jfig.objects.FigWriter
write FIG 3.1 and 3.2 files.
Field Summary | |
(package private) int |
BACKWARD
|
(package private) ColorCache |
colorCache
|
protected FigObject |
currentObject
|
(package private) boolean |
debug
|
(package private) int |
FORWARD
|
(package private) int |
line_number
|
(package private) int |
n_errors
|
(package private) double |
resolution
|
(package private) double |
scale_factor
|
(package private) Format |
styleValFormat
|
Constructor Summary | |
FigWriter()
|
|
FigWriter(java.lang.Object app)
|
Method Summary | |
(package private) java.lang.String |
buildCharacterEscape(char c)
Build octal character escape for characters with c>= 128. |
(package private) java.lang.String |
buildTextString(FigText obj)
Wrapper function for handling of accent and similar stuff when writing FIG 3.1 text objects. |
void |
fake_fig32_controlpoints(FigPrintWriter f,
FigObject obj)
fake the FIG 3.2 X-spline model control point parameters from FIG 3.1 spline / bezier spline objects. |
double |
fig_scale(double x)
|
int |
fig_scale(int x)
Scale from jfig units (2400 dpi) to standard FIG 3.1 units (1200 dpi), both with the origin at the top left corner. |
int |
getArcDirection(FigArc obj)
|
int |
getAreaFill(FigAttribs attribs)
|
int |
getBackwardArrowFlag(FigAttribs attribs)
|
int |
getCapStyle(FigAttribs attribs)
|
int |
getDepth(FigAttribs attribs)
|
double |
getEllipseAngle(FigAttribs attribs)
|
int |
getEllipseDirection(FigAttribs attribs)
|
int |
getFillColorIndex(FigAttribs attribs)
|
int |
getFont(FigAttribs attribs)
|
double |
getFontAngle(FigAttribs attribs)
|
int |
getFontFlags(FigAttribs attribs)
|
double |
getFontSize(FigAttribs attribs)
|
int |
getForwardArrowFlag(FigAttribs attribs)
|
java.lang.String |
getHexString(int value,
int n_chars)
return a hex-formatted String of 'value' at least 'n_chars' wide, filling with leading zeroes as necessary. |
int |
getJoinStyle(FigAttribs attribs)
|
int |
getLineColorIndex(FigAttribs attribs)
|
int |
getLineStyle(FigAttribs attribs)
|
int |
getLineThickness(double FIGwidth)
|
int |
getLineThickness(int FIGwidth)
|
int |
getPenStyle(FigAttribs attribs)
|
int |
getRadius(FigAttribs attribs)
|
java.lang.String |
getStyleVal(FigAttribs attribs)
|
double |
getTextHeight(FigText obj)
Get text height and width --- taken from text object bounding box. |
double |
getTextLength(FigText obj)
|
void |
reset_debug()
|
void |
set_debug()
|
void |
setResolution(int i)
|
void |
write_arrow_line(FigPrintWriter f,
int direction,
FigObject obj)
Write the FIG 3.1 arrow representation of the forward or backward arrow on the FigObject obj. |
void |
write_fig31_arc(FigPrintWriter f,
FigArc obj)
write the FIG 3.1 representation of a jfig FigArc object |
void |
write_fig31_cpointline(FigPrintWriter f,
FigObject obj)
|
void |
write_fig31_ellipse(FigPrintWriter f,
FigEllipse obj)
Write the FIG 3.1 representation of a jfig FigEllipse object to stream f. |
int |
write_fig31_file(java.io.DataOutputStream f,
boolean top_level,
FigObjectList OL)
write a FIG3.1 file to stream f, where the editor objects are taken from the object list OL. |
int |
write_fig31_file(java.io.PrintWriter _f,
boolean top_level,
FigObjectList OL)
|
void |
write_fig31_header(FigPrintWriter f,
FigAttribs attribs)
Write a FIG3.1 file header to stream f. |
void |
write_fig31_object_comment(FigPrintWriter f,
FigObject obj)
write the per-object comment for the given FigObject. |
void |
write_fig31_pointline(FigPrintWriter f,
FigObject obj)
write a FIG3.1 polyline coordinate line to stream f |
void |
write_fig31_polyline(FigPrintWriter f,
FigObject obj)
Write a jfig polyline in FIG3.1 format to the stream f. |
void |
write_fig31_pseudocolors(FigPrintWriter f)
Search through our colorCache and look for colors with numbers from 32 to 543. |
void |
write_fig31_rectangle(FigPrintWriter f,
FigRectangle obj)
Write a jfig rectangle in FIG3.1 format to the stream f. |
void |
write_fig31_spline(FigPrintWriter f,
FigObject obj)
Write the FIG 3.1 representation of a FigSpline object to stream f Only normal splines supported by now, no control splines. |
void |
write_fig31_text(FigPrintWriter f,
FigText obj)
Write the FIG 3.1 representation of a jfig FigText object to stream f. |
void |
write_fig32_header(FigPrintWriter f,
FigAttribs attribs)
Write a FIG3.2 file header to stream f. |
void |
write_jfig_trigger(FigPrintWriter f,
FigTrigger obj)
|
void |
writeAsResource(java.io.PrintWriter _ps,
FigObject obj)
default implementation of 'writeAsResource'. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
final int FORWARD
final int BACKWARD
boolean debug
int line_number
int n_errors
ColorCache colorCache
double resolution
double scale_factor
protected FigObject currentObject
Format styleValFormat
Constructor Detail |
public FigWriter(java.lang.Object app)
public FigWriter()
Method Detail |
public void set_debug()
public void reset_debug()
public void setResolution(int i)
public int getLineStyle(FigAttribs attribs)
public int getLineThickness(int FIGwidth)
public int getLineThickness(double FIGwidth)
public int getLineColorIndex(FigAttribs attribs)
public int getFillColorIndex(FigAttribs attribs)
public int getDepth(FigAttribs attribs)
public int getPenStyle(FigAttribs attribs)
public int getAreaFill(FigAttribs attribs)
public java.lang.String getStyleVal(FigAttribs attribs)
public int getJoinStyle(FigAttribs attribs)
public int getCapStyle(FigAttribs attribs)
public int getRadius(FigAttribs attribs)
public int getForwardArrowFlag(FigAttribs attribs)
public int getBackwardArrowFlag(FigAttribs attribs)
public int getEllipseDirection(FigAttribs attribs)
public double getEllipseAngle(FigAttribs attribs)
public int getFont(FigAttribs attribs)
public double getFontSize(FigAttribs attribs)
public double getFontAngle(FigAttribs attribs)
public int getFontFlags(FigAttribs attribs)
public double getTextHeight(FigText obj)
public double getTextLength(FigText obj)
public int getArcDirection(FigArc obj)
public int fig_scale(int x)
public double fig_scale(double x)
public void write_jfig_trigger(FigPrintWriter f, FigTrigger obj)
public void write_arrow_line(FigPrintWriter f, int direction, FigObject obj)
public void write_fig31_pseudocolors(FigPrintWriter f)
public java.lang.String getHexString(int value, int n_chars)
public void write_fig31_ellipse(FigPrintWriter f, FigEllipse obj)
public void write_fig31_spline(FigPrintWriter f, FigObject obj)
java.lang.String buildCharacterEscape(char c)
java.lang.String buildTextString(FigText obj)
public void write_fig31_text(FigPrintWriter f, FigText obj)
While rotated text cannot be displayed in jfig, the attribute is maintained and used on output. German and other accents, however, are not yet supported.
As xfig don't likes empty texts, we just return if the text object has no text in it.
public void write_fig31_arc(FigPrintWriter f, FigArc obj)
public void write_fig31_cpointline(FigPrintWriter f, FigObject obj)
public void fake_fig32_controlpoints(FigPrintWriter f, FigObject obj)
Therefore, we generate the following contol point lines:
public void write_fig31_pointline(FigPrintWriter f, FigObject obj)
public void write_fig31_rectangle(FigPrintWriter f, FigRectangle obj)
public void write_fig31_polyline(FigPrintWriter f, FigObject obj)
The string 'line' will contain the following: object_code (2), sub_type( polyline/polygon), line_style, thickness, pen_color, fill_color, depth, pen_style (unused), area_fill. style_val, join_style, cap_style, radius, forward-arrow, backward-arrow, npoints. Then follow the forward-arrow and backward-arrow and point lines.
public void write_fig31_object_comment(FigPrintWriter f, FigObject obj)
public void write_fig32_header(FigPrintWriter f, FigAttribs attribs)
public void write_fig31_header(FigPrintWriter f, FigAttribs attribs)
public int write_fig31_file(java.io.DataOutputStream f, boolean top_level, FigObjectList OL)
The flag 'top_level' indicates that we should write the FIG3.1 header. This is set to true on the first call, and set to false on recursive calls when writing compound objects.
Return the number of errors, if any.
public int write_fig31_file(java.io.PrintWriter _f, boolean top_level, FigObjectList OL)
public void writeAsResource(java.io.PrintWriter _ps, FigObject obj)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |