diff options
author | Robert Meyer <rmeyer@apache.org> | 2013-08-20 15:00:13 +0000 |
---|---|---|
committer | Robert Meyer <rmeyer@apache.org> | 2013-08-20 15:00:13 +0000 |
commit | 119c49e73ecda40e92303c03231086eae61295df (patch) | |
tree | c49dd1488f4cdf041160e6d87a31b421a76b93a1 /src/java/org/apache | |
parent | 6cb8fea5ba1fde83493138f4d502cc788f0b7c2d (diff) | |
download | xmlgraphics-fop-119c49e73ecda40e92303c03231086eae61295df.tar.gz xmlgraphics-fop-119c49e73ecda40e92303c03231086eae61295df.zip |
FOP-2275: Quadratic Bezier curves not properly rendered
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1515840 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r-- | src/java/org/apache/fop/svg/PDFGraphics2D.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index 526420d9c..efa71a225 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -1691,11 +1691,15 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand * @param iter PathIterator to process */ public void processPathIterator(PathIterator iter) { + double lastX = 0.0; + double lastY = 0.0; while (!iter.isDone()) { double[] vals = new double[6]; int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: + lastX = vals[4]; + lastY = vals[5]; currentStream.write(PDFNumber.doubleOut(vals[0], DEC) + " " + PDFNumber.doubleOut(vals[1], DEC) + " " + PDFNumber.doubleOut(vals[2], DEC) + " " @@ -1704,18 +1708,30 @@ public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHand + PDFNumber.doubleOut(vals[5], DEC) + " c\n"); break; case PathIterator.SEG_LINETO: + lastX = vals[0]; + lastY = vals[1]; currentStream.write(PDFNumber.doubleOut(vals[0], DEC) + " " + PDFNumber.doubleOut(vals[1], DEC) + " l\n"); break; case PathIterator.SEG_MOVETO: + lastX = vals[0]; + lastY = vals[1]; currentStream.write(PDFNumber.doubleOut(vals[0], DEC) + " " + PDFNumber.doubleOut(vals[1], DEC) + " m\n"); break; case PathIterator.SEG_QUADTO: - currentStream.write(PDFNumber.doubleOut(vals[0], DEC) + " " - + PDFNumber.doubleOut(vals[1], DEC) + " " - + PDFNumber.doubleOut(vals[2], DEC) + " " - + PDFNumber.doubleOut(vals[3], DEC) + " y\n"); + double controlPointAX = lastX + ((2.0 / 3.0) * (vals[0] - lastX)); + double controlPointAY = lastY + ((2.0 / 3.0) * (vals[1] - lastY)); + double controlPointBX = vals[2] + ((2.0 / 3.0) * (vals[0] - vals[2])); + double controlPointBY = vals[3] + ((2.0 / 3.0) * (vals[1] - vals[3])); + currentStream.write(PDFNumber.doubleOut(controlPointAX, DEC) + " " + + PDFNumber.doubleOut(controlPointAY, DEC) + " " + + PDFNumber.doubleOut(controlPointBX, DEC) + " " + + PDFNumber.doubleOut(controlPointBY, DEC) + " " + + PDFNumber.doubleOut(vals[2], DEC) + " " + + PDFNumber.doubleOut(vals[3], DEC) + " c\n"); + lastX = vals[2]; + lastY = vals[3]; break; case PathIterator.SEG_CLOSE: currentStream.write("h\n"); |