Package java.awt.geom

Examples of java.awt.geom.PathIterator.currentSegment()


    pi.next();
    assertEquals(PathIterator.SEG_LINETO, pi.currentSegment(coords));
    xs.add(coords[0]);
    ys.add(coords[1]);
    pi.next();
    assertEquals(PathIterator.SEG_LINETO, pi.currentSegment(coords));
    xs.add(coords[0]);
    ys.add(coords[1]);
    pi.next();
    assertEquals(PathIterator.SEG_LINETO, pi.currentSegment(coords));
    xs.add(coords[0]);
View Full Code Here


    pi.next();
    assertEquals(PathIterator.SEG_LINETO, pi.currentSegment(coords));
    xs.add(coords[0]);
    ys.add(coords[1]);
    pi.next();
    assertEquals(PathIterator.SEG_LINETO, pi.currentSegment(coords));
    xs.add(coords[0]);
    ys.add(coords[1]);
    pi.next();
    assertEquals(PathIterator.SEG_CLOSE, pi.currentSegment(coords));
View Full Code Here

    model.setHasDbleBord(true);
    view.update();
    path = view.getPath();

    pi = path.getPathIterator(null);
    assertEquals(PathIterator.SEG_MOVETO, pi.currentSegment(coords));
    xs.add(coords[0]);
    ys.add(coords[1]);
    pi.next();
    assertEquals(PathIterator.SEG_LINETO, pi.currentSegment(coords));
    xs.add(coords[0]);
View Full Code Here

    final double[] coords       = new double[6];
    final SVGPathSegList list   = new SVGPathSegList();
    element           = new SVGPathElement(document);

    while(!pi.isDone()) {
      switch(pi.currentSegment(coords)) {
        case PathIterator.SEG_CLOSE  : list.add(new SVGPathSegClosePath()); break;
        case PathIterator.SEG_LINETO: list.add(new SVGPathSegLineto(coords[0], coords[1], false)); break;
        case PathIterator.SEG_MOVETO: list.add(new SVGPathSegMoveto(coords[0], coords[1], false)); break;
        case PathIterator.SEG_CUBICTO: list.add(new SVGPathSegCurvetoCubic(coords[4], coords[5], coords[0], coords[1], coords[2], coords[3], false)); break;
        case PathIterator.SEG_QUADTO: list.add(new SVGPathSegCurvetoQuadratic(coords[2], coords[3], coords[0], coords[1], false)); break;
View Full Code Here

        case PathIterator.SEG_CLOSE  : list.add(new SVGPathSegClosePath()); break;
        case PathIterator.SEG_LINETO: list.add(new SVGPathSegLineto(coords[0], coords[1], false)); break;
        case PathIterator.SEG_MOVETO: list.add(new SVGPathSegMoveto(coords[0], coords[1], false)); break;
        case PathIterator.SEG_CUBICTO: list.add(new SVGPathSegCurvetoCubic(coords[4], coords[5], coords[0], coords[1], coords[2], coords[3], false)); break;
        case PathIterator.SEG_QUADTO: list.add(new SVGPathSegCurvetoQuadratic(coords[2], coords[3], coords[0], coords[1], false)); break;
        default: throw new ParseException("Invalid Path2D element:" + pi.currentSegment(coords), -1);
      }
      pi.next();
    }

    element.setAttribute(SVGAttributes.SVG_D, list.toString());
View Full Code Here

                stream.writeObject(GeneralPath.class);
                final PathIterator pi = shape.getPathIterator(null);
                final float[] args = new float[6];
                stream.writeBoolean(pi.isDone());
                while (!pi.isDone()) {
                    final int type = pi.currentSegment(args);
                    stream.writeInt(type);
                    // TODO: could write this to only stream the values
                    // required for the segment type
                    for (int i = 0; i < 6; i++) {
                        stream.writeFloat(args[i]);
View Full Code Here

        PathIterator it = shape.getPathIterator(transform);
        double[] prev = null;
        double[] coords = new double[6];
        double[] first = new double[6];
        if(!it.isDone()) it.currentSegment(first); //first point
        while(!it.isDone()){
            int type = it.currentSegment(coords);
            if (prev != null ){
                Line line = new Line(group);
                if (stroke instanceof BasicStroke){
View Full Code Here

        double[] prev = null;
        double[] coords = new double[6];
        double[] first = new double[6];
        if(!it.isDone()) it.currentSegment(first); //first point
        while(!it.isDone()){
            int type = it.currentSegment(coords);
            if (prev != null ){
                Line line = new Line(group);
                if (stroke instanceof BasicStroke){
                    BasicStroke bs = (BasicStroke)stroke;
                    line.setLineWidth(bs.getLineWidth());
View Full Code Here

        }
        PathIterator it = shape.getPathIterator(transform);
        ArrayList pnt = new ArrayList();
        double[] coords = new double[6];
        while(!it.isDone()){
            int type = it.currentSegment(coords);
            if (type != PathIterator.SEG_CLOSE) {
                pnt.add(new Point((int)coords[0], (int)coords[1]));
            }
            it.next();
        }
View Full Code Here

            PathIterator it = j2dpath.getPathIterator(null);
            double dx = 0;
            double dy = 0;
            while(!it.isDone()) {
                double[] coords = new double[6];
                int n = it.currentSegment(coords);
                if(n == PathIterator.SEG_MOVETO) {
                    out.println(".moveTo("+(coords[0]-dx)+","+(coords[1]-dy)+")");
                }
                if(n == PathIterator.SEG_LINETO) {
                    out.println(".lineTo("+(coords[0]-dx)+","+(coords[1]-dy)+")");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.