MCPcopy Index your code
hub / github.com/processing/processing / PathIterator

Class PathIterator

core/src/processing/opengl/LinePath.java:326–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324
325
326 static public class PathIterator {
327 float floatCoords[];
328
329 int typeIdx;
330
331 int pointIdx;
332
333 int colorIdx;
334
335 LinePath path;
336
337 static final int curvecoords[] = { 2, 2, 0 };
338
339 PathIterator(LinePath p2df) {
340 this.path = p2df;
341 this.floatCoords = p2df.floatCoords;
342 pointIdx = 0;
343 colorIdx = 0;
344 }
345
346 public int currentSegment(float[] coords) {
347 int type = path.pointTypes[typeIdx];
348 int numCoords = curvecoords[type];
349 if (numCoords > 0) {
350 System.arraycopy(floatCoords, pointIdx, coords, 0, numCoords);
351 int color = path.pointColors[colorIdx];
352 coords[numCoords + 0] = (color >> 24) & 0xFF;
353 coords[numCoords + 1] = (color >> 16) & 0xFF;
354 coords[numCoords + 2] = (color >> 8) & 0xFF;
355 coords[numCoords + 3] = (color >> 0) & 0xFF;
356 }
357 return type;
358 }
359
360 public int currentSegment(double[] coords) {
361 int type = path.pointTypes[typeIdx];
362 int numCoords = curvecoords[type];
363 if (numCoords > 0) {
364 for (int i = 0; i < numCoords; i++) {
365 coords[i] = floatCoords[pointIdx + i];
366 }
367 int color = path.pointColors[colorIdx];
368 coords[numCoords + 0] = (color >> 24) & 0xFF;
369 coords[numCoords + 1] = (color >> 16) & 0xFF;
370 coords[numCoords + 2] = (color >> 8) & 0xFF;
371 coords[numCoords + 3] = (color >> 0) & 0xFF;
372 }
373 return type;
374 }
375
376 public int getWindingRule() {
377 return path.getWindingRule();
378 }
379
380 public boolean isDone() {
381 return (typeIdx >= path.numTypes);
382 }
383

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected