alters GeneralPath p1 to add p2 onto it - Java 2D Graphics

Java examples for 2D Graphics:Path

Description

alters GeneralPath p1 to add p2 onto it

Demo Code


//package com.java2s;
import java.awt.geom.PathIterator;
import java.awt.geom.GeneralPath;

public class Main {
    /** alters p1 to add p2 onto it */
    public static GeneralPath joinPaths(GeneralPath p1, GeneralPath p2) {
        double seg[] = new double[6];

        for (PathIterator i = p2.getPathIterator(null); !i.isDone(); i
                .next()) {/*from  w  ww.  j  a va  2 s  .com*/
            int segType = i.currentSegment(seg);
            p1.lineTo((int) seg[0], (int) seg[1]);
        }
        return p1;
    }
}

Related Tutorials