Java examples for 2D Graphics:Path
returns a path equal to "path" but with an extra initial section
//package com.java2s; import java.awt.geom.PathIterator; import java.awt.geom.GeneralPath; public class Main { /** /*from w ww . j a v a 2 s. c om*/ * returns a path equal to "path" but with an extra initial section */ public static GeneralPath appendToStart(int startX, int startY, GeneralPath path) { GeneralPath newPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD); newPath.moveTo(startX, startY); double coOrds[] = new double[6]; for (PathIterator i = path.getPathIterator(null); !i.isDone(); i .next()) { int segType = i.currentSegment(coOrds); newPath.lineTo((int) coOrds[0], (int) coOrds[1]); } return newPath; } }