1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| GeneralPath path = new GeneralPath( );
Shape sh = new RoundRectangle2D.Double(5d,10d,200d,100d,20d,20d);
Shape sh2 ;
PathIterator pi = sh.getPathIterator(null);
int i = 0 ;
float seg[] = new float[6];
while(!pi.isDone()) {
int segType = pi.currentSegment(seg);
switch(segType) {
case PathIterator.SEG_MOVETO:
path.moveTo(seg[0],seg[1]);
break;
case PathIterator.SEG_LINETO:
path.lineTo(seg[0],seg[1]);
break;
case PathIterator.SEG_QUADTO:
path.quadTo(seg[0],seg[1],seg[2],seg[3]);
break;
case PathIterator.SEG_CUBICTO:
path.curveTo(seg[0],seg[1],seg[2],seg[3],seg[4],seg[5]);
break;
case PathIterator.SEG_CLOSE:
path.closePath();
}
pi.next();
} // while
sh2 = path; |
Partager