alters GeneralPath p1 to add p2 onto it, without p2 1st point - Java 2D Graphics

Java examples for 2D Graphics:Path

Description

alters GeneralPath p1 to add p2 onto it, without p2 1st point

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, without p2 1st point */
    public static GeneralPath mergePaths(GeneralPath p1, GeneralPath p2) {
        double seg[] = new double[6];
        PathIterator i = p2.getPathIterator(null);
        i.next();/*from   w  w w .ja  v  a 2  s .  c om*/
        while (!i.isDone()) {
            int segType = i.currentSegment(seg);
            p1.lineTo((int) seg[0], (int) seg[1]);
            i.next();
        }
        return p1;
    }
}

Related Tutorials