List of usage examples for java.awt.geom Path2D.Float curveTo
public abstract void curveTo(double x1, double y1, double x2, double y2, double x3, double y3);
From source file:org.apache.pdfbox.pdfviewer.font.CFFGlyph2D.java
private GeneralPath transformGlyph(GeneralPath glyph) { // we have to invert all y-coordinates due to the moved 0,0-reference PathIterator iter = glyph.getPathIterator(null); float[] currentSegment = new float[6]; Path2D.Float path = new Path2D.Float(iter.getWindingRule()); boolean glyphTransformed = false; while (!iter.isDone()) { glyphTransformed = true;/*from w ww.ja v a2 s . c o m*/ int type = iter.currentSegment(currentSegment); switch (type) { case PathIterator.SEG_MOVETO: path.moveTo(currentSegment[0], -currentSegment[1]); break; case PathIterator.SEG_LINETO: path.lineTo(currentSegment[0], -currentSegment[1]); break; case PathIterator.SEG_QUADTO: path.quadTo(currentSegment[0], -currentSegment[1], currentSegment[2], -currentSegment[3]); break; case PathIterator.SEG_CUBICTO: path.curveTo(currentSegment[0], -currentSegment[1], currentSegment[2], -currentSegment[3], currentSegment[4], -currentSegment[5]); break; case PathIterator.SEG_CLOSE: path.closePath(); break; } iter.next(); } if (glyphTransformed) { return new GeneralPath(path); } else { return glyph; } }