Java Code Examples for java.awt.geom.PathIterator

The following examples show how to use java.awt.geom.PathIterator. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: pumpernickel   Source File: MutablePath.java    License: MIT License 6 votes vote down vote up
public synchronized void append(Shape s, AffineTransform transform) {
	PathIterator i = s.getPathIterator(transform);
	double[] coords = new double[6];
	while (i.isDone() == false) {
		int k = i.currentSegment(coords);
		if (k == PathIterator.SEG_CLOSE) {
			close();
		} else if (k == PathIterator.SEG_CUBICTO) {
			curveTo(coords[0], coords[1], coords[2], coords[3], coords[4],
					coords[5]);
		} else if (k == PathIterator.SEG_QUADTO) {
			quadTo(coords[0], coords[1], coords[2], coords[3]);
		} else if (k == PathIterator.SEG_LINETO) {
			lineTo(coords[0], coords[1]);
		} else if (k == PathIterator.SEG_MOVETO) {
			moveTo(coords[0], coords[1]);
		} else {
			throw new RuntimeException("unexpected segment type (" + k
					+ ")");
		}
		i.next();
	}
}
 
Example 2
Source Project: hottub   Source File: LayoutPathImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
public Shape mapShape(Shape s) {
    if (LOGMAP) LOG.format("mapshape on path: %s\n", LayoutPathImpl.SegmentPath.this);
    PathIterator pi = s.getPathIterator(null, 1); // cheap way to handle curves.

    if (LOGMAP) LOG.format("start\n");
    init();

    final double[] coords = new double[2];
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case SEG_CLOSE: close(); break;
        case SEG_MOVETO: moveTo(coords[0], coords[1]); break;
        case SEG_LINETO: lineTo(coords[0], coords[1]); break;
        default: break;
        }

        pi.next();
    }
    if (LOGMAP) LOG.format("finish\n\n");

    GeneralPath gp = new GeneralPath();
    for (Segment seg: segments) {
        gp.append(seg.gp, false);
    }
    return gp;
}
 
Example 3
Source Project: TencentKona-8   Source File: LayoutPathImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
public Shape mapShape(Shape s) {
    if (LOGMAP) LOG.format("mapshape on path: %s\n", LayoutPathImpl.SegmentPath.this);
    PathIterator pi = s.getPathIterator(null, 1); // cheap way to handle curves.

    if (LOGMAP) LOG.format("start\n");
    init();

    final double[] coords = new double[2];
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case SEG_CLOSE: close(); break;
        case SEG_MOVETO: moveTo(coords[0], coords[1]); break;
        case SEG_LINETO: lineTo(coords[0], coords[1]); break;
        default: break;
        }

        pi.next();
    }
    if (LOGMAP) LOG.format("finish\n\n");

    GeneralPath gp = new GeneralPath();
    for (Segment seg: segments) {
        gp.append(seg.gp, false);
    }
    return gp;
}
 
Example 4
Source Project: hottub   Source File: PiscesRenderingEngine.java    License: GNU General Public License v2.0 6 votes vote down vote up
NormalizingPathIterator(PathIterator src, NormMode mode) {
    this.src = src;
    switch (mode) {
    case ON_NO_AA:
        // round to nearest (0.25, 0.25) pixel
        lval = rval = 0.25f;
        break;
    case ON_WITH_AA:
        // round to nearest pixel center
        lval = 0f;
        rval = 0.5f;
        break;
    case OFF:
        throw new InternalError("A NormalizingPathIterator should " +
                 "not be created if no normalization is being done");
    default:
        throw new InternalError("Unrecognized normalization mode");
    }
}
 
Example 5
Source Project: astor   Source File: ChartEntity.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a string containing the coordinates for a given shape.  This
 * string is intended for use in an image map.
 *
 * @param shape  the shape (<code>null</code> not permitted).
 *
 * @return The coordinates for a given shape as string.
 */
