summaryrefslogtreecommitdiff
path: root/android/src/com/artifex
diff options
context:
space:
mode:
Diffstat (limited to 'android/src/com/artifex')
-rw-r--r--android/src/com/artifex/mupdfdemo/MuPDFCore.java6
-rw-r--r--android/src/com/artifex/mupdfdemo/MuPDFPageView.java25
-rw-r--r--android/src/com/artifex/mupdfdemo/PageView.java2
3 files changed, 15 insertions, 18 deletions
diff --git a/android/src/com/artifex/mupdfdemo/MuPDFCore.java b/android/src/com/artifex/mupdfdemo/MuPDFCore.java
index f9b5f779..bfcb3582 100644
--- a/android/src/com/artifex/mupdfdemo/MuPDFCore.java
+++ b/android/src/com/artifex/mupdfdemo/MuPDFCore.java
@@ -39,7 +39,7 @@ public class MuPDFCore
private native RectF[] searchPage(String text);
private native TextChar[][][][] text();
private native byte[] textAsHtml();
- private native void addStrikeOutAnnotationInternal(RectF[] lines);
+ private native void addStrikeOutAnnotationInternal(PointF[] quadPoints);
private native void deleteAnnotationInternal(int annot_index);
private native int passClickEventInternal(int page, float x, float y);
private native void setFocusedWidgetChoiceSelectedInternal(String [] selected);
@@ -248,9 +248,9 @@ public class MuPDFCore
return lns.toArray(new TextWord[lns.size()][]);
}
- public synchronized void addStrikeOutAnnotation(int page, RectF[] lines) {
+ public synchronized void addStrikeOutAnnotation(int page, PointF[] quadPoints) {
gotoPage(page);
- addStrikeOutAnnotationInternal(lines);
+ addStrikeOutAnnotationInternal(quadPoints);
}
public synchronized void deleteAnnotation(int page, int annot_index) {
diff --git a/android/src/com/artifex/mupdfdemo/MuPDFPageView.java b/android/src/com/artifex/mupdfdemo/MuPDFPageView.java
index 63531ec8..d82b2d0a 100644
--- a/android/src/com/artifex/mupdfdemo/MuPDFPageView.java
+++ b/android/src/com/artifex/mupdfdemo/MuPDFPageView.java
@@ -74,7 +74,7 @@ public class MuPDFPageView extends PageView implements MuPDFView {
private EditText mEditText;
private AsyncTask<String,Void,Boolean> mSetWidgetText;
private AsyncTask<String,Void,Void> mSetWidgetChoice;
- private AsyncTask<RectF[],Void,Void> mAddStrikeOut;
+ private AsyncTask<PointF[],Void,Void> mAddStrikeOut;
private AsyncTask<Integer,Void,Void> mDeleteAnnotation;
private Runnable changeReporter;
@@ -280,7 +280,7 @@ public class MuPDFPageView extends PageView implements MuPDFView {
}
public void strikeOutSelection() {
- final ArrayList<RectF> lines = new ArrayList<RectF>();
+ final ArrayList<PointF> quadPoints = new ArrayList<PointF>();
processSelectedText(new TextProcessor() {
RectF rect;
@@ -294,20 +294,17 @@ public class MuPDFPageView extends PageView implements MuPDFView {
public void onEndLine() {
if (!rect.isEmpty()) {
- // These are vertical lines so we can specify
- // both position and thickness with a RectF
- float vcenter = rect.bottom - (rect.bottom - rect.top)*STRIKE_HEIGHT;
- float thickness = (rect.bottom - rect.top)*LINE_THICKNESS;
- rect.top = vcenter - thickness/2;
- rect.bottom = vcenter + thickness/2;
- lines.add(rect);
+ quadPoints.add(new PointF(rect.left, rect.bottom));
+ quadPoints.add(new PointF(rect.right, rect.bottom));
+ quadPoints.add(new PointF(rect.right, rect.top));
+ quadPoints.add(new PointF(rect.left, rect.top));
}
}
});
- mAddStrikeOut = new AsyncTask<RectF[],Void,Void>() {
+ mAddStrikeOut = new AsyncTask<PointF[],Void,Void>() {
@Override
- protected Void doInBackground(RectF[]... params) {
+ protected Void doInBackground(PointF[]... params) {
addStrikeOut(params[0]);
return null;
}
@@ -319,7 +316,7 @@ public class MuPDFPageView extends PageView implements MuPDFView {
}
};
- mAddStrikeOut.execute(lines.toArray(new RectF[lines.size()]));
+ mAddStrikeOut.execute(quadPoints.toArray(new PointF[quadPoints.size()]));
deselectText();
}
@@ -378,8 +375,8 @@ public class MuPDFPageView extends PageView implements MuPDFView {
}
@Override
- protected void addStrikeOut(RectF[] lines) {
- mCore.addStrikeOutAnnotation(mPageNumber, lines);
+ protected void addStrikeOut(PointF[] quadPoints) {
+ mCore.addStrikeOutAnnotation(mPageNumber, quadPoints);
}
private void loadAnnotations() {
diff --git a/android/src/com/artifex/mupdfdemo/PageView.java b/android/src/com/artifex/mupdfdemo/PageView.java
index 849dbc1f..2412253f 100644
--- a/android/src/com/artifex/mupdfdemo/PageView.java
+++ b/android/src/com/artifex/mupdfdemo/PageView.java
@@ -146,7 +146,7 @@ public abstract class PageView extends ViewGroup {
protected abstract Bitmap updatePage(BitmapHolder h, int sizeX, int sizeY, int patchX, int patchY, int patchWidth, int patchHeight);
protected abstract LinkInfo[] getLinkInfo();
protected abstract TextWord[][] getText();
- protected abstract void addStrikeOut(RectF[] lines);
+ protected abstract void addStrikeOut(PointF[] quadPoints);
private void reinit() {
// Cancel pending render task