GeneralPath a = (GeneralPath)oldInstance;
AffineTransform tx = new AffineTransform();
PathIterator itr = a.getPathIterator(tx);
out.writeStatement(new Statement(a, "setWindingRule", new Object[] {a.getWindingRule()}));
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(a, "closePath", new Object[0]));
break;
case PathIterator.SEG_CUBICTO:
out.writeStatement(new Statement(a, "curveTo", new Object[] {segment[0], segment[1], segment[2], segment[3], segment[4], segment[5]}));
break;
case PathIterator.SEG_LINETO:
out.writeStatement(new Statement(a, "lineTo", new Object[] {segment[0], segment[1]}));
break;
case PathIterator.SEG_MOVETO:
out.writeStatement(new Statement(a, "moveTo", new Object[] {segment[0], segment[1]}));
break;
case PathIterator.SEG_QUADTO:
out.writeStatement(new Statement(a, "quadTo", new Object[] {segment[0], segment[1], segment[2], segment[3]}));
break;
}
itr.next();
}
}