private String getPolyCoords(Shape shape) {
    if (shape == null) {
        throw new IllegalArgumentException("Null 'shape' argument.");
    }
    StringBuffer result = new StringBuffer();
    boolean first = true;
    float[] coords = new float[6];
    PathIterator pi = shape.getPathIterator(null, 1.0);
    while (!pi.isDone()) {
        pi.currentSegment(coords);
        if (first) {
            first = false;
            result.append((int) coords[0]);
            result.append(",").append((int) coords[1]);
        }
        else {
            result.append(",");
            result.append((int) coords[0]);
            result.append(",");
            result.append((int) coords[1]);
        }
        pi.next();
    }
    return result.toString();
}
 
Example 6
Source Project: audiveris   Source File: GeoPath.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Report the last defining point of the path.
 *
 * @return the last path point
 */
public Point2D getLastPoint ()
{
    final double[] buffer = new double[6];
    final PathIterator it = getPathIterator(null);

    if (it.isDone()) {
        return null;
    }

    double x = 0;
    double y = 0;

    while (!it.isDone()) {
        final int segmentKind = it.currentSegment(buffer);
        final int count = countOf(segmentKind);
        x = buffer[count - 2];
        y = buffer[count - 1];
        it.next();
    }

    return new Point2D.Double(x, y);
}
 
Example 7
Source Project: pumpernickel   Source File: BasicMouseSmoothing.java    License: MIT License 6 votes vote down vote up
/** Flattens this shape and calculates its length */
protected static float getLength(Shape shape) {
	PathIterator i = shape.getPathIterator(null, .5);
	float[] s = new float[6];
	float sum = 0;
	float lastX = -1;
	float lastY = -1;
	while (i.isDone() == false) {
		int k = i.currentSegment(s);
		if (k == PathIterator.SEG_LINETO) {
			sum += (float) Math.sqrt((lastX - s[0]) * (lastX - s[0])
					+ (lastY - s[1]) * (lastY - s[1]));
		}
		lastX = s[0];
		lastY = s[1];
		i.next();
	}
	return sum;
}
 
Example 8
Source Project: audiveris   Source File: GeoPath.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Report the first defining point of the path.
 *
 * @return the first path point
 */
public Point2D getFirstPoint ()
{
    final double[] buffer = new double[6];
    final PathIterator it = getPathIterator(null);

    if (!it.isDone()) {
        final int segmentKind = it.currentSegment(buffer);
        final int count = countOf(segmentKind);
        final double x = buffer[count - 2];
        final double y = buffer[count - 1];

        if ((segmentKind == SEG_MOVETO) || (segmentKind == SEG_CLOSE)) {
            return new Point2D.Double(x, y);
        } else {
            return new Point2D.Double(0, 0);
        }
    }

    return null;
}
 
Example 9
Source Project: jdk8u-jdk   Source File: Order3.java    License: GNU General Public License v2.0 6 votes vote down vote up
public int getSegment(double coords[]) {
    if (direction == INCREASING) {
        coords[0] = cx0;
        coords[1] = cy0;
        coords[2] = cx1;
        coords[3] = cy1;
        coords[4] = x1;
        coords[5] = y1;
    } else {
        coords[0] = cx1;
        coords[1] = cy1;
        coords[2] = cx0;
        coords[3] = cy0;
        coords[4] = x0;
        coords[5] = y0;
    }
    return PathIterator.SEG_CUBICTO;
}
 
Example 10
Source Project: openjdk-8   Source File: LayoutPathImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
public Shape mapShape(Shape s) {
    if (LOGMAP) LOG.format("mapshape on path: %s\n", LayoutPathImpl.SegmentPath.this);
    PathIterator pi = s.getPathIterator(null, 1); // cheap way to handle curves.

    if (LOGMAP) LOG.format("start\n");
    init();

    final double[] coords = new double[2];
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case SEG_CLOSE: close(); break;
        case SEG_MOVETO: moveTo(coords[0], coords[1]); break;
        case SEG_LINETO: lineTo(coords[0], coords[1]); break;
        default: break;
        }

        pi.next();
    }
    if (LOGMAP) LOG.format("finish\n\n");

    GeneralPath gp = new GeneralPath();
    for (Segment seg: segments) {
        gp.append(seg.gp, false);
    }
    return gp;
}
 
