diff options
author | fred ross-perry <fredross-perry@Fred-Ross-Perrys-Computer.local> | 2016-07-14 16:05:15 -0700 |
---|---|---|
committer | fred ross-perry <fred.ross-perry@artifex.com> | 2016-07-15 09:36:56 -0700 |
commit | cb78b5c6782f14a699f90bd5621cd3656a1e02ea (patch) | |
tree | 47b83072ff5fb133f8d4ac9ff32992e464234f86 /platform/java/com | |
parent | e47769cf2bc9feb30c074c965883f9662540ab3b (diff) | |
download | mupdf-cb78b5c6782f14a699f90bd5621cd3656a1e02ea.tar.xz |
java - move fitz sources into a 'src' subfolder.
Diffstat (limited to 'platform/java/com')
32 files changed, 0 insertions, 1468 deletions
diff --git a/platform/java/com/artifex/mupdf/fitz/Annotation.java b/platform/java/com/artifex/mupdf/fitz/Annotation.java deleted file mode 100644 index 855ff5a1..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Annotation.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Annotation -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private Annotation(long p) { - pointer = p; - } - - public native void run(Device dev, Matrix ctm, Cookie cookie); - public native Pixmap toPixmap(Matrix ctm, ColorSpace colorspace, boolean alpha); - public native Rect getBounds(); - public native DisplayList toDisplayList(); - - private native long advance(); -} diff --git a/platform/java/com/artifex/mupdf/fitz/Buffer.java b/platform/java/com/artifex/mupdf/fitz/Buffer.java deleted file mode 100644 index 7f23b062..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Buffer.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Buffer -{ - static { - Context.init(); - } - - public static final int DEFAULT_BUFFER_SIZE = 1024; - - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private native long newNativeBuffer(int n); - - public Buffer(int n) { - pointer = newNativeBuffer(n); - } - - public Buffer() { - pointer = newNativeBuffer(DEFAULT_BUFFER_SIZE); - } - - public native int getLength(); - public native void writeByte(byte b); - public native void writeBytes(byte[] bs); - public native void writeBuffer(Buffer buf); - public native void writeRune(int rune); - public native void writeLine(String line); - public native void writeLines(String... lines); - - public native void save(String filename); -} diff --git a/platform/java/com/artifex/mupdf/fitz/ColorSpace.java b/platform/java/com/artifex/mupdf/fitz/ColorSpace.java deleted file mode 100644 index b7822161..00000000 --- a/platform/java/com/artifex/mupdf/fitz/ColorSpace.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class ColorSpace -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private ColorSpace(long p) { - pointer = p; - } - - private static native long nativeDeviceGray(); - private static native long nativeDeviceRGB(); - private static native long nativeDeviceBGR(); - private static native long nativeDeviceCMYK(); - - protected static ColorSpace fromPointer(long p) { - if (p == DeviceGray.pointer) return DeviceGray; - if (p == DeviceRGB.pointer) return DeviceRGB; - if (p == DeviceBGR.pointer) return DeviceBGR; - if (p == DeviceCMYK.pointer) return DeviceCMYK; - return new ColorSpace(p); - } - - public static ColorSpace DeviceGray = new ColorSpace(nativeDeviceGray()); - public static ColorSpace DeviceRGB = new ColorSpace(nativeDeviceRGB()); - public static ColorSpace DeviceBGR = new ColorSpace(nativeDeviceBGR()); - public static ColorSpace DeviceCMYK = new ColorSpace(nativeDeviceCMYK()); - - public native int getNumberOfComponents(); - - public String toString() { - if (this == DeviceGray) return "DeviceGray"; - if (this == DeviceRGB) return "DeviceRGB"; - if (this == DeviceBGR) return "DeviceBGR"; - if (this == DeviceCMYK) return "DeviceCMYK"; - return "ColorSpace(" + getNumberOfComponents() + ")"; - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/Context.java b/platform/java/com/artifex/mupdf/fitz/Context.java deleted file mode 100644 index 3614e65f..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Context.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.artifex.mupdf.fitz; - -// This class handles the loading of the MuPDF shared library, together -// with the ThreadLocal magic to get the required context. -// -// The only publicly accessible method here is Context.setStoreSize, which -// sets the store size to use. This must be called before any other MuPDF -// function. -public class Context -{ - private static boolean inited = false; - private static native int initNative(); - - public static void init() { - if (!inited) { - inited = true; - System.loadLibrary("mupdf_java"); - if (initNative() < 0) - throw new RuntimeException("cannot initialize mupdf library"); - } - } - - static { init(); } - - // FIXME: We should support the store size being changed dynamically. - // This requires changes within the MuPDF core. - //public native static void setStoreSize(long newSize); -} diff --git a/platform/java/com/artifex/mupdf/fitz/Cookie.java b/platform/java/com/artifex/mupdf/fitz/Cookie.java deleted file mode 100644 index f866f99e..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Cookie.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Cookie -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private native long newNative(); - - public Cookie() { - pointer = newNative(); - } - - public native void abort(); -} diff --git a/platform/java/com/artifex/mupdf/fitz/Device.java b/platform/java/com/artifex/mupdf/fitz/Device.java deleted file mode 100644 index 295226fe..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Device.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Device -{ - protected long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private native long newNative(); - - protected Device() { - pointer = newNative(); - } - - protected Device(long p) { - pointer = p; - } - - /* An accessor for device hints */ - public native int getHints(); - public native void enableDeviceHints(int hints); - public native void disableDeviceHints(int hints); - - /* To implement your own device in Java, you should define your own - * class that extends Device, and override as many of the following - * functions as is appropriate. For example: - * - * class ImageTraceDevice extends Device - * { - * void fillImage(Image img, Matrix ctx, float alpha) { - * System.out.println("Image!"); - * } - * }; - */ - - public void close() {} - public void fillPath(Path path, boolean evenOdd, Matrix ctm, ColorSpace cs, float color[], float alpha) {} - public void strokePath(Path path, StrokeState stroke, Matrix ctm, ColorSpace cs, float color[], float alpha) {} - public void clipPath(Path path, boolean evenOdd, Matrix ctm) {} - public void clipStrokePath(Path path, StrokeState stroke, Matrix ctm) {} - public void fillText(Text text, Matrix ctm, ColorSpace cs, float color[], float alpha) {} - public void strokeText(Text text, StrokeState stroke, Matrix ctm, ColorSpace cs, float color[], float alpha) {} - public void clipText(Text text, Matrix ctm) {} - public void clipStrokeText(Text text, StrokeState stroke, Matrix ctm) {} - public void ignoreText(Text text, Matrix ctm) {} - public void fillShade(Shade shd, Matrix ctm, float alpha) {} - public void fillImage(Image img, Matrix ctm, float alpha) {} - public void fillImageMask(Image img, Matrix ctm, ColorSpace cs, float color[], float alpha) {} - public void clipImageMask(Image img, Matrix ctm) {} - public void popClip() {} - public void beginMask(Rect area, boolean luminosity, ColorSpace cs, float bc[]) {} - public void endMask() {} - public void beginGroup(Rect area, boolean isolated, boolean knockout, int blendmode, float alpha) {} - public void endGroup() {} - public int beginTile(Rect area, Rect view, float xstep, float ystep, Matrix ctm, int id) { return 0; } - public void endTile() {} - - /* Flags */ - public static final int FZ_DEVFLAG_MASK = 1; - public static final int FZ_DEVFLAG_COLOR = 2; - public static final int FZ_DEVFLAG_UNCACHEABLE = 4; - public static final int FZ_DEVFLAG_FILLCOLOR_UNDEFINED = 8; - public static final int FZ_DEVFLAG_STROKECOLOR_UNDEFINED = 16; - public static final int FZ_DEVFLAG_STARTCAP_UNDEFINED = 32; - public static final int FZ_DEVFLAG_DASHCAP_UNDEFINED = 64; - public static final int FZ_DEVFLAG_ENDCAP_UNDEFINED = 128; - public static final int FZ_DEVFLAG_LINEJOIN_UNDEFINED = 256; - public static final int FZ_DEVFLAG_MITERLIMIT_UNDEFINED = 512; - public static final int FZ_DEVFLAG_LINEWIDTH_UNDEFINED = 1024; - - /* PDF 1.4 -- standard separable */ - public static final int FZ_BLEND_NORMAL = 0; - public static final int FZ_BLEND_MULTIPLY = 1; - public static final int FZ_BLEND_SCREEN = 2; - public static final int FZ_BLEND_OVERLAY = 3; - public static final int FZ_BLEND_DARKEN = 4; - public static final int FZ_BLEND_LIGHTEN = 5; - public static final int FZ_BLEND_COLOR_DODGE = 6; - public static final int FZ_BLEND_COLOR_BURN = 7; - public static final int FZ_BLEND_HARD_LIGHT = 8; - public static final int FZ_BLEND_SOFT_LIGHT = 9; - public static final int FZ_BLEND_DIFFERENCE = 10; - public static final int FZ_BLEND_EXCLUSION = 11; - - /* PDF 1.4 -- standard non-separable */ - public static final int FZ_BLEND_HUE = 12; - public static final int FZ_BLEND_SATURATION = 13; - public static final int FZ_BLEND_COLOR = 14; - public static final int FZ_BLEND_LUMINOSITY = 15; - - /* For packing purposes */ - public static final int FZ_BLEND_MODEMASK = 15; - public static final int FZ_BLEND_ISOLATED = 16; - public static final int FZ_BLEND_KNOCKOUT = 32; - - /* Device hints */ - public static final int FZ_IGNORE_IMAGE = 1; - public static final int FZ_IGNORE_SHADE = 2; -} diff --git a/platform/java/com/artifex/mupdf/fitz/DisplayList.java b/platform/java/com/artifex/mupdf/fitz/DisplayList.java deleted file mode 100644 index 3e822eea..00000000 --- a/platform/java/com/artifex/mupdf/fitz/DisplayList.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class DisplayList -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private native long newNative(); - - public DisplayList() { - pointer = newNative(); - } - - private DisplayList(long p) { - pointer = p; - } - - public native Pixmap toPixmap(Matrix ctm, ColorSpace colorspace, boolean alpha); - public native Rect[] search(String needle); - - public native void run(Device dev, Matrix ctm, Rect scissor, Cookie cookie); - - public void run(Device dev, Matrix ctm, Cookie cookie) { - run(dev, ctm, null, cookie); - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/DisplayListDevice.java b/platform/java/com/artifex/mupdf/fitz/DisplayListDevice.java deleted file mode 100644 index c7f7c935..00000000 --- a/platform/java/com/artifex/mupdf/fitz/DisplayListDevice.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.artifex.mupdf.fitz; - -public final class DisplayListDevice extends NativeDevice -{ - private static native long newNative(DisplayList list); - - public DisplayListDevice(DisplayList list) { - super(newNative(list)); - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/Document.java b/platform/java/com/artifex/mupdf/fitz/Document.java deleted file mode 100644 index 89e3013b..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Document.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Document -{ - static { - Context.init(); - } - - public static final String META_FORMAT = "format"; - public static final String META_ENCRYPTION = "encryption"; - public static final String META_INFO_AUTHOR = "info:Author"; - public static final String META_INFO_TITLE = "info:Title"; - - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private native long newNativeWithPath(String filename); - private native long newNativeWithBuffer(byte buffer[], String magic); - // private native long newNativeWithRandomAccessFile(RandomAccessFile file, String magic); - - public Document(String filename) { - pointer = newNativeWithPath(filename); - } - - public Document(byte buffer[], String magic) { - pointer = newNativeWithBuffer(buffer, magic); - } - - private Document(long p) { - pointer = p; - } - - public native boolean needsPassword(); - public native boolean authenticatePassword(String password); - - public native int countPages(); - public native Page loadPage(int number); - public native Outline loadOutline(); - public native String getMetaData(String key); - public native boolean isReflowable(); - public native void layout(float width, float height, float em); - - public native boolean isUnencryptedPDF(); - - public native PDFDocument toPDFDocument(); -} diff --git a/platform/java/com/artifex/mupdf/fitz/DocumentWriter.java b/platform/java/com/artifex/mupdf/fitz/DocumentWriter.java deleted file mode 100644 index dce9d73d..00000000 --- a/platform/java/com/artifex/mupdf/fitz/DocumentWriter.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class DocumentWriter -{ - static { - Context.init(); - } - - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private native long newNativeDocumentWriter(String filename, String format, String options); - - public DocumentWriter(String filename, String format, String options) { - pointer = newNativeDocumentWriter(filename, format, options); - } - - public native Device beingPage(Rect mediabox); - public native void endPage(Device device); - public native void close(); -} diff --git a/platform/java/com/artifex/mupdf/fitz/DrawDevice.java b/platform/java/com/artifex/mupdf/fitz/DrawDevice.java deleted file mode 100644 index e022be10..00000000 --- a/platform/java/com/artifex/mupdf/fitz/DrawDevice.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.artifex.mupdf.fitz; - -public final class DrawDevice extends NativeDevice -{ - private static native long newNative(Pixmap pixmap); - - public DrawDevice(Pixmap pixmap) { - super(newNative(pixmap)); - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/Font.java b/platform/java/com/artifex/mupdf/fitz/Font.java deleted file mode 100644 index 5101a6ac..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Font.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Font -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private native long newNative(String name, int index); - - private Font(long p) { - pointer = p; - } - - public Font(String name, int index) { - pointer = newNative(name, index); - } - - public Font(String name) { - pointer = newNative(name, 0); - } - - public native String getName(); - - public native int encodeCharacter(int unicode); - public native float advanceGlyph(int glyph, boolean wmode); - - public float advanceGlyph(int glyph) { - return advanceGlyph(glyph, false); - } - - public String toString() { - return "Font(" + getName() + ")"; - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/Image.java b/platform/java/com/artifex/mupdf/fitz/Image.java deleted file mode 100644 index 4d2f7eb5..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Image.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Image -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private native long newNativeFromPixmap(Pixmap pixmap); - private native long newNativeFromFile(String filename); - - private Image(long p) { - pointer = p; - } - - public Image(Pixmap pixmap) { - pointer = newNativeFromPixmap(pixmap); - } - - public Image(String filename) { - pointer = newNativeFromFile(filename); - } - - public native int getWidth(); - public native int getHeight(); - public native int getXResolution(); - public native int getYResolution(); - - public native ColorSpace getColorSpace(); - public native int getNumberOfComponents(); - public native int getBitsPerComponent(); - public native boolean getImageMask(); - public native boolean getInterpolate(); - public native Image getMask(); - - public native Pixmap toPixmap(); -} diff --git a/platform/java/com/artifex/mupdf/fitz/Link.java b/platform/java/com/artifex/mupdf/fitz/Link.java deleted file mode 100644 index 0ecd8307..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Link.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Link -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private Link(long p) { - pointer = p; - } - - public native Link getNext(); -} diff --git a/platform/java/com/artifex/mupdf/fitz/Matrix.java b/platform/java/com/artifex/mupdf/fitz/Matrix.java deleted file mode 100644 index 80da84fc..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Matrix.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Matrix -{ - public float a, b, c, d, e, f; - - public Matrix(float a, float b, float c, float d, float e, float f) { - this.a = a; - this.b = b; - this.c = c; - this.d = d; - this.e = e; - this.f = f; - } - - public Matrix(float a, float b, float c, float d) { - this(a, b, c, d, 0, 0); - } - - public Matrix(float a, float d) { - this(a, 0, 0, d, 0, 0); - } - - public Matrix(float a) { - this(a, 0, 0, a, 0, 0); - } - - public Matrix() { - this(1, 0, 0, 1, 0, 0); - } - - public Matrix(Matrix one, Matrix two) { - a = one.a * two.a + one.b * two.c; - b = one.a * two.b + one.b * two.d; - c = one.c * two.a + one.d * two.c; - d = one.c * two.b + one.d * two.d; - e = one.e * two.a + one.f * two.c + two.e; - f = one.e * two.b + one.f * two.d + two.f; - } - - public Matrix concat(Matrix m) { - float a = this.a * m.a + this.b * m.c; - float b = this.a * m.b + this.b * m.d; - float c = this.c * m.a + this.d * m.c; - float d = this.c * m.b + this.d * m.d; - float e = this.e * m.a + this.f * m.c + m.e; - this.f = this.e * m.b + this.f * m.d + m.f; - - this.a = a; - this.b = b; - this.c = c; - this.d = d; - this.e = e; - - return this; - } - - public Matrix scale(float sx, float sy) { - a *= sx; - b *= sx; - c *= sy; - d *= sy; - return this; - } - - public Matrix scale(float s) { - return scale(s, s); - } - - public Matrix translate(float tx, float ty) { - e += tx * a + ty * c; - f += tx * b + ty * d; - return this; - } - - public Matrix rotate(float degrees) { - while (degrees < 0) - degrees += 360; - while (degrees >= 360) - degrees -= 360; - - if (Math.abs(0 - degrees) < 0.0001) { - // Nothing to do - } else if (Math.abs(90 - degrees) < 0.0001) { - float save_a = a; - float save_b = b; - a = c; - b = d; - c = -save_a; - d = -save_b; - } else if (Math.abs(180 - degrees) < 0.0001) { - a = -a; - b = -b; - c = -c; - d = -d; - } else if (Math.abs(270 - degrees) < 0.0001) { - float save_a = a; - float save_b = b; - a = -c; - b = -d; - c = save_a; - d = save_b; - } else { - float sin = (float)Math.sin(degrees * Math.PI / 180.0); - float cos = (float)Math.cos(degrees * Math.PI / 180.0); - float save_a = a; - float save_b = b; - a = cos * save_a + sin * c; - b = cos * save_b + sin * d; - c = -sin * save_a + cos * c; - d = -sin * save_b + cos * d; - } - return this; - } - - public String toString() { - return "[" + a + " " + b + " " + c + " " + d + " " + e + " " + f + "]"; - } - - public static Matrix Identity() { - return new Matrix(1, 0, 0, 1, 0, 0); - } - - public static Matrix Scale(float x) { - return new Matrix(x, 0, 0, x, 0, 0); - } - - public static Matrix Scale(float x, float y) { - return new Matrix(x, 0, 0, y, 0, 0); - } - - public static Matrix Translate(float x, float y) { - return new Matrix(1, 0, 0, 1, x, y); - } - - public static Matrix Rotate(float degrees) { - float sin, cos; - - while (degrees < 0) - degrees += 360; - while (degrees >= 360) - degrees -= 360; - - if (Math.abs(0 - degrees) < 0.0001) { - sin = 0; - cos = 1; - } else if (Math.abs(90 - degrees) < 0.0001) { - sin = 1; - cos = 0; - } else if (Math.abs(180 - degrees) < 0.0001) { - sin = 0; - cos = -1; - } else if (Math.abs(270 - degrees) < 0.0001) { - sin = -1; - cos = 0; - } else { - sin = (float)Math.sin(degrees * Math.PI / 180.0); - cos = (float)Math.cos(degrees * Math.PI / 180.0); - } - - return new Matrix(cos, sin, -sin, cos, 0, 0); - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/NativeDevice.java b/platform/java/com/artifex/mupdf/fitz/NativeDevice.java deleted file mode 100644 index 0d2b9159..00000000 --- a/platform/java/com/artifex/mupdf/fitz/NativeDevice.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class NativeDevice extends Device -{ - private long nativeInfo; - private Object nativeResource; - - protected native void finalize(); - - public void destroy() { - super.destroy(); - nativeInfo = 0; - nativeResource = null; - } - - protected NativeDevice(long p) { - super(p); - } - - public native final void close(); - - public native final void fillPath(Path path, boolean evenOdd, Matrix ctm, ColorSpace cs, float color[], float alpha); - public native final void strokePath(Path path, StrokeState stroke, Matrix ctm, ColorSpace cs, float color[], float alpha); - public native final void clipPath(Path path, boolean evenOdd, Matrix ctm); - public native final void clipStrokePath(Path path, StrokeState stroke, Matrix ctm); - - public native final void fillText(Text text, Matrix ctm, ColorSpace cs, float color[], float alpha); - public native final void strokeText(Text text, StrokeState stroke, Matrix ctm, ColorSpace cs, float color[], float alpha); - public native final void clipText(Text text, Matrix ctm); - public native final void clipStrokeText(Text text, StrokeState stroke, Matrix ctm); - public native final void ignoreText(Text text, Matrix ctm); - - public native final void fillShade(Shade shd, Matrix ctm, float alpha); - public native final void fillImage(Image img, Matrix ctm, float alpha); - public native final void fillImageMask(Image img, Matrix ctm, ColorSpace cs, float color[], float alpha); - public native final void clipImageMask(Image img, Matrix ctm); - - public native final void popClip(); - - public native final void beginMask(Rect rect, boolean luminosity, ColorSpace cs, float bc[]); - public native final void endMask(); - public native final void beginGroup(Rect rect, boolean isolated, boolean knockout, int blendmode, float alpha); - public native final void endGroup(); - - public native final int beginTile(Rect area, Rect view, float xstep, float ystep, Matrix ctm, int id); - public native final void endTile(); -} diff --git a/platform/java/com/artifex/mupdf/fitz/Outline.java b/platform/java/com/artifex/mupdf/fitz/Outline.java deleted file mode 100644 index 98a11b79..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Outline.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Outline -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private Outline(long p) { - pointer = p; - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/PDFDocument.java b/platform/java/com/artifex/mupdf/fitz/PDFDocument.java deleted file mode 100644 index 58a3e3a6..00000000 --- a/platform/java/com/artifex/mupdf/fitz/PDFDocument.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class PDFDocument -{ - static { - Context.init(); - } - - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private PDFDocument(long p) { - pointer = p; - } - - public native Document toDocument(); - - public native int countPages(); - public native PDFObject findPage(int at); - - public native PDFObject getTrailer(); - public native int countObjects(); - - public native PDFObject newNull(); - public native PDFObject newBoolean(boolean b); - public native PDFObject newInteger(int i); - public native PDFObject newReal(float f); - public native PDFObject newString(String s); - public native PDFObject newName(String name); - public native PDFObject newIndirect(int num, int gen); - public native PDFObject newArray(); - public native PDFObject newDictionary(); - - public native PDFObject addObject(PDFObject obj); - public native PDFObject createObject(); - public native void deleteObject(int i); - - public native PDFObject addStream(Buffer buf); - - public native PDFObject addPage(Rect mediabox, int rotate, PDFObject resources, Buffer contents); - public native void insertPage(int at, PDFObject page); - public native void deletePage(int at); - public native PDFObject addImage(Image image); - public native PDFObject addSimpleFont(Font font); - public native PDFObject addFont(Font font); - public native void save(String filename, String options); - - public void deleteObject(PDFObject obj) { - deleteObject(obj.toIndirect()); - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/PDFObject.java b/platform/java/com/artifex/mupdf/fitz/PDFObject.java deleted file mode 100644 index f2e926f2..00000000 --- a/platform/java/com/artifex/mupdf/fitz/PDFObject.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class PDFObject -{ - static { - Context.init(); - } - - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private PDFObject(long p) { - pointer = p; - } - - public native boolean isIndirect(); - public native boolean isNull(); - public native boolean isBoolean(); - public native boolean isInteger(); - public native boolean isReal(); - public native boolean isNumber(); - public native boolean isString(); - public native boolean isName(); - public native boolean isArray(); - public native boolean isDictionary(); - public native boolean isStream(); - - public native boolean toBoolean(); - public native int toInteger(); - public native float toFloat(); - public native byte[] toByteString(); - public native int toIndirect(); - public native String toString(boolean tight); - - public String toString() { - return toString(false); - } - - public native PDFObject resolve(); - - public native byte[] readStream(); - public native byte[] readRawStream(); - - public native PDFObject getArray(int index); - public native PDFObject getDictionary(String name); - - public PDFObject get(int index) { - return getArray(index); - } - - public PDFObject get(String name) { - return getDictionary(name); - } - - public native void putArrayBoolean(int index, boolean b); - public native void putArrayInteger(int index, int i); - public native void putArrayFloat(int index, float f); - public native void putArrayString(int index, String str); - public native void putArrayPDFObject(int index, PDFObject obj); - - public native void putDictionaryStringBoolean(String name, boolean b); - public native void putDictionaryStringInteger(String name, int i); - public native void putDictionaryStringFloat(String name, float f); - public native void putDictionaryStringString(String name, String str); - public native void putDictionaryStringPDFObject(String name, PDFObject obj); - - public native void putDictionaryPDFObjectBoolean(PDFObject name, boolean b); - public native void putDictionaryPDFObjectInteger(PDFObject name, int i); - public native void putDictionaryPDFObjectFloat(PDFObject name, float f); - public native void putDictionaryPDFObjectString(PDFObject name, String str); - public native void putDictionaryPDFObjectPDFObject(PDFObject name, PDFObject obj); - - - public void put(int index, boolean b) { - putArrayBoolean(index, b); - } - - public void put(int index, int i) { - putArrayInteger(index, i); - } - - public void put(int index, float f) { - putArrayFloat(index, f); - } - - public void put(int index, String s) { - putArrayString(index, s); - } - - public void put(int index, PDFObject obj) { - putArrayPDFObject(index, obj); - } - - public void put(String name, boolean b) { - putDictionaryStringBoolean(name, b); - } - - public void put(String name, int i) { - putDictionaryStringInteger(name, i); - } - - public void put(String name, float f) { - putDictionaryStringFloat(name, f); - } - - public void put(String name, String str) { - putDictionaryStringString(name, str); - } - - public void put(String name, PDFObject obj) { - putDictionaryStringPDFObject(name, obj); - } - - public void put(PDFObject name, boolean b) { - putDictionaryPDFObjectBoolean(name, b); - } - - public void put(PDFObject name, int i) { - putDictionaryPDFObjectInteger(name, i); - } - - public void put(PDFObject name, float f) { - putDictionaryPDFObjectFloat(name, f); - } - - public void put(PDFObject name, String str) { - putDictionaryPDFObjectString(name, str); - } - - public void put(PDFObject name, PDFObject obj) { - putDictionaryPDFObjectPDFObject(name, obj); - } - - public native void deleteArray(int index); - public native void deleteDictionaryString(String name); - public native void deleteDictionaryPDFObject(PDFObject name); - - public void delete(int index) { - deleteArray(index); - } - - public void delete(String name) { - deleteDictionaryString(name); - } - - public void delete(PDFObject name) { - deleteDictionaryPDFObject(name); - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/Page.java b/platform/java/com/artifex/mupdf/fitz/Page.java deleted file mode 100644 index 64fe4030..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Page.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Page -{ - private long pointer; - private Annotation nativeAnnots[]; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - nativeAnnots = null; - } - - private Page(long p) { - pointer = p; - nativeAnnots = null; - } - - public native Rect getBounds(); - - public native Pixmap toPixmap(Matrix ctm, ColorSpace cs, boolean alpha); - - public native void run(Device dev, Matrix ctm, Cookie cookie); - public native void runPageContents(Device dev, Matrix ctm, Cookie cookie); - public native Annotation[] getAnnotations(); - - public void run(Device dev, Matrix ctm) { - run(dev, ctm, null); - } - - // FIXME: Later - public native Link[] getLinks(); - - // FIXME: Later. Much later. - //fz_transition *fz_page_presentation(fz_document *doc, fz_page *page, float *duration); - - public native DisplayList toDisplayList(boolean no_annotations); - public native StructuredText toStructuredText(); - - public native Rect[] search(String needle); -} diff --git a/platform/java/com/artifex/mupdf/fitz/Path.java b/platform/java/com/artifex/mupdf/fitz/Path.java deleted file mode 100644 index 455dce69..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Path.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Path implements PathWalker -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private native long newNative(); - private native long cloneNative(); - - public Path() { - pointer = newNative(); - } - - private Path(long p) { - pointer = p; - } - - public Path(Path old) { - pointer = old.cloneNative(); - } - - public native Point currentPoint(); - - public native void moveTo(float x, float y); - public native void lineTo(float x, float y); - public native void curveTo(float cx1, float cy1, float cx2, float cy2, float ex, float ey); - public native void curveToV(float cx, float cy, float ex, float ey); - public native void curveToY(float cx, float cy, float ex, float ey); - public native void rect(int x1, int y1, int x2, int y2); - public native void closePath(); - - public void moveTo(Point xy) { - moveTo(xy.x, xy.y); - } - - public void lineTo(Point xy) { - lineTo(xy.x, xy.y); - } - - public void curveTo(Point c1, Point c2, Point e) { - curveTo(c1.x, c1.y, c2.x, c2.y, e.x, e.y); - } - - public void curveToV(Point c, Point e) { - curveToV(c.x, c.y, e.x, e.y); - } - - public void curveToY(Point c, Point e) { - curveToY(c.x, c.y, e.x, e.y); - } - - public native void transform(Matrix mat); - - public native Rect getBounds(StrokeState stroke, Matrix ctm); - - public native void walk(PathWalker walker); -} diff --git a/platform/java/com/artifex/mupdf/fitz/PathWalker.java b/platform/java/com/artifex/mupdf/fitz/PathWalker.java deleted file mode 100644 index 66d1b49b..00000000 --- a/platform/java/com/artifex/mupdf/fitz/PathWalker.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.artifex.mupdf.fitz; - -public interface PathWalker -{ - public void moveTo(float x, float y); - public void lineTo(float x, float y); - public void curveTo(float cx1, float cy1, float cx2, float cy2, float ex, float ey); - public void closePath(); -} diff --git a/platform/java/com/artifex/mupdf/fitz/Pixmap.java b/platform/java/com/artifex/mupdf/fitz/Pixmap.java deleted file mode 100644 index 52432fea..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Pixmap.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Pixmap -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private native long newNative(ColorSpace cs, int x, int y, int w, int h, boolean alpha); - - private Pixmap(long p) { - pointer = p; - } - - public Pixmap(ColorSpace cs, int x, int y, int w, int h, boolean alpha) { - pointer = newNative(cs, x, y, w, h, alpha); - } - - public Pixmap(ColorSpace cs, int x, int y, int w, int h) { - this(cs, x, y, w, h, false); - } - - public Pixmap(ColorSpace cs, int w, int h, boolean alpha) { - this(cs, 0, 0, w, h, alpha); - } - - public Pixmap(ColorSpace cs, int w, int h) { - this(cs, 0, 0, w, h, false); - } - - public Pixmap(ColorSpace cs, Rect rect, boolean alpha) { - this(cs, (int)rect.x0, (int)rect.y0, (int)(rect.x1 - rect.x0), (int)(rect.y1 - rect.y0), alpha); - } - - public Pixmap(ColorSpace cs, Rect rect) { - this(cs, rect, false); - } - - public native void clear(); - public native void clearWithValue(int value); - - public native void saveAsPNG(String filename); - - public native int getX(); - public native int getY(); - public native int getWidth(); - public native int getHeight(); - public native int getStride(); - public native int getNumberOfComponents(); - public native boolean getAlpha(); - public native ColorSpace getColorSpace(); - public native byte[] getSamples(); - public native byte getSamples(int x, int y, int n); - public native int[] getPixels(); /* only valid for RGBA or BGRA pixmaps */ - public native int getXResolution(); - public native int getYResolution(); - - public void clear(int value) { - clearWithValue(value); - } - - public Rect getBounds() { - int x = getX(); - int y = getY(); - return new Rect(x, y, x + getWidth(), y+ getHeight()); - } - - public String toString() { - return "Pixmap(w=" + getWidth() + - " h=" + getHeight() + - " x=" + getX() + - " y=" + getY() + - " n=" + getNumberOfComponents() + - " alpha=" + getAlpha() + - " cs=" + getColorSpace() + - ")"; - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/Point.java b/platform/java/com/artifex/mupdf/fitz/Point.java deleted file mode 100644 index b32198bc..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Point.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Point -{ - public float x; - public float y; - - public Point(float x, float y) { - this.x = x; - this.y = y; - } - - public Point(Point p) { - this.x = p.x; - this.y = p.y; - } - - public String toString() { - return "[" + x + " " + y + "]"; - } - - public Point transform(Matrix tm) { - float old_x = this.x; - - this.x = old_x * tm.a + y * tm.c + tm.e; - this.y = old_x * tm.b + y * tm.d + tm.f; - - return this; - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/Rect.java b/platform/java/com/artifex/mupdf/fitz/Rect.java deleted file mode 100644 index 819646e8..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Rect.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Rect -{ - public float x0; - public float y0; - public float x1; - public float y1; - - public Rect(float x0, float y0, float x1, float y1) { - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; - } - - public Rect(Rect r) { - this(r.x0, r.y0, r.x1, r.y1); - } - - public Rect(RectI r) { - this(r.x0, r.y0, r.x1, r.y1); - } - - public String toString() { - return "[" + x0 + " " + y0 + " " + x1 + " " + y1 + "]"; - } - - public Rect transform(Matrix tm) { - float ax0 = x0 * tm.a; - float ax1 = x1 * tm.a; - - if (ax0 > ax1) { - float t = ax0; - ax0 = ax1; - ax1 = t; - } - - float cy0 = y0 * tm.c; - float cy1 = y1 * tm.c; - - if (cy0 > cy1) { - float t = cy0; - cy0 = cy1; - cy1 = t; - } - ax0 += cy0 + tm.e; - ax1 += cy1 + tm.e; - - float bx0 = x0 * tm.b; - float bx1 = x1 * tm.b; - - if (bx0 > bx1) { - float t = bx0; - bx0 = bx1; - bx1 = t; - } - - float dy0 = y0 * tm.d; - float dy1 = y1 * tm.d; - - if (dy0 > dy1) { - float t = dy0; - dy0 = dy1; - dy1 = t; - } - bx0 += dy0 + tm.f; - bx1 += dy1 + tm.f; - - x0 = ax0; - x1 = ax1; - y0 = bx0; - y1 = bx1; - - return this; - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/RectI.java b/platform/java/com/artifex/mupdf/fitz/RectI.java deleted file mode 100644 index 8e46a3f2..00000000 --- a/platform/java/com/artifex/mupdf/fitz/RectI.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class RectI -{ - public int x0; - public int y0; - public int x1; - public int y1; - - public RectI(int x0, int y0, int x1, int y1) { - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; - } - - public RectI(RectI r) { - this(r.x0, r.y0, r.x1, r.y1); - } - - public RectI(Rect r) { - this.x0 = (int)Math.floor(r.x0); - this.y0 = (int)Math.ceil(r.y0); - this.x1 = (int)Math.floor(r.x1); - this.y1 = (int)Math.ceil(r.y1); - } - - public String toString() { - return "[" + x0 + " " + y0 + " " + x1 + " " + y1 + "]"; - } - - public RectI transform(Matrix tm) { - float ax0 = x0 * tm.a; - float ax1 = x1 * tm.a; - - if (ax0 > ax1) { - float t = ax0; - ax0 = ax1; - ax1 = t; - } - - float cy0 = y0 * tm.c; - float cy1 = y1 * tm.c; - - if (cy0 > cy1) { - float t = cy0; - cy0 = cy1; - cy1 = t; - } - ax0 += cy0 + tm.e; - ax1 += cy1 + tm.e; - - float bx0 = x0 * tm.b; - float bx1 = x1 * tm.b; - - if (bx0 > bx1) { - float t = bx0; - bx0 = bx1; - bx1 = t; - } - - float dy0 = y0 * tm.d; - float dy1 = y1 * tm.d; - - if (dy0 > dy1) { - float t = dy0; - dy0 = dy1; - dy1 = t; - } - bx0 += dy0 + tm.f; - bx1 += dy1 + tm.f; - - x0 = (int)Math.floor(ax0); - x1 = (int)Math.ceil(ax1); - y0 = (int)Math.floor(bx0); - y1 = (int)Math.ceil(bx1); - - return this; - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/Shade.java b/platform/java/com/artifex/mupdf/fitz/Shade.java deleted file mode 100644 index 35182cb8..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Shade.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Shade -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private Shade(long p) { - pointer = p; - } -} diff --git a/platform/java/com/artifex/mupdf/fitz/StrokeState.java b/platform/java/com/artifex/mupdf/fitz/StrokeState.java deleted file mode 100644 index 7f333f76..00000000 --- a/platform/java/com/artifex/mupdf/fitz/StrokeState.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class StrokeState -{ - public static final int FZ_LINECAP_BUTT = 0; - public static final int FZ_LINECAP_ROUND = 1; - public static final int FZ_LINECAP_SQUARE = 2; - public static final int FZ_LINECAP_TRIANGLE = 3; - - public static final int FZ_LINEJOIN_MITER = 0; - public static final int FZ_LINEJOIN_ROUND = 1; - public static final int FZ_LINEJOIN_BEVEL = 2; - public static final int FZ_LINEJOIN_MITER_XPS = 3; - - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private native long newNative(int startCap, int dashCap, int endCap, int lineJoin, float lineWidth, float miterLimit, - float dashPhase, float dash[]); - - // Private constructor for the C to use. Any objects created by the - // C are done for purposes of calling back to a java device, and - // should therefore be considered const. This is fine as we don't - // currently provide mechanisms for changing individual elements - // of the StrokeState. - private StrokeState(long p) { - pointer = p; - } - - public StrokeState(int startCap, int endCap, int lineJoin, float lineWidth, float miterLimit) { - pointer = newNative(startCap, 0, endCap, lineJoin, lineWidth, miterLimit, 0, null); - } - - public StrokeState(int startCap, int dashCap, int endCap, int lineJoin, float lineWidth, float miterLimit, - float dashPhase, float dash[]) { - pointer = newNative(startCap, dashCap, endCap, lineJoin, lineWidth, miterLimit, dashPhase, dash); - } - - public native void adjustRectForStroke(Rect rect, Matrix ctm); - - public native int getStartCap(); - public native int getDashCap(); - public native int getEndCap(); - public native int getLineJoin(); - public native float getLineWidth(); - public native float getMiterLimit(); - public native float getDashPhase(); - public native float[] getDashes(); -} diff --git a/platform/java/com/artifex/mupdf/fitz/StructuredText.java b/platform/java/com/artifex/mupdf/fitz/StructuredText.java deleted file mode 100644 index 0f3549d5..00000000 --- a/platform/java/com/artifex/mupdf/fitz/StructuredText.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class StructuredText -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private StructuredText(long p) { - pointer = p; - } - - public native Rect[] search(String needle); - public native Rect[] highlight(Rect rect); - public native String copy(Rect rect); -} diff --git a/platform/java/com/artifex/mupdf/fitz/Text.java b/platform/java/com/artifex/mupdf/fitz/Text.java deleted file mode 100644 index 5bbe8abe..00000000 --- a/platform/java/com/artifex/mupdf/fitz/Text.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class Text implements TextWalker -{ - private long pointer; - - protected native void finalize(); - - public void destroy() { - finalize(); - pointer = 0; - } - - private native long newNative(); - private native long cloneNative(Text old); - - private Text(long p) { - pointer = p; - } - - public Text(Text old) { - pointer = cloneNative(old); - } - - public Text() { - pointer = newNative(); - } - - public native void showGlyph(Font font, Matrix trm, int glyph, int unicode, boolean wmode); - public native void showString(Font font, Matrix trm, String str, boolean wmode); - - public native Rect getBounds(StrokeState stroke, Matrix ctm); - - public void showGlyph(Font font, Matrix trm, int glyph, int unicode) { - showGlyph(font, trm, glyph, unicode, false); - } - - public void showString(Font font, Matrix trm, String str) { - showString(font, trm, str, false); - } - - public native void walk(TextWalker walker); -} diff --git a/platform/java/com/artifex/mupdf/fitz/TextWalker.java b/platform/java/com/artifex/mupdf/fitz/TextWalker.java deleted file mode 100644 index 911c19bc..00000000 --- a/platform/java/com/artifex/mupdf/fitz/TextWalker.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.artifex.mupdf.fitz; - -public interface TextWalker -{ - public void showGlyph(Font font, Matrix trm, int glyph, int unicode, boolean wmode); -} diff --git a/platform/java/com/artifex/mupdf/fitz/TryLaterException.java b/platform/java/com/artifex/mupdf/fitz/TryLaterException.java deleted file mode 100644 index e2d1b88e..00000000 --- a/platform/java/com/artifex/mupdf/fitz/TryLaterException.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.artifex.mupdf.fitz; - -public class TryLaterException extends Exception -{ - TryLaterException(String message) { - super(message); - } -} |