summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/kitfox/svg/pathcmd/QuadraticSmooth.java
diff options
context:
space:
mode:
authorkitfox2012-10-17 00:47:09 +0200
committerkitfox2012-10-17 00:47:09 +0200
commit963566c2c1c45e7e30316dd37d851718f4f1aa9a (patch)
treedb5cf6c494be698a6edc9e29d8bb5090a0b235fc /src/main/java/com/kitfox/svg/pathcmd/QuadraticSmooth.java
parentFixing null transform with linear gradients. (diff)
downloadsvg-salamander-core-963566c2c1c45e7e30316dd37d851718f4f1aa9a.tar.gz
svg-salamander-core-963566c2c1c45e7e30316dd37d851718f4f1aa9a.tar.xz
svg-salamander-core-963566c2c1c45e7e30316dd37d851718f4f1aa9a.zip
Fixing path calculation error for continuous joins.
git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@137 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b
Diffstat (limited to 'src/main/java/com/kitfox/svg/pathcmd/QuadraticSmooth.java')
-rw-r--r--src/main/java/com/kitfox/svg/pathcmd/QuadraticSmooth.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/main/java/com/kitfox/svg/pathcmd/QuadraticSmooth.java b/src/main/java/com/kitfox/svg/pathcmd/QuadraticSmooth.java
index 2bbc6bf..18e8ddd 100644
--- a/src/main/java/com/kitfox/svg/pathcmd/QuadraticSmooth.java
+++ b/src/main/java/com/kitfox/svg/pathcmd/QuadraticSmooth.java
@@ -43,6 +43,11 @@ public class QuadraticSmooth extends PathCommand {
public QuadraticSmooth() {
}
+ public String toString()
+ {
+ return "T " + x + " " + y;
+ }
+
public QuadraticSmooth(boolean isRelative, float x, float y) {
super(isRelative);
this.x = x;
@@ -52,19 +57,20 @@ public class QuadraticSmooth extends PathCommand {
// public void appendPath(ExtendedGeneralPath path, BuildHistory hist)
public void appendPath(GeneralPath path, BuildHistory hist)
{
- float offx = isRelative ? hist.history[0].x : 0f;
- float offy = isRelative ? hist.history[0].y : 0f;
+ float offx = isRelative ? hist.lastPoint.x : 0f;
+ float offy = isRelative ? hist.lastPoint.y : 0f;
- float oldKx = hist.history.length >= 2 ? hist.history[1].x : hist.history[0].x;
- float oldKy = hist.history.length >= 2 ? hist.history[1].y : hist.history[0].y;
- float oldX = hist.history[0].x;
- float oldY = hist.history[0].y;
+ float oldKx = hist.lastKnot.x;
+ float oldKy = hist.lastKnot.y;
+ float oldX = hist.lastPoint.x;
+ float oldY = hist.lastPoint.y;
//Calc knot as reflection of old knot
float kx = oldX * 2f - oldKx;
float ky = oldY * 2f - oldKy;
path.quadTo(kx, ky, x + offx, y + offy);
- hist.setPointAndKnot(x + offx, y + offy, kx, ky);
+ hist.setLastPoint(x + offx, y + offy);
+ hist.setLastKnot(kx, ky);
}
public int getNumKnotsAdded()