if (segments == null)
{
return null;
}
final GeneralPath path = new GeneralPath();
path.setWindingRule(wRule);
for (int i = 0; i < segments.length; i++)
{
final int segmentType = segments[i].getSegmentType();
switch (segmentType)
{
case PathIterator.SEG_CLOSE:
{
path.closePath();
break;
}
case PathIterator.SEG_CUBICTO:
{
path.curveTo(segments[i].getX1(), segments[i].getY1(),
segments[i].getX2(), segments[i].getY2(),
segments[i].getX3(), segments[i].getY3());
break;
}
case PathIterator.SEG_LINETO:
{
path.lineTo(segments[i].getX1(), segments[i].getY1());
break;
}
case PathIterator.SEG_MOVETO:
{
path.moveTo(segments[i].getX1(), segments[i].getY1());
break;
}
case PathIterator.SEG_QUADTO:
{
path.quadTo(segments[i].getX1(), segments[i].getY1(),
segments[i].getX2(), segments[i].getY2());
break;
}
default:
throw new IllegalStateException("Unexpected result from path iterator.");