summaryrefslogtreecommitdiff
path: root/android/src/com/artifex/mupdfdemo/PageView.java
diff options
context:
space:
mode:
authorPaul Gardiner <paulg.artifex@glidos.net>2013-06-14 11:08:39 +0100
committerRobin Watts <robin.watts@artifex.com>2013-06-17 15:07:08 +0100
commitb695c87abcdbe0ddc35c5e3a7ee8f5f58ee577f1 (patch)
tree31a470c889c88540235d4f70b6e1334249b92fbe /android/src/com/artifex/mupdfdemo/PageView.java
parente860f7240878c22d90b086827e58e1e8e055bbf8 (diff)
downloadmupdf-b695c87abcdbe0ddc35c5e3a7ee8f5f58ee577f1.tar.xz
Tweaks to ink annotation for smoothness.
Patch from "andyhan2000" to make the ink annotations smoother.
Diffstat (limited to 'android/src/com/artifex/mupdfdemo/PageView.java')
-rw-r--r--android/src/com/artifex/mupdfdemo/PageView.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/android/src/com/artifex/mupdfdemo/PageView.java b/android/src/com/artifex/mupdfdemo/PageView.java
index 14d6b729..200821dd 100644
--- a/android/src/com/artifex/mupdfdemo/PageView.java
+++ b/android/src/com/artifex/mupdfdemo/PageView.java
@@ -364,16 +364,30 @@ public abstract class PageView extends ViewGroup {
if (arc.size() >= 2) {
Iterator<PointF> iit = arc.iterator();
p = iit.next();
- path.moveTo(p.x*scale, p.y*scale);
+ float mX = p.x * scale;
+ float mY = p.y * scale;
+ path.moveTo(mX, mY);
while (iit.hasNext()) {
p = iit.next();
- path.lineTo(p.x*scale, p.y*scale);
+ float x = p.x * scale;
+ float y = p.y * scale;
+ path.quadTo(mX, mY, (x + mX) / 2, (y + mY) / 2);
+ mX = x;
+ mY = y;
}
+ path.lineTo(mX, mY);
}
}
+
+ paint.setAntiAlias(true);
+ paint.setDither(true);
+ paint.setStrokeJoin(Paint.Join.ROUND);
+ paint.setStrokeCap(Paint.Cap.ROUND);
+
paint.setStyle(Paint.Style.STROKE);
- paint.setStrokeWidth(INK_THICKNESS*scale);
+ paint.setStrokeWidth(INK_THICKNESS * scale);
paint.setColor(INK_COLOR);
+
canvas.drawPath(path, paint);
}
}