//use the default constructor
AffineTransform tx = new AffineTransform();
PathIterator itr = a.getPathIterator(tx);
GeneralPath path = new GeneralPath();
out.writeExpression(new Expression(path, GeneralPath.class, "new", new Object[0]));
while (!itr.isDone()) {
float[] segment = new float[6]; //must use floats because lineTo etc use floats
int pathType = itr.currentSegment(segment);
switch (pathType) {
case PathIterator.SEG_CLOSE:
out.writeStatement(new Statement(path, "closePath", new Object[0]));
break;
case PathIterator.SEG_CUBICTO:
out.writeStatement(new Statement(path, "curveTo", new Object[] {segment[0], segment[1], segment[2], segment[3], segment[4], segment[5]}));
break;
case PathIterator.SEG_LINETO:
out.writeStatement(new Statement(path, "lineTo", new Object[] {segment[0], segment[1]}));
break;
case PathIterator.SEG_MOVETO:
out.writeStatement(new Statement(path, "moveTo", new Object[] {segment[0], segment[1]}));
break;
case PathIterator.SEG_QUADTO:
out.writeStatement(new Statement(path, "quadTo", new Object[] {segment[0], segment[1], segment[2], segment[3]}));
break;
}
itr.next();
}
return new Expression(a, Area.class, "new", new Object[] {path});
}