summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-02-23 15:11:43 +0100
committerTor Andersson <tor.andersson@artifex.com>2017-03-01 15:22:46 +0100
commit8c547d302fb23950bc3f928a37d4c8baf93838cc (patch)
tree46d46b294b1237e415fc90b02fee955629a7eec8 /platform
parent9abe78b7a1505740a59fd2dbf217d50241b55b67 (diff)
downloadmupdf-8c547d302fb23950bc3f928a37d4c8baf93838cc.tar.xz
Add PDFPage and PDFAnnotation subclasses.
Diffstat (limited to 'platform')
-rw-r--r--platform/java/mupdf_native.c79
-rw-r--r--platform/java/mupdf_native.h296
-rw-r--r--platform/java/src/com/artifex/mupdf/fitz/Annotation.java2
-rw-r--r--platform/java/src/com/artifex/mupdf/fitz/PDFAnnotation.java64
-rw-r--r--platform/java/src/com/artifex/mupdf/fitz/PDFPage.java9
-rw-r--r--platform/java/src/com/artifex/mupdf/fitz/Page.java2
-rw-r--r--platform/java/src/com/artifex/mupdf/fitz/android/AndroidDrawDevice.java2
7 files changed, 417 insertions, 37 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c
index 2293791f..4b6ca33a 100644
--- a/platform/java/mupdf_native.c
+++ b/platform/java/mupdf_native.c
@@ -49,7 +49,7 @@ static inline jlong jlong_cast(const void *p)
/* All the cached classes/mids/fids we need. */
-static jclass cls_Annot;
+static jclass cls_Annotation;
static jclass cls_Buffer;
static jclass cls_ColorSpace;
static jclass cls_Cookie;
@@ -72,7 +72,9 @@ static jclass cls_OutOfMemoryError;
static jclass cls_Page;
static jclass cls_Path;
static jclass cls_PathWalker;
+static jclass cls_PDFAnnotation;
static jclass cls_PDFDocument;
+static jclass cls_PDFPage;
static jclass cls_PDFGraftMap;
static jclass cls_PDFObject;
static jclass cls_Pixmap;
@@ -91,7 +93,7 @@ static jclass cls_TextSpan;
static jclass cls_TextWalker;
static jclass cls_TryLaterException;
-static jfieldID fid_Annot_pointer;
+static jfieldID fid_Annotation_pointer;
static jfieldID fid_Buffer_pointer;
static jfieldID fid_ColorSpace_pointer;
static jfieldID fid_Cookie_pointer;
@@ -114,7 +116,9 @@ static jfieldID fid_NativeDevice_nativeInfo;
static jfieldID fid_NativeDevice_nativeResource;
static jfieldID fid_Page_pointer;
static jfieldID fid_Path_pointer;
+static jfieldID fid_PDFAnnotation_pointer;
static jfieldID fid_PDFDocument_pointer;
+static jfieldID fid_PDFPage_pointer;
static jfieldID fid_PDFGraftMap_pointer;
static jfieldID fid_PDFObject_pointer;
static jfieldID fid_PDFObject_Null;
@@ -136,7 +140,7 @@ static jfieldID fid_Text_pointer;
static jfieldID fid_TextSpan_bbox;
static jfieldID fid_TextSpan_chars;
-static jmethodID mid_Annot_init;
+static jmethodID mid_Annotation_init;
static jmethodID mid_ColorSpace_fromPointer;
static jmethodID mid_ColorSpace_init;
static jmethodID mid_Device_beginGroup;
@@ -174,7 +178,9 @@ static jmethodID mid_PathWalker_closePath;
static jmethodID mid_PathWalker_curveTo;
static jmethodID mid_PathWalker_lineTo;
static jmethodID mid_PathWalker_moveTo;
+static jmethodID mid_PDFAnnotation_init;
static jmethodID mid_PDFDocument_init;
+static jmethodID mid_PDFPage_init;
static jmethodID mid_PDFGraftMap_init;
static jmethodID mid_PDFObject_init;
static jmethodID mid_Pixmap_init;
@@ -362,9 +368,9 @@ static int find_fids(JNIEnv *env)
{
int err = 0;
- cls_Annot = get_class(&err, env, PKG"Annotation");
- fid_Annot_pointer = get_field(&err, env, "pointer", "J");
- mid_Annot_init = get_method(&err, env, "<init>", "(J)V");
+ cls_Annotation = get_class(&err, env, PKG"Annotation");
+ fid_Annotation_pointer = get_field(&err, env, "pointer", "J");
+ mid_Annotation_init = get_method(&err, env, "<init>", "(J)V");
cls_Buffer = get_class(&err, env, PKG"Buffer");
fid_Buffer_pointer = get_field(&err, env, "pointer", "J");
@@ -456,6 +462,10 @@ static int find_fids(JNIEnv *env)
mid_PathWalker_curveTo = get_method(&err, env, "curveTo", "(FFFFFF)V");
mid_PathWalker_closePath = get_method(&err, env, "closePath", "()V");
+ cls_PDFAnnotation = get_class(&err, env, PKG"PDFAnnotation");
+ fid_PDFAnnotation_pointer = get_field(&err, env, "pointer", "J");
+ mid_PDFAnnotation_init = get_method(&err, env, "<init>", "(J)V");
+
cls_PDFDocument = get_class(&err, env, PKG"PDFDocument");
fid_PDFDocument_pointer = get_field(&err, env, "pointer", "J");
mid_PDFDocument_init = get_method(&err, env, "<init>", "(J)V");
@@ -469,6 +479,10 @@ static int find_fids(JNIEnv *env)
fid_PDFObject_Null = get_static_field(&err, env, "Null", "L"PKG"PDFObject;");
mid_PDFObject_init = get_method(&err, env, "<init>", "(J)V");
+ cls_PDFPage = get_class(&err, env, PKG"PDFPage");
+ fid_PDFPage_pointer = get_field(&err, env, "pointer", "J");
+ mid_PDFPage_init = get_method(&err, env, "<init>", "(J)V");
+
cls_Pixmap = get_class(&err, env, PKG"Pixmap");
fid_Pixmap_pointer = get_field(&err, env, "pointer", "J");
mid_Pixmap_init = get_method(&err, env, "<init>", "(J)V");
@@ -545,7 +559,7 @@ static int find_fids(JNIEnv *env)
static void lose_fids(JNIEnv *env)
{
- (*env)->DeleteGlobalRef(env, cls_Annot);
+ (*env)->DeleteGlobalRef(env, cls_Annotation);
(*env)->DeleteGlobalRef(env, cls_Buffer);
(*env)->DeleteGlobalRef(env, cls_ColorSpace);
(*env)->DeleteGlobalRef(env, cls_Cookie);
@@ -568,7 +582,9 @@ static void lose_fids(JNIEnv *env)
(*env)->DeleteGlobalRef(env, cls_Page);
(*env)->DeleteGlobalRef(env, cls_Path);
(*env)->DeleteGlobalRef(env, cls_PathWalker);
+ (*env)->DeleteGlobalRef(env, cls_PDFAnnotation);
(*env)->DeleteGlobalRef(env, cls_PDFDocument);
+ (*env)->DeleteGlobalRef(env, cls_PDFPage);
(*env)->DeleteGlobalRef(env, cls_PDFGraftMap);
(*env)->DeleteGlobalRef(env, cls_PDFObject);
(*env)->DeleteGlobalRef(env, cls_Pixmap);
@@ -934,11 +950,17 @@ FUN(Context_gprfSupportedNative)(JNIEnv * env, jclass class)
static inline jobject to_Annotation(fz_context *ctx, JNIEnv *env, fz_annot *annot)
{
jobject jannot;
+ pdf_annot *pannot;
if (!ctx || !annot) return NULL;
fz_keep_annot(ctx, annot);
- jannot = (*env)->NewObject(env, cls_Annot, mid_Annot_init, jlong_cast(annot));
+
+ pannot = pdf_annot_from_fz_annot(ctx, annot);
+ if (pannot)
+ jannot = (*env)->NewObject(env, cls_PDFAnnotation, mid_PDFAnnotation_init, jlong_cast(annot));
+ else
+ jannot = (*env)->NewObject(env, cls_Annotation, mid_Annotation_init, jlong_cast(annot));
if (!jannot)
fz_throw_java(ctx, env);
@@ -1229,29 +1251,21 @@ static inline jobjectArray to_jRectArray_safe(fz_context *ctx, JNIEnv *env, cons
static inline jobject to_Document_safe_own(fz_context *ctx, JNIEnv *env, fz_document *doc)
{
jobject obj;
+ pdf_document *pdf;
if (!ctx || !doc) return NULL;
- obj = (*env)->NewObject(env, cls_Document, mid_Document_init, jlong_cast(doc));
+ pdf = pdf_document_from_fz_document(ctx, doc);
+ if (pdf)
+ obj = (*env)->NewObject(env, cls_PDFDocument, mid_PDFDocument_init, jlong_cast(pdf));
+ else
+ obj = (*env)->NewObject(env, cls_Document, mid_Document_init, jlong_cast(doc));
if (!obj)
fz_drop_document(ctx, doc);
return obj;
}
-static inline jobject to_PDFDocument_safe_own(fz_context *ctx, JNIEnv *env, pdf_document *pdf)
-{
- jobject obj;
-
- if (!ctx || !pdf) return NULL;
-
- obj = (*env)->NewObject(env, cls_PDFDocument, mid_PDFDocument_init, jlong_cast(pdf));
- if (!obj)
- fz_drop_document(ctx, (fz_document*)pdf);
-
- return obj;
-}
-
static inline jobject to_Device_safe_own(fz_context *ctx, JNIEnv *env, fz_device *device)
{
jobject jdev;
@@ -1281,10 +1295,15 @@ static inline jobject to_DisplayList_safe_own(fz_context *ctx, JNIEnv *env, fz_d
static inline jobject to_Page_safe_own(fz_context *ctx, JNIEnv *env, fz_page *page)
{
jobject jobj;
+ pdf_page *ppage;
if (!ctx || !page) return NULL;
- jobj = (*env)->NewObject(env, cls_Page, mid_Page_init, jlong_cast(page));
+ ppage = pdf_page_from_fz_page(ctx, page);
+ if (ppage)
+ jobj = (*env)->NewObject(env, cls_PDFPage, mid_PDFPage_init, jlong_cast(page));
+ else
+ jobj = (*env)->NewObject(env, cls_Page, mid_Page_init, jlong_cast(page));
if (!jobj)
fz_drop_page(ctx, page);
@@ -1349,7 +1368,7 @@ static inline fz_annot *from_Annotation(JNIEnv *env, jobject jobj)
{
fz_annot *annot;
if (!jobj) return NULL;
- annot = CAST(fz_annot *, (*env)->GetLongField(env, jobj, fid_Annot_pointer));
+ annot = CAST(fz_annot *, (*env)->GetLongField(env, jobj, fid_Annotation_pointer));
if (!annot) jni_throw_null(env, "cannot use already destroyed Annotation");
return annot;
}
@@ -1583,7 +1602,7 @@ static inline fz_rect from_Rect(JNIEnv *env, jobject jrect)
static inline fz_annot *from_Annotation_safe(JNIEnv *env, jobject jobj)
{
if (!jobj) return NULL;
- return CAST(fz_annot *, (*env)->GetLongField(env, jobj, fid_Annot_pointer));
+ return CAST(fz_annot *, (*env)->GetLongField(env, jobj, fid_Annotation_pointer));
}
static inline fz_buffer *from_Buffer_safe(JNIEnv *env, jobject jobj)
@@ -4167,7 +4186,6 @@ FUN(Document_openNativeWithPath)(JNIEnv *env, jclass cls, jstring jfilename)
{
fz_context *ctx = get_context(env);
fz_document *doc = NULL;
- pdf_document *pdf = NULL;
const char *filename = NULL;
if (!ctx) return 0;
@@ -4178,23 +4196,16 @@ FUN(Document_openNativeWithPath)(JNIEnv *env, jclass cls, jstring jfilename)
}
fz_try(ctx)
- {
doc = fz_open_document(ctx, filename);
- pdf = pdf_document_from_fz_document(ctx, doc);
- }
fz_always(ctx)
- {
if (filename)
(*env)->ReleaseStringUTFChars(env, jfilename, filename);
- }
fz_catch(ctx)
{
jni_rethrow(env, ctx);
return 0;
}
- if (pdf)
- return to_PDFDocument_safe_own(ctx, env, pdf);
return to_Document_safe_own(ctx, env, doc);
}
@@ -4620,7 +4631,7 @@ FUN(Page_getAnnotations)(JNIEnv *env, jobject self)
return NULL;
/* now run through actually creating the annotation objects */
- jannots = (*env)->NewObjectArray(env, annot_count, cls_Annot, NULL);
+ jannots = (*env)->NewObjectArray(env, annot_count, cls_Annotation, NULL);
if (!jannots) return NULL;
annot = annots;
diff --git a/platform/java/mupdf_native.h b/platform/java/mupdf_native.h
index 19fe1502..095b3d81 100644
--- a/platform/java/mupdf_native.h
+++ b/platform/java/mupdf_native.h
@@ -1309,6 +1309,275 @@ extern "C" {
}
#endif
#endif
+/* Header for class com_artifex_mupdf_fitz_PDFAnnotation */
+
+#ifndef _Included_com_artifex_mupdf_fitz_PDFAnnotation
+#define _Included_com_artifex_mupdf_fitz_PDFAnnotation
+#ifdef __cplusplus
+extern "C" {
+#endif
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_TEXT
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_TEXT 0L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_LINK
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_LINK 1L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_FREE_TEXT
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_FREE_TEXT 2L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_LINE
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_LINE 3L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_SQUARE
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_SQUARE 4L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_CIRCLE
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_CIRCLE 5L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_POLYGON
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_POLYGON 6L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_POLY_LINE
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_POLY_LINE 7L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_HIGHLIGHT
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_HIGHLIGHT 8L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_UNDERLINE
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_UNDERLINE 9L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_SQUIGGLY
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_SQUIGGLY 10L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_STRIKE_OUT
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_STRIKE_OUT 11L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_STAMP
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_STAMP 12L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_CARET
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_CARET 13L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_INK
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_INK 14L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_POPUP
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_POPUP 15L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_FILE_ATTACHMENT
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_FILE_ATTACHMENT 16L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_SOUND
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_SOUND 17L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_MOVIE
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_MOVIE 18L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_WIDGET
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_WIDGET 19L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_SCREEN
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_SCREEN 20L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_PRINTER_MARK
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_PRINTER_MARK 21L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_TRAP_NET
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_TRAP_NET 22L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_WATERMARK
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_WATERMARK 23L
+#undef com_artifex_mupdf_fitz_PDFAnnotation_TYPE_3D
+#define com_artifex_mupdf_fitz_PDFAnnotation_TYPE_3D 24L
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: getType
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_getType
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: getFlags
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_getFlags
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: setFlags
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_setFlags
+ (JNIEnv *, jobject, jint);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: getContents
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_getContents
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: setContents
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_setContents
+ (JNIEnv *, jobject, jstring);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: getRect
+ * Signature: ()Lcom/artifex/mupdf/fitz/Rect;
+ */
+JNIEXPORT jobject JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_getRect
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: setRect
+ * Signature: (Lcom/artifex/mupdf/fitz/Rect;)V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_setRect
+ (JNIEnv *, jobject, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: getBorder
+ * Signature: ()F
+ */
+JNIEXPORT jfloat JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_getBorder
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: setBorder
+ * Signature: (F)V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_setBorder
+ (JNIEnv *, jobject, jfloat);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: getColor
+ * Signature: ()[F
+ */
+JNIEXPORT jfloatArray JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_getColor
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: setColor
+ * Signature: ([F)V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_setColor
+ (JNIEnv *, jobject, jfloatArray);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: getInteriorColor
+ * Signature: ()[F
+ */
+JNIEXPORT jfloatArray JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_getInteriorColor
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: setInteriorColor
+ * Signature: ([F)V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_setInteriorColor
+ (JNIEnv *, jobject, jfloatArray);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: getLineEndingStyles
+ * Signature: ()[I
+ */
+JNIEXPORT jintArray JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_getLineEndingStyles
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: setLineEndingStyles
+ * Signature: (II)V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_setLineEndingStyles
+ (JNIEnv *, jobject, jint, jint);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: getVertices
+ * Signature: ()[F
+ */
+JNIEXPORT jfloatArray JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_getVertices
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: setVertices
+ * Signature: ([F)V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_setVertices
+ (JNIEnv *, jobject, jfloatArray);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: getQuadPoints
+ * Signature: ()[F
+ */
+JNIEXPORT jfloatArray JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_getQuadPoints
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: setQuadPoints
+ * Signature: ([F)V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_setQuadPoints
+ (JNIEnv *, jobject, jfloatArray);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: getInkList
+ * Signature: ()[[F
+ */
+JNIEXPORT jobjectArray JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_getInkList
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: setInkList
+ * Signature: ([[F)V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_setInkList
+ (JNIEnv *, jobject, jobjectArray);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: getIcon
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_getIcon
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: setIcon
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_setIcon
+ (JNIEnv *, jobject, jstring);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: isOpen
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_isOpen
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: setIsOpen
+ * Signature: (Z)V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_setIsOpen
+ (JNIEnv *, jobject, jboolean);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFAnnotation
+ * Method: updateAppearance
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFAnnotation_updateAppearance
+ (JNIEnv *, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
/* Header for class com_artifex_mupdf_fitz_PDFDocument */
#ifndef _Included_com_artifex_mupdf_fitz_PDFDocument
@@ -2038,6 +2307,33 @@ JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFObject_pushPDFObject
}
#endif
#endif
+/* Header for class com_artifex_mupdf_fitz_PDFPage */
+
+#ifndef _Included_com_artifex_mupdf_fitz_PDFPage
+#define _Included_com_artifex_mupdf_fitz_PDFPage
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: com_artifex_mupdf_fitz_PDFPage
+ * Method: createAnnotation
+ * Signature: (I)Lcom/artifex/mupdf/fitz/PDFAnnotation;
+ */
+JNIEXPORT jobject JNICALL Java_com_artifex_mupdf_fitz_PDFPage_createAnnotation
+ (JNIEnv *, jobject, jint);
+
+/*
+ * Class: com_artifex_mupdf_fitz_PDFPage
+ * Method: deleteAnnotation
+ * Signature: (Lcom/artifex/mupdf/fitz/Annotation;)V
+ */
+JNIEXPORT void JNICALL Java_com_artifex_mupdf_fitz_PDFPage_deleteAnnotation
+ (JNIEnv *, jobject, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
/* Header for class com_artifex_mupdf_fitz_Page */
#ifndef _Included_com_artifex_mupdf_fitz_Page
diff --git a/platform/java/src/com/artifex/mupdf/fitz/Annotation.java b/platform/java/src/com/artifex/mupdf/fitz/Annotation.java
index 855ff5a1..f517ece5 100644
--- a/platform/java/src/com/artifex/mupdf/fitz/Annotation.java
+++ b/platform/java/src/com/artifex/mupdf/fitz/Annotation.java
@@ -11,7 +11,7 @@ public class Annotation
pointer = 0;
}
- private Annotation(long p) {
+ protected Annotation(long p) {
pointer = p;
}
diff --git a/platform/java/src/com/artifex/mupdf/fitz/PDFAnnotation.java b/platform/java/src/com/artifex/mupdf/fitz/PDFAnnotation.java
new file mode 100644
index 00000000..5f001a2c
--- /dev/null
+++ b/platform/java/src/com/artifex/mupdf/fitz/PDFAnnotation.java
@@ -0,0 +1,64 @@
+package com.artifex.mupdf.fitz;
+
+public class PDFAnnotation extends Annotation
+{
+ private PDFAnnotation(long p) { super(p); }
+
+ /* IMPORTANT: Keep in sync with mupdf/pdf/annot.h */
+ public static final int TYPE_TEXT = 0;
+ public static final int TYPE_LINK = 1;
+ public static final int TYPE_FREE_TEXT = 2;
+ public static final int TYPE_LINE = 3;
+ public static final int TYPE_SQUARE = 4;
+ public static final int TYPE_CIRCLE = 5;
+ public static final int TYPE_POLYGON = 6;
+ public static final int TYPE_POLY_LINE = 7;
+ public static final int TYPE_HIGHLIGHT = 8;
+ public static final int TYPE_UNDERLINE = 9;
+ public static final int TYPE_SQUIGGLY = 10;
+ public static final int TYPE_STRIKE_OUT = 11;
+ public static final int TYPE_STAMP = 12;
+ public static final int TYPE_CARET = 13;
+ public static final int TYPE_INK = 14;
+ public static final int TYPE_POPUP = 15;
+ public static final int TYPE_FILE_ATTACHMENT = 16;
+ public static final int TYPE_SOUND = 17;
+ public static final int TYPE_MOVIE = 18;
+ public static final int TYPE_WIDGET = 19;
+ public static final int TYPE_SCREEN = 20;
+ public static final int TYPE_PRINTER_MARK = 21;
+ public static final int TYPE_TRAP_NET = 22;
+ public static final int TYPE_WATERMARK = 23;
+ public static final int TYPE_3D = 24;
+
+ public native int getType();
+ public native int getFlags();
+ public native int setFlags(int flags);
+ public native String getContents();
+ public native void setContents(String contents);
+ public native Rect getRect();
+ public native void setRect(Rect rect);
+ public native float getBorder();
+ public native void setBorder(float width);
+ public native float[] getColor();
+ public native void setColor(float[] color);
+ public native float[] getInteriorColor();
+ public native void setInteriorColor(float[] color);
+
+ public native int[] getLineEndingStyles();
+ public native void setLineEndingStyles(int startStyle, int endStyle);
+
+ public native float[] getVertices();
+ public native void setVertices(float[] vertices);
+ public native float[] getQuadPoints();
+ public native void setQuadPoints(float[] quadPoints);
+ public native float[][] getInkList();
+ public native void setInkList(float[][] inkList);
+
+ public native String getIcon();
+ public native void setIcon(String icon);
+ public native boolean isOpen();
+ public native void setIsOpen(boolean open);
+
+ public native void updateAppearance();
+}
diff --git a/platform/java/src/com/artifex/mupdf/fitz/PDFPage.java b/platform/java/src/com/artifex/mupdf/fitz/PDFPage.java
new file mode 100644
index 00000000..2175e217
--- /dev/null
+++ b/platform/java/src/com/artifex/mupdf/fitz/PDFPage.java
@@ -0,0 +1,9 @@
+package com.artifex.mupdf.fitz;
+
+public class PDFPage extends Page
+{
+ private PDFPage(long p) { super(p); }
+
+ public native PDFAnnotation createAnnotation(int type);
+ public native void deleteAnnotation(Annotation annot);
+}
diff --git a/platform/java/src/com/artifex/mupdf/fitz/Page.java b/platform/java/src/com/artifex/mupdf/fitz/Page.java
index e86209d6..60241355 100644
--- a/platform/java/src/com/artifex/mupdf/fitz/Page.java
+++ b/platform/java/src/com/artifex/mupdf/fitz/Page.java
@@ -11,7 +11,7 @@ public class Page
pointer = 0;
}
- private Page(long p) {
+ protected Page(long p) {
pointer = p;
}
diff --git a/platform/java/src/com/artifex/mupdf/fitz/android/AndroidDrawDevice.java b/platform/java/src/com/artifex/mupdf/fitz/android/AndroidDrawDevice.java
index e3afb637..38bb0447 100644
--- a/platform/java/src/com/artifex/mupdf/fitz/android/AndroidDrawDevice.java
+++ b/platform/java/src/com/artifex/mupdf/fitz/android/AndroidDrawDevice.java
@@ -13,7 +13,7 @@ public final class AndroidDrawDevice extends NativeDevice
{
private native long newNative(Bitmap bitmap, int xOrigin, int yOrigin, int patchX0, int patchY0, int patchX1, int patchY1);
- public AndroidDrawDevice (Bitmap bitmap, int xOrigin, int yOrigin, int patchX0, int patchY0, int patchX1, int patchY1) {
+ public AndroidDrawDevice(Bitmap bitmap, int xOrigin, int yOrigin, int patchX0, int patchY0, int patchX1, int patchY1) {
super(0);
pointer = newNative(bitmap, xOrigin, yOrigin, patchX0, patchY0, patchX1, patchY1);
}