204 |
return new PathIterator() |
return new PathIterator() |
205 |
{ |
{ |
206 |
/** Current coordinate. */ |
/** Current coordinate. */ |
207 |
private int current; |
private int current = 0; |
208 |
|
|
209 |
public int getWindingRule() |
public int getWindingRule() |
210 |
{ |
{ |
213 |
|
|
214 |
public boolean isDone() |
public boolean isDone() |
215 |
{ |
{ |
216 |
return current < 2; |
return current >= 2; |
217 |
} |
} |
218 |
|
|
219 |
public void next() |
public void next() |
223 |
|
|
224 |
public int currentSegment(float[] coords) |
public int currentSegment(float[] coords) |
225 |
{ |
{ |
226 |
if (current == 0) |
int result; |
227 |
|
switch (current) |
228 |
{ |
{ |
229 |
|
case 0: |
230 |
coords[0] = (float) getX1(); |
coords[0] = (float) getX1(); |
231 |
coords[1] = (float) getY1(); |
coords[1] = (float) getY1(); |
232 |
if (at != null) |
result = SEG_MOVETO; |
233 |
at.transform(coords, 0, coords, 0, 1); |
break; |
234 |
return SEG_MOVETO; |
case 1: |
|
} |
|
|
if (current == 1) |
|
|
{ |
|
235 |
coords[0] = (float) getCtrlX1(); |
coords[0] = (float) getCtrlX1(); |
236 |
coords[1] = (float) getCtrlY1(); |
coords[1] = (float) getCtrlY1(); |
237 |
coords[2] = (float) getCtrlX2(); |
coords[2] = (float) getCtrlX2(); |
238 |
coords[3] = (float) getCtrlY2(); |
coords[3] = (float) getCtrlY2(); |
239 |
coords[4] = (float) getX2(); |
coords[4] = (float) getX2(); |
240 |
coords[5] = (float) getY2(); |
coords[5] = (float) getY2(); |
241 |
if (at != null) |
result = SEG_CUBICTO; |
242 |
at.transform(coords, 0, coords, 0, 3); |
break; |
243 |
return SEG_CUBICTO; |
default: |
244 |
|
throw new NoSuchElementException("cubic iterator out of bounds"); |
245 |
} |
} |
246 |
throw new NoSuchElementException("cubic iterator out of bounds"); |
if (at != null) |
247 |
|
at.transform(coords, 0, coords, 0, 3); |
248 |
|
return result; |
249 |
} |
} |
250 |
|
|
251 |
public int currentSegment(double[] coords) |
public int currentSegment(double[] coords) |
252 |
{ |
{ |
253 |
if (current == 0) |
int result; |
254 |
|
switch (current) |
255 |
{ |
{ |
256 |
|
case 0: |
257 |
coords[0] = getX1(); |
coords[0] = getX1(); |
258 |
coords[1] = getY1(); |
coords[1] = getY1(); |
259 |
if (at != null) |
result = SEG_MOVETO; |
260 |
at.transform(coords, 0, coords, 0, 1); |
break; |
261 |
return SEG_MOVETO; |
case 1: |
|
} |
|
|
if (current == 1) |
|
|
{ |
|
262 |
coords[0] = getCtrlX1(); |
coords[0] = getCtrlX1(); |
263 |
coords[1] = getCtrlY1(); |
coords[1] = getCtrlY1(); |
264 |
coords[2] = getCtrlX2(); |
coords[2] = getCtrlX2(); |
265 |
coords[3] = getCtrlY2(); |
coords[3] = getCtrlY2(); |
266 |
coords[4] = getX2(); |
coords[4] = getX2(); |
267 |
coords[5] = getY2(); |
coords[5] = getY2(); |
268 |
if (at != null) |
result = SEG_CUBICTO; |
269 |
at.transform(coords, 0, coords, 0, 3); |
break; |
270 |
return SEG_CUBICTO; |
default: |
271 |
} |
throw new NoSuchElementException("cubic iterator out of bounds"); |
272 |
throw new NoSuchElementException("cubic iterator out of bounds"); |
} |
273 |
|
if (at != null) |
274 |
|
at.transform(coords, 0, coords, 0, 3); |
275 |
|
return result; |
276 |
} |
} |
277 |
}; |
}; |
278 |
} |
} |