From 1cd8d2d359ff0c8ea7ba7a5837bc4a4f2f4e02ad Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 5 Feb 2011 07:54:38 +0000 Subject: Add missing MuPDFCore.java file. --- android/src/com/artifex/mupdf/MuPDFCore.java | 52 ++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 android/src/com/artifex/mupdf/MuPDFCore.java diff --git a/android/src/com/artifex/mupdf/MuPDFCore.java b/android/src/com/artifex/mupdf/MuPDFCore.java new file mode 100644 index 00000000..245ffdc0 --- /dev/null +++ b/android/src/com/artifex/mupdf/MuPDFCore.java @@ -0,0 +1,52 @@ +package com.artifex.mupdf; +import android.graphics.*; + +public class MuPDFCore +{ + /* load our native library */ + static { + System.loadLibrary("mupdf"); + } + + /* Readable members */ + public int pageNum; + public int numPages; + public float pageWidth; + public float pageHeight; + + /* The native functions */ + private static native int openFile(String filename); + private static native void gotoPageInternal(int localActionPageNum); + private static native float getPageWidth(); + private static native float getPageHeight(); + public static native void drawPage(Bitmap bitmap, + int pageW, + int pageH, + int patchX, + int patchY, + int patchW, + int patchH); + + public MuPDFCore(String filename) throws Exception + { + numPages = openFile(filename); + if (numPages <= 0) + { + throw new Exception("Failed to open "+filename); + } + pageNum = 1; + } + + /* Shim function */ + public void gotoPage(int page) + { + if (page > numPages) + page = numPages; + else if (page < 1) + page = 1; + gotoPageInternal(page); + this.pageNum = page; + this.pageWidth = getPageWidth(); + this.pageHeight = getPageHeight(); + } +} -- cgit v1.2.3