diff options
Diffstat (limited to 'platform/java/com')
-rw-r--r-- | platform/java/com/artifex/mupdf/fitz/Image.java | 6 | ||||
-rw-r--r-- | platform/java/com/artifex/mupdf/fitz/Pixmap.java | 24 |
2 files changed, 20 insertions, 10 deletions
diff --git a/platform/java/com/artifex/mupdf/fitz/Image.java b/platform/java/com/artifex/mupdf/fitz/Image.java index 3876bc1b..a9eb2ffa 100644 --- a/platform/java/com/artifex/mupdf/fitz/Image.java +++ b/platform/java/com/artifex/mupdf/fitz/Image.java @@ -37,9 +37,5 @@ public class Image public native boolean getInterpolate(); public native Image getMask(); - public native Pixmap toPixmap(int w, int h); - - public Pixmap toPixmap() { - return toPixmap(getWidth(), getHeight()); - } + public native Pixmap toPixmap(); } diff --git a/platform/java/com/artifex/mupdf/fitz/Pixmap.java b/platform/java/com/artifex/mupdf/fitz/Pixmap.java index 61c833ff..61c5ddc6 100644 --- a/platform/java/com/artifex/mupdf/fitz/Pixmap.java +++ b/platform/java/com/artifex/mupdf/fitz/Pixmap.java @@ -11,22 +11,34 @@ public class Pixmap pointer = 0; } - private native long newNative(ColorSpace cs, int x, int y, int w, int h); + 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 colorspace, int x, int y, int w, int h, boolean alpha) { + pointer = newNative(colorspace, x, y, w, h, alpha); + } + public Pixmap(ColorSpace colorspace, int x, int y, int w, int h) { - pointer = newNative(colorspace, x, y, w, h); + this(colorspace, x, y, w, h, false); + } + + public Pixmap(ColorSpace colorspace, int w, int h, boolean alpha) { + this(colorspace, 0, 0, w, h, alpha); } public Pixmap(ColorSpace colorspace, int w, int h) { - this(colorspace, 0, 0, w, h); + this(colorspace, 0, 0, w, h, false); + } + + public Pixmap(ColorSpace colorspace, Rect rect, boolean alpha) { + this(colorspace, (int)rect.x0, (int)rect.y0, (int)(rect.x1 - rect.x0), (int)(rect.y1 - rect.y0), alpha); } public Pixmap(ColorSpace colorspace, Rect rect) { - this(colorspace, (int)rect.x0, (int)rect.y0, (int)(rect.x1 - rect.x0), (int)(rect.y1 - rect.y0)); + this(colorspace, rect, false); } public native void clear(); @@ -40,9 +52,10 @@ public class Pixmap 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 int[] getPixels(); /* only valid for RGB or BGR pixmaps */ + public native int[] getPixels(); /* only valid for RGBA or BGRA pixmaps */ public void clear(int value) { clearWithValue(value); @@ -54,6 +67,7 @@ public class Pixmap " x=" + getX() + " y=" + getY() + " n=" + getNumberOfComponents() + + " alpha=" + getAlpha() + " cs=" + getColorSpace() + ")"; } |