215 |
return new PathIterator() |
return new PathIterator() |
216 |
{ |
{ |
217 |
/** Current coordinate. */ |
/** Current coordinate. */ |
218 |
private int current; |
private int current = 0; |
219 |
|
|
220 |
public int getWindingRule() |
public int getWindingRule() |
221 |
{ |
{ |
224 |
|
|
225 |
public boolean isDone() |
public boolean isDone() |
226 |
{ |
{ |
227 |
return current < 2; |
return current >= 2; |
228 |
} |
} |
229 |
|
|
230 |
public void next() |
public void next() |
234 |
|
|
235 |
public int currentSegment(float[] coords) |
public int currentSegment(float[] coords) |
236 |
{ |
{ |
237 |
if (current == 0) |
int result; |
238 |
|
switch (current) |
239 |
{ |
{ |
240 |
|
case 0: |
241 |
coords[0] = (float) getX1(); |
coords[0] = (float) getX1(); |
242 |
coords[1] = (float) getY1(); |
coords[1] = (float) getY1(); |
243 |
if (at != null) |
result = SEG_MOVETO; |
244 |
at.transform(coords, 0, coords, 0, 1); |
break; |
245 |
return SEG_MOVETO; |
case 1: |
|
} |
|
|
if (current == 1) |
|
|
{ |
|
246 |
coords[0] = (float) getCtrlX(); |
coords[0] = (float) getCtrlX(); |
247 |
coords[1] = (float) getCtrlY(); |
coords[1] = (float) getCtrlY(); |
248 |
coords[2] = (float) getX2(); |
coords[2] = (float) getX2(); |
249 |
coords[3] = (float) getY2(); |
coords[3] = (float) getY2(); |
250 |
if (at != null) |
result = SEG_QUADTO; |
251 |
at.transform(coords, 0, coords, 0, 2); |
break; |
252 |
return SEG_QUADTO; |
default: |
253 |
|
throw new NoSuchElementException("quad iterator out of bounds"); |
254 |
} |
} |
255 |
throw new NoSuchElementException("quad iterator out of bounds"); |
if (at != null) |
256 |
|
at.transform(coords, 0, coords, 0, 2); |
257 |
|
return result; |
258 |
} |
} |
259 |
|
|
260 |
public int currentSegment(double[] coords) |
public int currentSegment(double[] coords) |
261 |
{ |
{ |
262 |
if (current == 0) |
int result; |
263 |
|
switch (current) |
264 |
{ |
{ |
265 |
|
case 0: |
266 |
coords[0] = getX1(); |
coords[0] = getX1(); |
267 |
coords[1] = getY1(); |
coords[1] = getY1(); |
268 |
if (at != null) |
result = SEG_MOVETO; |
269 |
at.transform(coords, 0, coords, 0, 1); |
break; |
270 |
return SEG_MOVETO; |
case 1: |
|
} |
|
|
if (current == 1) |
|
|
{ |
|
271 |
coords[0] = getCtrlX(); |
coords[0] = getCtrlX(); |
272 |
coords[1] = getCtrlY(); |
coords[1] = getCtrlY(); |
273 |
coords[2] = getX2(); |
coords[2] = getX2(); |
274 |
coords[3] = getY2(); |
coords[3] = getY2(); |
275 |
if (at != null) |
result = SEG_QUADTO; |
276 |
at.transform(coords, 0, coords, 0, 2); |
break; |
277 |
return SEG_QUADTO; |
default: |
278 |
|
throw new NoSuchElementException("quad iterator out of bounds"); |
279 |
} |
} |
280 |
throw new NoSuchElementException("quad iterator out of bounds"); |
if (at != null) |
281 |
|
at.transform(coords, 0, coords, 0, 2); |
282 |
|
return result; |
283 |
} |
} |
284 |
}; |
}; |
285 |
} |
} |