Example 11
Source Project: gef   Source File: AWT2SWT.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Converts a Java2D {@link PathIterator} into an SWT {@link PathData}. Note
 * that while Java2D's {@link PathIterator} contains the specification of a
 * {@link PathIterator#WIND_EVEN_ODD} or {@link PathIterator#WIND_NON_ZERO}
 * winding rule ({@link PathIterator#getWindingRule()}), this information is
 * not kept in SWT's {@link PathData}, but is instead specified when drawing
 * an SWT {@link Path} (which can be constructed from the {@link PathData})
 * on an SWT {@link GC} (via {@link SWT#FILL_WINDING} or
 * {@link SWT#FILL_EVEN_ODD}). Therefore the returned SWT {@link PathData}
 * will not contain any information about the winding rule that was
 * specified in the passed in {@link PathIterator}.
 * 
 * @param iterator
 *            the {@link PathIterator} to transform
 * @return a new {@link PathData} representing the same geometric path
 */
public static PathData toSWTPathData(PathIterator iterator) {
	byte[] types = new byte[0];
	float[] points = new float[0];
	while (!iterator.isDone()) {
		float[] segment = new float[6];
		int type = iterator.currentSegment(segment);
		switch (type) {
		case PathIterator.SEG_MOVETO:
			types = getTypeAppended(types, (byte) SWT.PATH_MOVE_TO);
			points = getPointAppended(points, segment[0], segment[1]);
			break;
		case PathIterator.SEG_LINETO:
			types = getTypeAppended(types, (byte) SWT.PATH_LINE_TO);
			points = getPointAppended(points, segment[0], segment[1]);
			break;
		case PathIterator.SEG_QUADTO:
			types = getTypeAppended(types, (byte) SWT.PATH_QUAD_TO);
			points = getPointAppended(points, segment[0], segment[1]);
			points = getPointAppended(points, segment[2], segment[3]);
			break;
		case PathIterator.SEG_CUBICTO:
			types = getTypeAppended(types, (byte) SWT.PATH_CUBIC_TO);
			points = getPointAppended(points, segment[0], segment[1]);
			points = getPointAppended(points, segment[2], segment[3]);
			points = getPointAppended(points, segment[4], segment[5]);
			break;
		case PathIterator.SEG_CLOSE:
			types = getTypeAppended(types, (byte) SWT.PATH_CLOSE);
			break;
		}
		iterator.next();
	}
	PathData pathData = new PathData();
	pathData.points = points;
	pathData.types = types;
	return pathData;
}
 
Example 12
Source Project: buffer_bci   Source File: FXGraphics2D.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Maps a shape to a path in the graphics context. 
 * 
 * @param s  the shape ({@code null} not permitted).
 */
private void shapeToPath(Shape s) {
    double[] coords = new double[6];
    this.gc.beginPath();
    PathIterator iterator = s.getPathIterator(null);
    while (!iterator.isDone()) {
        int segType = iterator.currentSegment(coords);
        switch (segType) {
            case PathIterator.SEG_MOVETO:
                this.gc.moveTo(coords[0], coords[1]);
                break;
            case PathIterator.SEG_LINETO:
                this.gc.lineTo(coords[0], coords[1]);
                break;
            case PathIterator.SEG_QUADTO:
                this.gc.quadraticCurveTo(coords[0], coords[1], coords[2], 
                        coords[3]);
                break;
            case PathIterator.SEG_CUBICTO:
                this.gc.bezierCurveTo(coords[0], coords[1], coords[2], 
                        coords[3], coords[4], coords[5]);
                break;
            case PathIterator.SEG_CLOSE:
                this.gc.closePath();
                break;
            default:
                throw new RuntimeException("Unrecognised segment type " 
                        + segType);
        }
        iterator.next();
    }
}
 
Example 13
Source Project: blog-codes   Source File: ExtendedGeneralPath.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Delegates to the enclosed <code>GeneralPath</code>.
 */
public synchronized void lineTo(float x, float y)
{
	checkMoveTo(); // check if prev command was moveto
	path.lineTo(x, y);

	makeRoom(2);
	types[numSeg++] = PathIterator.SEG_LINETO;
	cx = values[numVals++] = x;
	cy = values[numVals++] = y;
}
 
Example 14
Source Project: Bytecoder   Source File: DMarlinRenderingEngine.java    License: Apache License 2.0 5 votes vote down vote up
@Override
PathIterator getNormalizingPathIterator(final DRendererContext rdrCtx,
                                        final PathIterator src)
{
    // return original path iterator if normalization is disabled:
    return src;
}
 
Example 15
Source Project: pumpernickel   Source File: CurvedPolyline.java    License: MIT License 5 votes vote down vote up
/**
 * Set a winding rule.
 * 
 * @param newWindingRule
 *            <code>PathIterator.WIND_EVEN_ODD</code> or
 *            <code>PathIterator.WIND_NON_ZERO</code>.
 * @return true if a change occurred.
 */
public synchronized boolean setWindingRule(int newWindingRule) {
	if (newWindingRule == PathIterator.WIND_EVEN_ODD
			|| newWindingRule == PathIterator.WIND_NON_ZERO) {
		throw new IllegalArgumentException();
	}
	if (windingRule == newWindingRule)
		return false;
	windingRule = newWindingRule;
	return true;
}
 
Example 16
Source Project: openjdk-jdk8u   Source File: SunGraphics2D.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected void validateCompClip() {
    int origClipState = clipState;
    if (usrClip == null) {
        clipState = CLIP_DEVICE;
        clipRegion = devClip;
    } else if (usrClip instanceof Rectangle2D) {
        clipState = CLIP_RECTANGULAR;
        if (usrClip instanceof Rectangle) {
            clipRegion = devClip.getIntersection((Rectangle)usrClip);
        } else {
            clipRegion = devClip.getIntersection(usrClip.getBounds());
        }
    } else {
        PathIterator cpi = usrClip.getPathIterator(null);
        int box[] = new int[4];
        ShapeSpanIterator sr = LoopPipe.getFillSSI(this);
        try {
            sr.setOutputArea(devClip);
            sr.appendPath(cpi);
            sr.getPathBox(box);
            Region r = Region.getInstance(box);
            r.appendSpans(sr);
            clipRegion = r;
            clipState =
                r.isRectangular() ? CLIP_RECTANGULAR : CLIP_SHAPE;
        } finally {
            sr.dispose();
        }
    }
    if (origClipState != clipState &&
        (clipState == CLIP_SHAPE || origClipState == CLIP_SHAPE))
    {
        validFontInfo = false;
        invalidatePipe();
    }
}
 
Example 17
Source Project: jdk8u_jdk   Source File: ShapeSpanIterator.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void appendPath(PathIterator pi) {
    float coords[] = new float[6];

    setRule(pi.getWindingRule());
    while (!pi.isDone()) {
        addSegment(pi.currentSegment(coords), coords);
        pi.next();
    }
    pathDone();
}
 
Example 18
Source Project: mil-sym-java   Source File: lineutility.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * same as createStrokedShape except it uses a Path2D
 *
 * @param shape
 * @return
 */
protected static Shape createStrokedShape2(Path2D shape) {
    GeneralPath newshape = new GeneralPath(); // Start with an empty shape
    try {
        // Iterate through the specified shape, perturb its coordinates, and
        // use them to build up the new shape.
        float[] coords = new float[6];
        for (PathIterator i = shape.getPathIterator(null); !i.isDone(); i.next()) {
            int type = i.currentSegment(coords);
            switch (type) {
                case PathIterator.SEG_MOVETO:
                    //perturb(coords, 2);
                    newshape.moveTo(coords[0], coords[1]);
                    break;
                case PathIterator.SEG_LINETO:
                    //perturb(coords, 2);
                    newshape.lineTo(coords[0], coords[1]);
                    break;
                case PathIterator.SEG_QUADTO:
                    //perturb(coords, 4);
                    newshape.quadTo(coords[0], coords[1], coords[2], coords[3]);
                    break;
                case PathIterator.SEG_CUBICTO:
                    //perturb(coords, 6);
                    newshape.curveTo(coords[0], coords[1], coords[2], coords[3],
                            coords[4], coords[5]);
                    break;
                case PathIterator.SEG_CLOSE:
                    newshape.closePath();
                    break;
            }

        }
    } catch (Exception exc) {
        ErrorLogger.LogException(_className, "createStrokedShape",
                new RendererException("Failed inside createStrokedShape", exc));
    }
    return newshape;
}
 
Example 19
public void appendPath(PathIterator pi) {
    float coords[] = new float[6];

    setRule(pi.getWindingRule());
    while (!pi.isDone()) {
        addSegment(pi.currentSegment(coords), coords);
        pi.next();
    }
    pathDone();
}
 
Example 20
Source Project: HtmlUnit-Android   Source File: Order2.java    License: Apache License 2.0 5 votes vote down vote up
public int getSegment(double coords[]) {
    coords[0] = cx0;
    coords[1] = cy0;
    if (direction == INCREASING) {
        coords[2] = x1;
        coords[3] = y1;
    } else {
        coords[2] = x0;
        coords[3] = y0;
    }
    return PathIterator.SEG_QUADTO;
}
 
Example 21
/**
 * 建立一個相關資訊物件
 * 
 * @param area
 *            要計算資訊的area
 */
public ShapeInformation(Area area)
{
	approximativeCircumference = 0.0;
	approximativeRegion = 0.0;
	double[] controlPoint = new double[6];
	SimplePolygon simplePolygon = new SimplePolygon();
	for (PathIterator pathIterator = area.getPathIterator(null); !pathIterator.isDone(); pathIterator
			.next())
	{
		int type = pathIterator.currentSegment(controlPoint);
		switch (type)
		{
		case PathIterator.SEG_CUBICTO:
			simplePolygon.addPoint(controlPoint[0], controlPoint[1]);
			simplePolygon.addPoint(controlPoint[2], controlPoint[3]);
			simplePolygon.addPoint(controlPoint[4], controlPoint[5]);
			break;
		case PathIterator.SEG_QUADTO:
			simplePolygon.addPoint(controlPoint[0], controlPoint[1]);
			simplePolygon.addPoint(controlPoint[2], controlPoint[3]);
			break;
		case PathIterator.SEG_LINETO:
			simplePolygon.addPoint(controlPoint[0], controlPoint[1]);
			break;
		case PathIterator.SEG_MOVETO:
			simplePolygon.addPoint(controlPoint[0], controlPoint[1]);
			break;
		case PathIterator.SEG_CLOSE:
			simplePolygon.finish();
			approximativeCircumference += simplePolygon.getCircumference();
			approximativeRegion += simplePolygon.getRegionSize();
			simplePolygon.clear();
			break;
		}
	}
}
 
Example 22
static int getLength(int type) {
    switch(type) {
        case PathIterator.SEG_CUBICTO:
            return 6;
        case PathIterator.SEG_QUADTO:
            return 4;
        case PathIterator.SEG_LINETO:
        case PathIterator.SEG_MOVETO:
            return 2;
        case PathIterator.SEG_CLOSE:
            return 0;
        default:
            throw new IllegalStateException("Invalid type: " + type);
    }
}
 
Example 23
Source Project: coming   Source File: Elixir_001_t.java    License: MIT License 5 votes vote down vote up
/**
 * Tests two polygons for equality.  If both are <code>null</code> this
 * method returns <code>true</code>.
 *
 * @param p1  path 1 (<code>null</code> permitted).
 * @param p2  path 2 (<code>null</code> permitted).
 *
 * @return A boolean.
 */
public static boolean equal(GeneralPath p1, GeneralPath p2) {
    if (p1 == null) {
        return (p2 == null);
    }
    if (p2 == null) {
        return false;
    }
    if (p1.getWindingRule() != p2.getWindingRule()) {
        return false;
    }
    PathIterator iterator1 = p1.getPathIterator(null);
    PathIterator iterator2 = p2.getPathIterator(null);
    double[] d1 = new double[6];
    double[] d2 = new double[6];
    boolean done = iterator1.isDone() && iterator2.isDone();
    while (!done) {
        if (iterator1.isDone() != iterator2.isDone()) {
            return false;
        }
        int seg1 = iterator1.currentSegment(d1);
        int seg2 = iterator2.currentSegment(d2);
        if (seg1 != seg2) {
            return false;
        }
        if (!Arrays.equals(d1, d2)) {
            return false;
        }
        iterator1.next();
        iterator2.next();
        done = iterator1.isDone() && iterator2.isDone();
    }
    return true;
}
 
Example 24
Source Project: tracker   Source File: PencilDrawing.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
  * Gets the points that define the GeneralPath.
  *
  * @return double[][], each point is double[] {Seg_type, x, y}
  */
public double[][] getPathPoints() {
	pointArray.clear();
	for (PathIterator pi = generalPath.getPathIterator(null); !pi.isDone(); pi.next()) {
    int type = pi.currentSegment(coords); // type will be SEG_LINETO or SEG_MOVETO
    if (type==PathIterator.SEG_LINETO) {
    	pointArray.add(new double[] {type, coords[0], coords[1]});
    }
	}
	return pointArray.toArray(new double[pointArray.size()][3]);
}
 
Example 25
Source Project: TencentKona-8   Source File: WPathGraphics.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void deviceFill(PathIterator pathIter, Color color) {

    WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob();

    convertToWPath(pathIter);
    wPrinterJob.selectSolidBrush(color);
    wPrinterJob.fillPath();
}
 
Example 26
Source Project: pumpernickel   Source File: ShapeUtils.java    License: MIT License 5 votes vote down vote up
/** Returns the number of separate paths in the shape provided. */
public static int getSubPathCount(Shape s) {
	PathIterator i = s.getPathIterator(null);
	int ctr = 0;
	float[] coords = new float[6];
	while (i.isDone() == false) {
		if (i.currentSegment(coords) == PathIterator.SEG_MOVETO) {
			ctr++;
		}
		i.next();
	}
	return ctr++;
}
 
Example 27
@Override
protected void deviceClip(PathIterator pathIter) {

    WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob();

    convertToWPath(pathIter);
    wPrinterJob.selectClipPath();
}
 
Example 28
Source Project: mil-sym-android   Source File: Order1.java    License: Apache License 2.0 5 votes vote down vote up
public int getSegment(double coords[]) {
    if (direction == Curve.INCREASING) {
        coords[0] = x1;
        coords[1] = y1;
    } else {
        coords[0] = x0;
        coords[1] = y0;
    }
    return PathIterator.SEG_LINETO;
}
 
Example 29
Source Project: openjdk-jdk9   Source File: Order1.java    License: GNU General Public License v2.0 5 votes vote down vote up
public int getSegment(double coords[]) {
    if (direction == INCREASING) {
        coords[0] = x1;
        coords[1] = y1;
    } else {
        coords[0] = x0;
        coords[1] = y0;
    }
    return PathIterator.SEG_LINETO;
}
 
Example 30
Source Project: jdk8u_jdk   Source File: RenderingEngine.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility method to feed a {@link PathConsumer2D} object from a
 * given {@link PathIterator}.
 * This method deals with the details of running the iterator and
 * feeding the consumer a segment at a time.
 */
public static void feedConsumer(PathIterator pi, PathConsumer2D consumer) {
    float coords[] = new float[6];
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            consumer.moveTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_LINETO:
            consumer.lineTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_QUADTO:
            consumer.quadTo(coords[0], coords[1],
                            coords[2], coords[3]);
            break;
        case PathIterator.SEG_CUBICTO:
            consumer.curveTo(coords[0], coords[1],
                             coords[2], coords[3],
                             coords[4], coords[5]);
            break;
        case PathIterator.SEG_CLOSE:
            consumer.closePath();
            break;
        }
        pi.next();
    }
}