diff options
author | Paul Gardiner <paul.gardiner@artifex.com> | 2014-01-02 14:29:39 +0000 |
---|---|---|
committer | Paul Gardiner <paul.gardiner@artifex.com> | 2014-01-02 14:29:39 +0000 |
commit | be7bfed74b44def0c37d5a94d52d2c30ccf69b52 (patch) | |
tree | d1f2fc769e6de49decec6b5eae98e416cf15a7be /platform/android/src/com/artifex/mupdfdemo | |
parent | 43ee6cf36aa1e68e816c9e9e57dab1df96b6fd23 (diff) | |
download | mupdf-be7bfed74b44def0c37d5a94d52d2c30ccf69b52.tar.xz |
Bug 694732: Android: draw single point strokes when inking
Make single-point strokes display by special casing them as
circles. Thanks for Michael Cadilhac for the suggestion.
Diffstat (limited to 'platform/android/src/com/artifex/mupdfdemo')
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/PageView.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/platform/android/src/com/artifex/mupdfdemo/PageView.java b/platform/android/src/com/artifex/mupdfdemo/PageView.java index d835016f..b7ef580d 100644 --- a/platform/android/src/com/artifex/mupdfdemo/PageView.java +++ b/platform/android/src/com/artifex/mupdfdemo/PageView.java @@ -366,6 +366,16 @@ public abstract class PageView extends ViewGroup { if (mDrawing != null) { Path path = new Path(); PointF p; + + paint.setAntiAlias(true); + paint.setDither(true); + paint.setStrokeJoin(Paint.Join.ROUND); + paint.setStrokeCap(Paint.Cap.ROUND); + + paint.setStyle(Paint.Style.FILL); + paint.setStrokeWidth(INK_THICKNESS * scale); + paint.setColor(INK_COLOR); + Iterator<ArrayList<PointF>> it = mDrawing.iterator(); while (it.hasNext()) { ArrayList<PointF> arc = it.next(); @@ -384,18 +394,13 @@ public abstract class PageView extends ViewGroup { mY = y; } path.lineTo(mX, mY); + } else { + p = arc.get(0); + canvas.drawCircle(p.x * scale, p.y * scale, INK_THICKNESS * scale / 2, paint); } } - 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.setColor(INK_COLOR); - canvas.drawPath(path, paint); } } @@ -464,6 +469,7 @@ public abstract class PageView extends ViewGroup { ArrayList<PointF> arc = new ArrayList<PointF>(); arc.add(new PointF(docRelX, docRelY)); mDrawing.add(arc); + mSearchView.invalidate(); } public void continueDraw(float x, float y) { |