Package net.paulhertz.pixelaudio.curves
Class PAGestureWriter
java.lang.Object
net.paulhertz.pixelaudio.curves.PAGestureWriter
Reduced set of Adobe Illustrator 3.0 (ancient but still useful) path operators for
recording curves. May be useful for future development.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intBinary flag for closed path operators.static final charClosed and filled path operator.static final charClosed, filled, and stroked path operator.static final charClosed and stroked path operator.static final intBinary flag for filled path operators.static DecimalFormatA number formatter: call fourPlaces.format(Number) to return a String with four decimal places.(package private) static final intAdobe Illustrator default curve recursion is 4(package private) static final char[]static final charClosed and non-printing (invisible) path operator.static final charOpen and non-printing (invisible) path operator.static final charOpen and filled path operator.static final charOpen, filled, and stroked path operator.static final charOpen and stroked path operator.static final intBinary flag for stroked path operators.protected static booleanoptional transparency flag, for export to AI. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidIf you set transparency, either set it for every object, or reset it to totally opaque by calling noTransparency.static voidpaintPath(char pathOp, PrintWriter pw) Closes a series of path construction operations with the appropriate operator.static voidpaintPath(int pathIndex, PrintWriter pw) Closes a series of path construction operations with the appropriate operator stored in gPathOps, {'N', 'n', 'S', 's', 'F', 'f', 'B', 'b'}.static voidpsCurveTo(double x1, double y1, double x2, double y2, double x3, double y3, PrintWriter pw) Writes current point and "c" operator to output.static voidpsLineTo(double x, double y, PrintWriter pw) Writes current point and "L" operator to output.static voidpsMoveTo(double[] pt, PrintWriter pw) Writes current point and "m" operator to output.static voidpsMoveTo(double x, double y, PrintWriter pw) Writes current point and "m" operator to output.static voidpsMoveTo(processing.core.PVector pt, PrintWriter pw) Writes current point and "m" operator to output.static voidsetRGBFill(double[] shade, PrintWriter pw) Writes RGB fill value and fill operator "Xa" to output.static voidsetRGBFill(double r, double g, double b, PrintWriter pw) Writes RGB fill value and fill operator "Xa" to output.static voidsetRGBFill(int shade, PrintWriter pw) Writes RGB fill value and fill operator "Xa" to output.static voidsetRGBStroke(double[] shade, PrintWriter pw) Writes RGB stroke value and fill operator "XA" to output.static voidsetRGBStroke(double r, double g, double b, PrintWriter pw) Writes RGB stroke value and fill operator "XA" to output.static voidsetRGBStroke(int shade, PrintWriter pw) Writes RGB stroke value and fill operator "XA" to output.static voidsetTransparency(double trans, PrintWriter pw) Writes current opacity to an Illustrator file (not part of the AI7 spec).static voidsetUseTransparency(boolean useTransparency) Pass a value of true to enable transparency when exporting to Adobe Illustrator, default is false.static voidsetWeight(double weight, PrintWriter pw) Writes weight (in points) and weight operator "w" to output.static booleanstatic voidwriteHeader(PrintWriter pw, String title)
-
Field Details
-
gPathOps
static final char[] gPathOps -
FILL
public static final int FILLBinary flag for filled path operators. FILL, STROKE and CLOSE values can be summed to index a path operator tag- See Also:
-
STROKE
public static final int STROKEBinary flag for stroked path operators. FILL, STROKE and CLOSE values can be summed to index a path operator tag- See Also:
-
CLOSE
public static final int CLOSEBinary flag for closed path operators. FILL, STROKE and CLOSE values can be summed to index a path operator tag- See Also:
-
CLOSED_FILLED_STROKED
public static final char CLOSED_FILLED_STROKEDClosed, filled, and stroked path operator.- See Also:
-
OPEN_FILLED_STROKED
public static final char OPEN_FILLED_STROKEDOpen, filled, and stroked path operator.- See Also:
-
CLOSED_FILLED
public static final char CLOSED_FILLEDClosed and filled path operator.- See Also:
-
OPEN_FILLED
public static final char OPEN_FILLEDOpen and filled path operator.- See Also:
-
CLOSED_STROKED
public static final char CLOSED_STROKEDClosed and stroked path operator.- See Also:
-
OPEN_STROKED
public static final char OPEN_STROKEDOpen and stroked path operator.- See Also:
-
NONPRINTING_CLOSED
public static final char NONPRINTING_CLOSEDClosed and non-printing (invisible) path operator.- See Also:
-
NONPRINTING_OPEN
public static final char NONPRINTING_OPENOpen and non-printing (invisible) path operator.- See Also:
-
gCurveRecursionDepth
static final int gCurveRecursionDepthAdobe Illustrator default curve recursion is 4- See Also:
-
fourPlaces
A number formatter: call fourPlaces.format(Number) to return a String with four decimal places. -
useTransparency
protected static boolean useTransparencyoptional transparency flag, for export to AI. Transparency is not part of the AI 7.0 spec, but we try to support it.
-
-
Constructor Details
-
PAGestureWriter
public PAGestureWriter()
-
-
Method Details
-
writeHeader
-
setRGBFill
Writes RGB fill value and fill operator "Xa" to output.- Parameters:
r- red component (0..1)g- green component (0..1)b- blue component (0..1)pw-PrintWriterfor file output
-
setRGBFill
Writes RGB fill value and fill operator "Xa" to output.- Parameters:
shade- an array of fourdoubles in the range (0..1)pw-PrintWriterfor file output
-
setRGBFill
Writes RGB fill value and fill operator "Xa" to output.- Parameters:
shade- an RGBColor instancepw-PrintWriterfor file output
-
setRGBStroke
Writes RGB stroke value and fill operator "XA" to output.- Parameters:
r- red component (0..1)g- green component (0..1)b- blue component (0..1)pw-PrintWriterfor file output
-
setRGBStroke
Writes RGB stroke value and fill operator "XA" to output.- Parameters:
shade- an array of fourdoubles in the range (0..1)pw-PrintWriterfor file output
-
setRGBStroke
Writes RGB stroke value and fill operator "XA" to output.- Parameters:
shade- a RGBColor instancepw-PrintWriterfor file output
-
setWeight
Writes weight (in points) and weight operator "w" to output.- Parameters:
weight- stroke weight (positive decimal value)pw-PrintWriterfor file output
-
useTransparency
public static boolean useTransparency()- Returns:
- true if transparency is enabled, false otherwise.
-
setUseTransparency
public static void setUseTransparency(boolean useTransparency) Pass a value of true to enable transparency when exporting to Adobe Illustrator, default is false. Transparency markup is not supported in the AI7.0 specification, but it seems to work. Note that in Illustrator transparency affects the entire shape, both fill and stroke, unlike Processing, where fill and stroke can have separate transparency values. This means for stroked shapes, the stroke transparency will affect the whole shape in AI. SeesetTransparency(double, PrintWriter).- Parameters:
useTransparency-
-
setTransparency
Writes current opacity to an Illustrator file (not part of the AI7 spec). This particular operator is pieced together from inspecting AI files It is not part of the AI7 specification, the last one published by Adobe. I do not know what each of the arguments to Xy does, but the second one controls opacity.- Parameters:
trans- transparency value, in the range 0..1pw-PrintWriterfor file output
-
noTransparency
If you set transparency, either set it for every object, or reset it to totally opaque by calling noTransparency.- Parameters:
pw-PrintWriterfor file output
-
psMoveTo
Writes current point and "m" operator to output.- Parameters:
x- x coordinatey- y coordinatepw-PrintWriterfor file output
-
psMoveTo
Writes current point and "m" operator to output.- Parameters:
pt- array of two double values, x and y coordinatespw-PrintWriterfor file output
-
psMoveTo
Writes current point and "m" operator to output.- Parameters:
pt- a Java Point2D instancepw-PrintWriterfor file output
-
psLineTo
Writes current point and "L" operator to output.- Parameters:
x- x coordinatey- y coordinatepw-PrintWriterfor file output
-
psCurveTo
public static void psCurveTo(double x1, double y1, double x2, double y2, double x3, double y3, PrintWriter pw) Writes current point and "c" operator to output.- Parameters:
x1- control point 1 x coordinatey1- control point 1 y coordinatex2- control point 2 x coordinatey2- control point 2 y coordinatex3- end point x coordinatey3- end point y coordinatepw-PrintWriterfor file output
-
paintPath
Closes a series of path construction operations with the appropriate operator stored in gPathOps, {'N', 'n', 'S', 's', 'F', 'f', 'B', 'b'}. Requires an index value for the path operator. It may be simpler to call the otherpaintPathmethod, that accepts character constant.fill stroke close b 1 1 1 closed filled and stroked path B 1 1 0 open filled and stroked path f 1 0 1 closed filled path F 1 0 0 open filled path s 0 1 1 closed stroked path S 0 1 0 open stroked path n 0 0 1 non-printing closed path N 0 0 0 non-printing open path- Parameters:
pathIndex- an int in the range (0..7)pw-PrintWriterfor file output
-
paintPath
Closes a series of path construction operations with the appropriate operator.- Parameters:
pathOp- acharin {'N', 'n', 'S', 's', 'F', 'f', 'B', 'b'}It is simpler just to use one of the supplied constants CLOSED_FILLED_STROKED, OPEN_FILLED_STROKED, CLOSED_FILLED, OPEN_FILLED, CLOSED_STROKED, OPEN_STROKED, NONPRINTING_CLOSED, NONPRINTING_OPEN
pw-PrintWriterfor file output
-