[libtwelvemonkeys-java] 01/06: Add initial debian directory
Markus Koschany
apo at moszumanska.debian.org
Tue Jun 27 13:28:41 UTC 2017
This is an automated email from the git hooks/post-receive script.
apo pushed a commit to branch master
in repository libtwelvemonkeys-java.
commit a5016060ffd5dfaa0ebfe8600849890be7d825f9
Author: Markus Koschany <apo at debian.org>
Date: Tue Jun 27 14:12:10 2017 +0200
Add initial debian directory
---
debian/README.source | 13 +
debian/changelog | 5 +
debian/compat | 1 +
debian/control | 57 ++
debian/copyright | 105 +++
debian/libtwelvemonkeys-java-doc.doc-base.api | 10 +
debian/libtwelvemonkeys-java-doc.install | 3 +
debian/libtwelvemonkeys-java.poms | 55 ++
debian/maven.ignoreRules | 9 +
debian/maven.properties | 3 +
debian/maven.rules | 32 +
.../no-jmagick-and-imagemagick-support.patch | 872 +++++++++++++++++++++
debian/patches/series | 3 +
debian/patches/servlet3.1.patch | 35 +
debian/patches/use-local-jars.patch | 57 ++
debian/rules | 10 +
debian/source/format | 1 +
debian/watch | 2 +
18 files changed, 1273 insertions(+)
diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..1891757
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,13 @@
+Information about libtwelvemonkeys-java
+---------------------------------------
+
+This package was debianized using the mh_make command
+from the maven-debian-helper package.
+
+The build system uses Maven but prevents it from downloading
+anything from the Internet, making the build compliant with
+the Debian policy.
+
+Tests are disabled because of the huge amount of images that are included in
+Twelvemonkeys. Some of them are non-free (e.g. Lenna image) or the origin is
+unknown. In total the source tarball size is thus almost reduced by 100 MB.
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..b5f7d75
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+libtwelvemonkeys-java (3.3.2-1) unstable; urgency=medium
+
+ * Initial release (Closes: #866099).
+
+ -- Markus Koschany <apo at debian.org> Tue, 27 Jun 2017 13:20:31 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..6c6d6ad
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,57 @@
+Source: libtwelvemonkeys-java
+Section: java
+Priority: optional
+Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
+Uploaders:
+ Markus Koschany <apo at debian.org>
+Build-Depends:
+ debhelper (>= 10),
+ default-jdk,
+ default-jdk-doc,
+ maven-debian-helper (>= 2.1),
+ libcommons-fileupload-java,
+ libmaven-javadoc-plugin-java,
+ libservlet3.1-java
+Standards-Version: 4.0.0
+Vcs-Git: https://anonscm.debian.org/git/pkg-java/libtwelvemonkeys-java.git
+Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/libtwelvemonkeys-java.git
+Homepage: https://github.com/haraldk/TwelveMonkeys
+
+Package: libtwelvemonkeys-java
+Architecture: all
+Depends:
+ ${maven:Depends},
+ ${misc:Depends}
+Suggests:
+ libtwelvemonkeys-java-doc,
+ ${maven:OptionalDepends}
+Description: collection of plugins and extensions for Java's ImageIO
+ These plugins extend the number of image file formats supported in Java, using
+ the javax.imageio.* package. The main purpose of this project is to provide
+ support for formats not covered by the JRE itself.
+ .
+ Supported image formats (read and write support may vary):
+ BMP, JPEG, JPEG-2000, PNM, PSD, TIFF, HDR, IFF, PCX, PICT, SGI, TGA, ICNS, ICO
+ & CUR, Thumbs.db, SVG and WMF.
+
+Package: libtwelvemonkeys-java-doc
+Architecture: all
+Section: doc
+Depends:
+ ${misc:Depends}
+Recommends:
+ ${maven:DocDepends},
+ ${maven:DocOptionalDepends}
+Suggests:
+ libtwelvemonkeys-java
+Description: Documentation for libtwelvemonkeys-java
+ Twelvemonkeys is a collection of plugins and extensions for Java's ImageIO.
+ The main purpose of this project is to provide support for image file formats
+ not covered by the JRE itself.
+ .
+ Supported image formats (read and write support may vary):
+ BMP, JPEG, JPEG-2000, PNM, PSD, TIFF, HDR, IFF, PCX, PICT, SGI, TGA, ICNS, ICO
+ & CUR, Thumbs.db, SVG and WMF.
+ .
+ This package contains the API documentation of libtwelvemonkeys-java.
+
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..2b0e7d5
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,105 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: Twelvemonkeys
+Source: https://github.com/haraldk/TwelveMonkeys
+Files-Excluded:
+ */test
+
+Files: *
+Copyright: 2008-2017, Harald Kuhr <harald.kuhr at gmail.com>
+License: BSD-3-clause
+
+Files: sandbox/sandbox-common/src/main/java/com/twelvemonkeys/image/NoiseFilter.java
+Copyright: 2012, Harald Kuhr
+ 2006, Jerry Huxtable
+License: BSD-3-clause and Apache-2.0
+
+Files: common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java
+Copyright: 2008, Harald Kuhr
+ 2000, The Apache Software Foundation.
+License: BSD-3-clause and Apache-1.1
+
+Files: debian/*
+Copyright: 2017, Markus Koschany <apo at debian.org>
+License: Apache-2.0
+
+License: Apache-2.0
+ On Debian systems, the full text of the Apache-2.0 license
+ can be found in the file '/usr/share/common-licenses/Apache-2.0'
+
+License: BSD-3-clause
+ All rights reserved.
+ .
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ .
+ o Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ .
+ o Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ .
+ o Neither the name "TwelveMonkeys" nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+License: Apache-1.1
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 2000 The Apache Software Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment: "This product includes software
+ * developed by the Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Batik" and "Apache Software Foundation" must not be used to
+ * endorse or promote products derived from this software without prior
+ * written permission. For written permission, please contact
+ * apache at apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache", nor may
+ * "Apache" appear in their name, without prior written permission of the
+ * Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation. For more information on the
+ * Apache Software Foundation, please see <http://www.apache.org/>.
+ *
+ ******************************************************************************
diff --git a/debian/libtwelvemonkeys-java-doc.doc-base.api b/debian/libtwelvemonkeys-java-doc.doc-base.api
new file mode 100644
index 0000000..3276eb3
--- /dev/null
+++ b/debian/libtwelvemonkeys-java-doc.doc-base.api
@@ -0,0 +1,10 @@
+Document: libtwelvemonkeys-java
+Title: API Javadoc for Twelvemonkeys
+Author: Twelvemonkeys developers
+Abstract: This is the API Javadoc provided for the
+ libtwelvemonkeys-java libraries.
+Section: Programming
+
+Format: HTML
+Index: /usr/share/doc/libtwelvemonkeys-java/api/index.html
+Files: /usr/share/doc/libtwelvemonkeys-java/api/*
diff --git a/debian/libtwelvemonkeys-java-doc.install b/debian/libtwelvemonkeys-java-doc.install
new file mode 100644
index 0000000..5a919bc
--- /dev/null
+++ b/debian/libtwelvemonkeys-java-doc.install
@@ -0,0 +1,3 @@
+lib/site/apidocs/* usr/share/doc/libtwelvemonkeys-java/api/
+lib/apidocs/* usr/share/doc/libtwelvemonkeys-java/api/
+
diff --git a/debian/libtwelvemonkeys-java.poms b/debian/libtwelvemonkeys-java.poms
new file mode 100644
index 0000000..d69c314
--- /dev/null
+++ b/debian/libtwelvemonkeys-java.poms
@@ -0,0 +1,55 @@
+# List of POM files for the package
+# Format of this file is:
+# <path to pom file> [option]*
+# where option can be:
+# --ignore: ignore this POM and its artifact if any
+# --ignore-pom: don't install the POM. To use on POM files that are created
+# temporarily for certain artifacts such as Javadoc jars. [mh_install, mh_installpoms]
+# --no-parent: remove the <parent> tag from the POM
+# --package=<package>: an alternative package to use when installing this POM
+# and its artifact
+# --has-package-version: to indicate that the original version of the POM is the same as the upstream part
+# of the version for the package.
+# --keep-elements=<elem1,elem2>: a list of XML elements to keep in the POM
+# during a clean operation with mh_cleanpom or mh_installpom
+# --artifact=<path>: path to the build artifact associated with this POM,
+# it will be installed when using the command mh_install. [mh_install]
+# --java-lib: install the jar into /usr/share/java to comply with Debian
+# packaging guidelines
+# --usj-name=<name>: name to use when installing the library in /usr/share/java
+# --usj-version=<version>: version to use when installing the library in /usr/share/java
+# --no-usj-versionless: don't install the versionless link in /usr/share/java
+# --dest-jar=<path>: the destination for the real jar.
+# It will be installed with mh_install. [mh_install]
+# --classifier=<classifier>: Optional, the classifier for the jar. Empty by default.
+# --site-xml=<location>: Optional, the location for site.xml if it needs to be installed.
+# Empty by default. [mh_install]
+#
+pom.xml --no-parent --has-package-version
+common/pom.xml --has-package-version
+common/common-lang/pom.xml --has-package-version
+common/common-io/pom.xml --has-package-version
+common/common-image/pom.xml --has-package-version
+servlet/pom.xml --has-package-version
+imageio/pom.xml --has-package-version
+imageio/imageio-core/pom.xml --has-package-version
+imageio/imageio-metadata/pom.xml --has-package-version
+imageio/imageio-clippath/pom.xml --has-package-version
+imageio/imageio-bmp/pom.xml --has-package-version
+imageio/imageio-hdr/pom.xml --has-package-version
+imageio/imageio-icns/pom.xml --has-package-version
+imageio/imageio-iff/pom.xml --has-package-version
+imageio/imageio-jpeg/pom.xml --has-package-version
+imageio/imageio-pcx/pom.xml --has-package-version
+imageio/imageio-pdf/pom.xml --has-package-version
+imageio/imageio-pict/pom.xml --has-package-version
+imageio/imageio-pnm/pom.xml --has-package-version
+imageio/imageio-psd/pom.xml --has-package-version
+imageio/imageio-sgi/pom.xml --has-package-version
+imageio/imageio-tga/pom.xml --has-package-version
+imageio/imageio-thumbsdb/pom.xml --has-package-version
+imageio/imageio-tiff/pom.xml --has-package-version
+imageio/imageio-batik/pom.xml --has-package-version
+imageio/imageio-reference/pom.xml --has-package-version
+contrib/pom.xml --has-package-version
+bom/pom.xml --has-package-version
diff --git a/debian/maven.ignoreRules b/debian/maven.ignoreRules
new file mode 100644
index 0000000..ce016b1
--- /dev/null
+++ b/debian/maven.ignoreRules
@@ -0,0 +1,9 @@
+* * test-jar * * *
+jmagick jmagick * * * *
+junit junit * * * *
+org.apache.maven.plugins maven-checkstyle-plugin * * * *
+org.apache.maven.plugins maven-pmd-plugin * * * *
+org.apache.maven.plugins maven-source-plugin * * * *
+org.apache.maven.plugins maven-surefire-report-plugin * * * *
+org.codehaus.mojo cobertura-maven-plugin * * * *
+org.mockito mockito-all * * * *
diff --git a/debian/maven.properties b/debian/maven.properties
new file mode 100644
index 0000000..be1360a
--- /dev/null
+++ b/debian/maven.properties
@@ -0,0 +1,3 @@
+# Include here properties to pass to Maven during the build.
+# For example:
+maven.test.skip=true
diff --git a/debian/maven.rules b/debian/maven.rules
new file mode 100644
index 0000000..45d282d
--- /dev/null
+++ b/debian/maven.rules
@@ -0,0 +1,32 @@
+
+com.twelvemonkeys twelvemonkeys pom s/.*/debian/ * *
+com.twelvemonkeys.bom bom pom s/.*/debian/ * *
+com.twelvemonkeys.common common-image jar s/.*/debian/ * *
+com.twelvemonkeys.common common-io jar s/.*/debian/ * *
+com.twelvemonkeys.common common-lang jar s/.*/debian/ * *
+com.twelvemonkeys.common common pom s/.*/debian/ * *
+com.twelvemonkeys.contrib contrib jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-batik jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-bmp jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-clippath jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-core jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-hdr jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-icns jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-iff jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-jpeg jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-metadata jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-pcx jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-pdf jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-pict jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-pnm jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-psd jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-reference jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-sgi jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-tga jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-thumbsdb jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio-tiff jar s/.*/debian/ * *
+com.twelvemonkeys.imageio imageio pom s/.*/debian/ * *
+com.twelvemonkeys.servlet servlet jar s/.*/debian/ * *
+log4j log4j * s/1\.2\..*/1.2.x/ * *
+javax.servlet s/servlet-api/javax.servlet-api/ * s/.*/3.1/ * *
+s/javax.servlet/javax.servlet.jsp/ s/jsp-api/javax.servlet.jsp-api/ * s/.*/2.3/ * *
diff --git a/debian/patches/no-jmagick-and-imagemagick-support.patch b/debian/patches/no-jmagick-and-imagemagick-support.patch
new file mode 100644
index 0000000..96c48ea
--- /dev/null
+++ b/debian/patches/no-jmagick-and-imagemagick-support.patch
@@ -0,0 +1,872 @@
+From: Markus Koschany <apo at debian.org>
+Date: Mon, 26 Jun 2017 23:47:56 +0200
+Subject: no jmagick and imagemagick support
+
+---
+ .../main/java/com/twelvemonkeys/image/Magick.java | 24 -
+ .../com/twelvemonkeys/image/MagickAccelerator.java | 184 -------
+ .../java/com/twelvemonkeys/image/MagickUtil.java | 611 ---------------------
+ .../java/com/twelvemonkeys/image/ResampleOp.java | 4 +-
+ 4 files changed, 2 insertions(+), 821 deletions(-)
+ delete mode 100755 common/common-image/src/main/java/com/twelvemonkeys/image/Magick.java
+ delete mode 100755 common/common-image/src/main/java/com/twelvemonkeys/image/MagickAccelerator.java
+ delete mode 100755 common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java
+
+diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/Magick.java b/common/common-image/src/main/java/com/twelvemonkeys/image/Magick.java
+deleted file mode 100755
+index 48165b7..0000000
+--- a/common/common-image/src/main/java/com/twelvemonkeys/image/Magick.java
++++ /dev/null
+@@ -1,24 +0,0 @@
+-package com.twelvemonkeys.image;
+-
+-/**
+- * Magick
+- *
+- * @author <a href="mailto:harald.kuhr at gmail.com">Harald Kuhr</a>
+- * @author last modified by $Author: haku $
+- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/image/Magick.java#1 $
+- */
+-final class Magick {
+- static final boolean DEBUG = useDebug();
+-
+- private static boolean useDebug() {
+- try {
+- return "TRUE".equalsIgnoreCase(System.getProperty("com.twelvemonkeys.image.magick.debug"));
+- }
+- catch (Throwable t) {
+- // Most probably in case of a SecurityManager
+- return false;
+- }
+- }
+-
+- private Magick() {}
+-}
+diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/MagickAccelerator.java b/common/common-image/src/main/java/com/twelvemonkeys/image/MagickAccelerator.java
+deleted file mode 100755
+index 681f285..0000000
+--- a/common/common-image/src/main/java/com/twelvemonkeys/image/MagickAccelerator.java
++++ /dev/null
+@@ -1,184 +0,0 @@
+-package com.twelvemonkeys.image;
+-
+-/*
+- * Copyright (c) 2008, Harald Kuhr
+- * All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions are met:
+- * * Redistributions of source code must retain the above copyright
+- * notice, this list of conditions and the following disclaimer.
+- * * Redistributions in binary form must reproduce the above copyright
+- * notice, this list of conditions and the following disclaimer in the
+- * documentation and/or other materials provided with the distribution.
+- * * Neither the name "TwelveMonkeys" nor the
+- * names of its contributors may be used to endorse or promote products
+- * derived from this software without specific prior written permission.
+- *
+- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+- */
+-
+-import com.twelvemonkeys.lang.SystemUtil;
+-
+-import magick.MagickImage;
+-
+-import java.awt.image.*;
+-
+-/**
+- * This class accelerates certain graphics operations, using
+- * JMagick and ImageMagick, if available.
+- * If those libraries are not installed, this class silently does nothing.
+- * <p/>
+- * Set the system property {@code "com.twelvemonkeys.image.accel"} to
+- * {@code false}, to disable, even if JMagick is installed.
+- * Set the system property {@code "com.twelvemonkeys.image.magick.debug"} to
+- * <p/>
+- *
+- * @author <a href="mailto:harald.kuhr at gmail.com">Harald Kuhr</a>
+- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/image/MagickAccelerator.java#3 $
+- */
+-final class MagickAccelerator {
+-
+- private static final boolean DEBUG = Magick.DEBUG;
+- private static final boolean USE_MAGICK = useMagick();
+-
+- private static final int RESAMPLE_OP = 0;
+-
+- private static Class[] nativeOp = new Class[1];
+-
+- static {
+- try {
+- nativeOp[RESAMPLE_OP] = Class.forName("com.twelvemonkeys.image.ResampleOp");
+- }
+- catch (ClassNotFoundException e) {
+- System.err.println("Could not find class: " + e);
+- }
+- }
+-
+- private static boolean useMagick() {
+- try {
+- boolean available = SystemUtil.isClassAvailable("magick.MagickImage");
+-
+- if (DEBUG && !available) {
+- System.err.print("ImageMagick bindings not available.");
+- }
+-
+- boolean useMagick =
+- available && !"FALSE".equalsIgnoreCase(System.getProperty("com.twelvemonkeys.image.accel"));
+-
+- if (DEBUG) {
+- System.err.println(
+- useMagick
+- ? "Will use ImageMagick bindings to accelerate image resampling operations."
+- : "Will not use ImageMagick to accelerate image resampling operations."
+- );
+- }
+-
+- return useMagick;
+- }
+- catch (Throwable t) {
+- // Most probably in case of a SecurityManager
+- System.err.println("Could not enable ImageMagick bindings: " + t);
+- return false;
+- }
+- }
+-
+- private static int getNativeOpIndex(Class pOpClass) {
+- for (int i = 0; i < nativeOp.length; i++) {
+- if (pOpClass == nativeOp[i]) {
+- return i;
+- }
+- }
+-
+- return -1;
+- }
+-
+- public static BufferedImage filter(BufferedImageOp pOperation, BufferedImage pInput, BufferedImage pOutput) {
+- if (!USE_MAGICK) {
+- return null;
+- }
+-
+- BufferedImage result = null;
+- switch (getNativeOpIndex(pOperation.getClass())) {
+- case RESAMPLE_OP:
+- ResampleOp resample = (ResampleOp) pOperation;
+- result = resampleMagick(pInput, resample.width, resample.height, resample.filterType);
+-
+- // NOTE: If output parameter is non-null, we have to return that
+- // image, instead of result
+- if (pOutput != null) {
+- //pOutput.setData(result.getRaster()); // Fast, but less compatible
+- // NOTE: For some reason, this is sometimes super-slow...?
+- ImageUtil.drawOnto(pOutput, result);
+- result = pOutput;
+- }
+-
+- break;
+-
+- default:
+- // Simply fall through, allowing acceleration to be added later
+- break;
+-
+- }
+-
+- return result;
+- }
+-
+- private static BufferedImage resampleMagick(BufferedImage pSrc, int pWidth, int pHeight, int pFilterType) {
+- // Convert to Magick, scale and convert back
+- MagickImage image = null;
+- MagickImage scaled = null;
+- try {
+- image = MagickUtil.toMagick(pSrc);
+-
+- long start = 0;
+- if (DEBUG) {
+- start = System.currentTimeMillis();
+- }
+-
+- // NOTE: setFilter affects zoomImage, NOT scaleImage
+- image.setFilter(pFilterType);
+- scaled = image.zoomImage(pWidth, pHeight);
+- //scaled = image.scaleImage(pWidth, pHeight); // AREA_AVERAGING
+-
+- if (DEBUG) {
+- long time = System.currentTimeMillis() - start;
+- System.out.println("Filtered: " + time + " ms");
+- }
+-
+- return MagickUtil.toBuffered(scaled);
+- }
+- //catch (MagickException e) {
+- catch (Exception e) {
+- // NOTE: Stupid workaround: If MagickException is caught, a
+- // NoClassDefFoundError is thrown, when MagickException class is
+- // unavailable...
+- if (e instanceof RuntimeException) {
+- throw (RuntimeException) e;
+- }
+-
+- throw new ImageConversionException(e.getMessage(), e);
+- }
+- finally {
+- // NOTE: ImageMagick might be unstable after a while, if image data
+- // is not deallocated. The GC/finalize method handles this, but in
+- // special circumstances, it's not triggered often enough.
+- if (image != null) {
+- image.destroyImages();
+- }
+- if (scaled != null) {
+- scaled.destroyImages();
+- }
+- }
+- }
+-}
+\ No newline at end of file
+diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java b/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java
+deleted file mode 100755
+index 8f648de..0000000
+--- a/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java
++++ /dev/null
+@@ -1,611 +0,0 @@
+-/*
+- * Copyright (c) 2008, Harald Kuhr
+- * All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions are met:
+- * * Redistributions of source code must retain the above copyright
+- * notice, this list of conditions and the following disclaimer.
+- * * Redistributions in binary form must reproduce the above copyright
+- * notice, this list of conditions and the following disclaimer in the
+- * documentation and/or other materials provided with the distribution.
+- * * Neither the name "TwelveMonkeys" nor the
+- * names of its contributors may be used to endorse or promote products
+- * derived from this software without specific prior written permission.
+- *
+- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+- */
+-
+-package com.twelvemonkeys.image;
+-
+-import magick.*;
+-
+-import java.awt.*;
+-import java.awt.color.ColorSpace;
+-import java.awt.color.ICC_ColorSpace;
+-import java.awt.color.ICC_Profile;
+-import java.awt.image.*;
+-
+-/**
+- * Utility for converting JMagick {@code MagickImage}s to standard Java
+- * {@code BufferedImage}s and back.
+- * <p/>
+- * <em>NOTE: This class is considered an implementation detail and not part of
+- * the public API. This class is subject to change without further notice.
+- * You have been warned. :-)</em>
+- *
+- * @author <a href="mailto:harald.kuhr at gmail.com">Harald Kuhr</a>
+- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/image/MagickUtil.java#4 $
+- */
+-public final class MagickUtil {
+- // IMPORTANT NOTE: Disaster happens if any of these constants are used outside this class
+- // because you then have a dependency on MagickException (this is due to Java class loading
+- // and initialization magic).
+- // Do not use outside this class. If the constants need to be shared, move to Magick or ImageUtil.
+-
+- /** Color Model usesd for bilevel (B/W) */
+- private static final IndexColorModel CM_MONOCHROME = MonochromeColorModel.getInstance();
+-
+- /** Color Model usesd for raw ABGR */
+- private static final ColorModel CM_COLOR_ALPHA =
+- new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[] {8, 8, 8, 8},
+- true, true, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE);
+-
+- /** Color Model usesd for raw BGR */
+- private static final ColorModel CM_COLOR_OPAQUE =
+- new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[] {8, 8, 8},
+- false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
+-
+- /** Color Model usesd for raw RGB */
+- //private static final ColorModel CM_COLOR_RGB = new DirectColorModel(24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x0);
+-
+- /** Color Model usesd for raw GRAY + ALPHA */
+- private static final ColorModel CM_GRAY_ALPHA =
+- new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY),
+- true, true, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE);
+-
+- /** Color Model usesd for raw GRAY */
+- private static final ColorModel CM_GRAY_OPAQUE =
+- new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY),
+- false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
+-
+- /** Band offsets for raw ABGR */
+- private static final int[] BAND_OFF_TRANS = new int[] {3, 2, 1, 0};
+-
+- /** Band offsets for raw BGR */
+- private static final int[] BAND_OFF_OPAQUE = new int[] {2, 1, 0};
+-
+- /** The point at {@code 0, 0} */
+- private static final Point LOCATION_UPPER_LEFT = new Point(0, 0);
+-
+- private static final boolean DEBUG = Magick.DEBUG;
+-
+- // Only static members and methods
+- private MagickUtil() {}
+-
+- /**
+- * Converts a {@code MagickImage} to a {@code BufferedImage}.
+- * <p/>
+- * The conversion depends on {@code pImage}'s {@code ImageType}:
+- * <dl>
+- * <dt>{@code ImageType.BilevelType}</dt>
+- * <dd>{@code BufferedImage} of type {@code TYPE_BYTE_BINARY}</dd>
+- *
+- * <dt>{@code ImageType.GrayscaleType}</dt>
+- * <dd>{@code BufferedImage} of type {@code TYPE_BYTE_GRAY}</dd>
+- * <dt>{@code ImageType.GrayscaleMatteType}</dt>
+- * <dd>{@code BufferedImage} of type {@code TYPE_USHORT_GRAY}</dd>
+- *
+- * <dt>{@code ImageType.PaletteType}</dt>
+- * <dd>{@code BufferedImage} of type {@code TYPE_BYTE_BINARY} (for images
+- * with a palette of <= 16 colors) or {@code TYPE_BYTE_INDEXED}</dd>
+- * <dt>{@code ImageType.PaletteMatteType}</dt>
+- * <dd>{@code BufferedImage} of type {@code TYPE_BYTE_BINARY} (for images
+- * with a palette of <= 16 colors) or {@code TYPE_BYTE_INDEXED}</dd>
+- *
+- * <dt>{@code ImageType.TrueColorType}</dt>
+- * <dd>{@code BufferedImage} of type {@code TYPE_3BYTE_BGR}</dd>
+- * <dt>{@code ImageType.TrueColorPaletteType}</dt>
+- * <dd>{@code BufferedImage} of type {@code TYPE_4BYTE_ABGR}</dd>
+- *
+- * @param pImage the original {@code MagickImage}
+- * @return a new {@code BufferedImage}
+- *
+- * @throws IllegalArgumentException if {@code pImage} is {@code null}
+- * or if the {@code ImageType} is not one mentioned above.
+- * @throws MagickException if an exception occurs during conversion
+- *
+- * @see BufferedImage
+- */
+- public static BufferedImage toBuffered(MagickImage pImage) throws MagickException {
+- if (pImage == null) {
+- throw new IllegalArgumentException("image == null");
+- }
+-
+- long start = 0L;
+- if (DEBUG) {
+- start = System.currentTimeMillis();
+- }
+-
+- BufferedImage image = null;
+- try {
+- switch (pImage.getImageType()) {
+- case ImageType.BilevelType:
+- image = bilevelToBuffered(pImage);
+- break;
+- case ImageType.GrayscaleType:
+- image = grayToBuffered(pImage, false);
+- break;
+- case ImageType.GrayscaleMatteType:
+- image = grayToBuffered(pImage, true);
+- break;
+- case ImageType.PaletteType:
+- image = paletteToBuffered(pImage, false);
+- break;
+- case ImageType.PaletteMatteType:
+- image = paletteToBuffered(pImage, true);
+- break;
+- case ImageType.TrueColorType:
+- image = rgbToBuffered(pImage, false);
+- break;
+- case ImageType.TrueColorMatteType:
+- image = rgbToBuffered(pImage, true);
+- break;
+- case ImageType.ColorSeparationType:
+- image = cmykToBuffered(pImage, false);
+- break;
+- case ImageType.ColorSeparationMatteType:
+- image = cmykToBuffered(pImage, true);
+- break;
+- case ImageType.OptimizeType:
+- default:
+- throw new IllegalArgumentException("Unknown JMagick image type: " + pImage.getImageType());
+- }
+-
+- }
+- finally {
+- if (DEBUG) {
+- long time = System.currentTimeMillis() - start;
+- System.out.println("Converted JMagick image type: " + pImage.getImageType() + " to BufferedImage: " + image);
+- System.out.println("Conversion to BufferedImage: " + time + " ms");
+- }
+- }
+-
+- return image;
+- }
+-
+- /**
+- * Converts a {@code BufferedImage} to a {@code MagickImage}.
+- * <p/>
+- * The conversion depends on {@code pImage}'s {@code ColorModel}:
+- * <dl>
+- * <dt>{@code IndexColorModel} with 1 bit b/w</dt>
+- * <dd>{@code MagickImage} of type {@code ImageType.BilevelType}</dd>
+- * <dt>{@code IndexColorModel} > 1 bit,</dt>
+- * <dd>{@code MagickImage} of type {@code ImageType.PaletteType}
+- * or {@code MagickImage} of type {@code ImageType.PaletteMatteType}
+- * depending on <tt>ColorModel.getAlpha()</dd>
+- *
+- * <dt>{@code ColorModel.getColorSpace().getType() == ColorSpace.TYPE_GRAY}</dt>
+- * <dd>{@code MagickImage} of type {@code ImageType.GrayscaleType}
+- * or {@code MagickImage} of type {@code ImageType.GrayscaleMatteType}
+- * depending on <tt>ColorModel.getAlpha()</dd>
+- *
+- * <dt>{@code ColorModel.getColorSpace().getType() == ColorSpace.TYPE_RGB}</dt>
+- * <dd>{@code MagickImage} of type {@code ImageType.TrueColorType}
+- * or {@code MagickImage} of type {@code ImageType.TrueColorPaletteType}</dd>
+- *
+- * @param pImage the original {@code BufferedImage}
+- * @return a new {@code MagickImage}
+- *
+- * @throws IllegalArgumentException if {@code pImage} is {@code null}
+- * or if the {@code ColorModel} is not one mentioned above.
+- * @throws MagickException if an exception occurs during conversion
+- *
+- * @see BufferedImage
+- */
+- public static MagickImage toMagick(BufferedImage pImage) throws MagickException {
+- if (pImage == null) {
+- throw new IllegalArgumentException("image == null");
+- }
+-
+- long start = 0L;
+- if (DEBUG) {
+- start = System.currentTimeMillis();
+- }
+-
+- try {
+- ColorModel cm = pImage.getColorModel();
+- if (cm instanceof IndexColorModel) {
+- // Handles both BilevelType, PaletteType and PaletteMatteType
+- return indexedToMagick(pImage, (IndexColorModel) cm, cm.hasAlpha());
+- }
+-
+- switch (cm.getColorSpace().getType()) {
+- case ColorSpace.TYPE_GRAY:
+- // Handles GrayType and GrayMatteType
+- return grayToMagick(pImage, cm.hasAlpha());
+- case ColorSpace.TYPE_RGB:
+- // Handles TrueColorType and TrueColorMatteType
+- return rgbToMagic(pImage, cm.hasAlpha());
+- case ColorSpace.TYPE_CMY:
+- case ColorSpace.TYPE_CMYK:
+- case ColorSpace.TYPE_HLS:
+- case ColorSpace.TYPE_HSV:
+- // Other types not supported yet
+- default:
+- throw new IllegalArgumentException("Unknown buffered image type: " + pImage);
+- }
+- }
+- finally {
+- if (DEBUG) {
+- long time = System.currentTimeMillis() - start;
+- System.out.println("Conversion to MagickImage: " + time + " ms");
+- }
+- }
+- }
+-
+- private static MagickImage rgbToMagic(BufferedImage pImage, boolean pAlpha) throws MagickException {
+- MagickImage image = new MagickImage();
+-
+- BufferedImage buffered = ImageUtil.toBuffered(pImage, pAlpha ? BufferedImage.TYPE_4BYTE_ABGR : BufferedImage.TYPE_3BYTE_BGR);
+-
+- // Need to get data of sub raster, not the full data array, this is
+- // just a convenient way
+- Raster raster;
+- if (buffered.getRaster().getParent() != null) {
+- raster = buffered.getData(new Rectangle(buffered.getWidth(), buffered.getHeight()));
+- }
+- else {
+- raster = buffered.getRaster();
+- }
+-
+- image.constituteImage(buffered.getWidth(), buffered.getHeight(), pAlpha ? "ABGR" : "BGR",
+- ((DataBufferByte) raster.getDataBuffer()).getData());
+-
+- return image;
+- }
+-
+- private static MagickImage grayToMagick(BufferedImage pImage, boolean pAlpha) throws MagickException {
+- MagickImage image = new MagickImage();
+-
+- // TODO: Make a fix for TYPE_USHORT_GRAY
+- // The code below does not seem to work (JMagick issues?)...
+- /*
+- if (pImage.getType() == BufferedImage.TYPE_USHORT_GRAY) {
+- short[] data = ((DataBufferUShort) pImage.getRaster().getDataBuffer()).getData();
+- int[] intData = new int[data.length];
+- for (int i = 0; i < data.length; i++) {
+- intData[i] = (data[i] & 0xffff) * 0xffff;
+- }
+- image.constituteImage(pImage.getWidth(), pImage.getHeight(), "I", intData);
+-
+- System.out.println("storageClass: " + image.getStorageClass());
+- System.out.println("depth: " + image.getDepth());
+- System.out.println("imageType: " + image.getImageType());
+- }
+- else {
+- */
+- BufferedImage buffered = ImageUtil.toBuffered(pImage, pAlpha ? BufferedImage.TYPE_4BYTE_ABGR : BufferedImage.TYPE_BYTE_GRAY);
+-
+- // Need to get data of sub raster, not the full data array, this is
+- // just a convenient way
+- Raster raster;
+- if (buffered.getRaster().getParent() != null) {
+- raster = buffered.getData(new Rectangle(buffered.getWidth(), buffered.getHeight()));
+- }
+- else {
+- raster = buffered.getRaster();
+- }
+-
+- image.constituteImage(buffered.getWidth(), buffered.getHeight(), pAlpha ? "ABGR" : "I", ((DataBufferByte) raster.getDataBuffer()).getData());
+- //}
+-
+- return image;
+- }
+-
+- private static MagickImage indexedToMagick(BufferedImage pImage, IndexColorModel pColorModel, boolean pAlpha) throws MagickException {
+- MagickImage image = rgbToMagic(pImage, pAlpha);
+-
+- int mapSize = pColorModel.getMapSize();
+- image.setNumberColors(mapSize);
+-
+- return image;
+- }
+-
+- /*
+- public static MagickImage toMagick(BufferedImage pImage) throws MagickException {
+- if (pImage == null) {
+- throw new IllegalArgumentException("image == null");
+- }
+-
+- final int width = pImage.getWidth();
+- final int height = pImage.getHeight();
+-
+- // int ARGB -> byte RGBA conversion
+- // NOTE: This is ImageMagick Q16 compatible raw RGBA format with 16 bits/sample...
+- // For a Q8 build, we could probably go with half the space...
+- // NOTE: This is close to insanity, as it wastes extreme ammounts of memory
+- final int[] argb = new int[width];
+- final byte[] raw16 = new byte[width * height * 8];
+- for (int y = 0; y < height; y++) {
+- // Fetch one line of ARGB data
+- pImage.getRGB(0, y, width, 1, argb, 0, width);
+-
+- for (int x = 0; x < width; x++) {
+- int pixel = (x + (y * width)) * 8;
+- raw16[pixel ] = (byte) ((argb[x] >> 16) & 0xff); // R
+- raw16[pixel + 2] = (byte) ((argb[x] >> 8) & 0xff); // G
+- raw16[pixel + 4] = (byte) ((argb[x] ) & 0xff); // B
+- raw16[pixel + 6] = (byte) ((argb[x] >> 24) & 0xff); // A
+- }
+- }
+-
+- // Create magick image
+- ImageInfo info = new ImageInfo();
+- info.setMagick("RGBA"); // Raw RGBA samples
+- info.setSize(width + "x" + height); // String?!?
+-
+- MagickImage image = new MagickImage(info);
+- image.setImageAttribute("depth", "8");
+-
+- // Set pixel data in 16 bit raw RGBA format
+- image.blobToImage(info, raw16);
+-
+- return image;
+- }
+- */
+-
+- /**
+- * Converts a bi-level {@code MagickImage} to a {@code BufferedImage}, of
+- * type {@code TYPE_BYTE_BINARY}.
+- *
+- * @param pImage the original {@code MagickImage}
+- * @return a new {@code BufferedImage}
+- *
+- * @throws MagickException if an exception occurs during conversion
+- *
+- * @see BufferedImage
+- */
+- private static BufferedImage bilevelToBuffered(MagickImage pImage) throws MagickException {
+- // As there is no way to get the binary representation of the image,
+- // convert to gray, and the create a binary image from it
+- BufferedImage temp = grayToBuffered(pImage, false);
+-
+- BufferedImage image = new BufferedImage(temp.getWidth(), temp.getHeight(), BufferedImage.TYPE_BYTE_BINARY, CM_MONOCHROME);
+-
+- ImageUtil.drawOnto(image, temp);
+-
+- return image;
+- }
+-
+- /**
+- * Converts a gray {@code MagickImage} to a {@code BufferedImage}, of
+- * type {@code TYPE_USHORT_GRAY} or {@code TYPE_BYTE_GRAY}.
+- *
+- * @param pImage the original {@code MagickImage}
+- * @param pAlpha keep alpha channel
+- * @return a new {@code BufferedImage}
+- *
+- * @throws MagickException if an exception occurs during conversion
+- *
+- * @see BufferedImage
+- */
+- private static BufferedImage grayToBuffered(MagickImage pImage, boolean pAlpha) throws MagickException {
+- Dimension size = pImage.getDimension();
+- int length = size.width * size.height;
+- int bands = pAlpha ? 2 : 1;
+- byte[] pixels = new byte[length * bands];
+-
+- // TODO: Make a fix for 16 bit TYPE_USHORT_GRAY?!
+- // Note: The ordering AI or I corresponds to BufferedImage
+- // TYPE_CUSTOM and TYPE_BYTE_GRAY respectively
+- pImage.dispatchImage(0, 0, size.width, size.height, pAlpha ? "AI" : "I", pixels);
+-
+- // Init databuffer with array, to avoid allocation of empty array
+- DataBuffer buffer = new DataBufferByte(pixels, pixels.length);
+-
+- int[] bandOffsets = pAlpha ? new int[] {1, 0} : new int[] {0};
+-
+- WritableRaster raster =
+- Raster.createInterleavedRaster(buffer, size.width, size.height,
+- size.width * bands, bands, bandOffsets, LOCATION_UPPER_LEFT);
+-
+- return new BufferedImage(pAlpha ? CM_GRAY_ALPHA : CM_GRAY_OPAQUE, raster, pAlpha, null);
+- }
+-
+- /**
+- * Converts a palette-based {@code MagickImage} to a
+- * {@code BufferedImage}, of type {@code TYPE_BYTE_BINARY} (for images
+- * with a palette of <= 16 colors) or {@code TYPE_BYTE_INDEXED}.
+- *
+- * @param pImage the original {@code MagickImage}
+- * @param pAlpha keep alpha channel
+- * @return a new {@code BufferedImage}
+- *
+- * @throws MagickException if an exception occurs during conversion
+- *
+- * @see BufferedImage
+- */
+- private static BufferedImage paletteToBuffered(MagickImage pImage, boolean pAlpha) throws MagickException {
+- // Create indexcolormodel for the image
+- IndexColorModel cm;
+-
+- try {
+- cm = createIndexColorModel(pImage.getColormap(), pAlpha);
+- }
+- catch (MagickException e) {
+- // NOTE: Some MagickImages incorrecly (?) reports to be paletteType,
+- // but does not have a colormap, this is a workaround.
+- return rgbToBuffered(pImage, pAlpha);
+- }
+-
+- // As there is no way to get the indexes of an indexed image, convert to
+- // RGB, and the create an indexed image from it
+- BufferedImage temp = rgbToBuffered(pImage, pAlpha);
+-
+- BufferedImage image;
+- if (cm.getMapSize() <= 16) {
+- image = new BufferedImage(temp.getWidth(), temp.getHeight(), BufferedImage.TYPE_BYTE_BINARY, cm);
+- }
+- else {
+- image = new BufferedImage(temp.getWidth(), temp.getHeight(), BufferedImage.TYPE_BYTE_INDEXED, cm);
+- }
+-
+- // Create transparent background for images containing alpha
+- if (pAlpha) {
+- Graphics2D g = image.createGraphics();
+- try {
+- g.setComposite(AlphaComposite.Clear);
+- g.fillRect(0, 0, temp.getWidth(), temp.getHeight());
+- }
+- finally {
+- g.dispose();
+- }
+- }
+-
+- // NOTE: This is (surprisingly) much faster than using g2d.drawImage()..
+- // (Tests shows 20-30ms, vs. 600-700ms on the same image)
+- BufferedImageOp op = new CopyDither(cm);
+- op.filter(temp, image);
+-
+- return image;
+- }
+-
+- /**
+- * Creates an {@code IndexColorModel} from an array of
+- * {@code PixelPacket}s.
+- *
+- * @param pColormap the original colormap as a {@code PixelPacket} array
+- * @param pAlpha keep alpha channel
+- *
+- * @return a new {@code IndexColorModel}
+- */
+- public static IndexColorModel createIndexColorModel(PixelPacket[] pColormap, boolean pAlpha) {
+- int[] colors = new int[pColormap.length];
+-
+- // TODO: Verify if this is correct for alpha...?
+- int trans = pAlpha ? colors.length - 1 : -1;
+-
+- //for (int i = 0; i < pColormap.length; i++) {
+- for (int i = pColormap.length - 1; i != 0; i--) {
+- PixelPacket color = pColormap[i];
+- if (pAlpha) {
+- colors[i] = (0xff - (color.getOpacity() & 0xff)) << 24 |
+- (color.getRed() & 0xff) << 16 |
+- (color.getGreen() & 0xff) << 8 |
+- (color.getBlue() & 0xff);
+- }
+- else {
+- colors[i] = (color.getRed() & 0xff) << 16 |
+- (color.getGreen() & 0xff) << 8 |
+- (color.getBlue() & 0xff);
+- }
+- }
+-
+- return new InverseColorMapIndexColorModel(8, colors.length, colors, 0, pAlpha, trans, DataBuffer.TYPE_BYTE);
+- }
+-
+- /**
+- * Converts an (A)RGB {@code MagickImage} to a {@code BufferedImage}, of
+- * type {@code TYPE_4BYTE_ABGR} or {@code TYPE_3BYTE_BGR}.
+- *
+- * @param pImage the original {@code MagickImage}
+- * @param pAlpha keep alpha channel
+- * @return a new {@code BufferedImage}
+- *
+- * @throws MagickException if an exception occurs during conversion
+- *
+- * @see BufferedImage
+- */
+- private static BufferedImage rgbToBuffered(MagickImage pImage, boolean pAlpha) throws MagickException {
+- Dimension size = pImage.getDimension();
+- int length = size.width * size.height;
+- int bands = pAlpha ? 4 : 3;
+- byte[] pixels = new byte[length * bands];
+-
+- // TODO: If we do multiple dispatches (one per line, typically), we could provide listener
+- // feedback. But it's currently a lot slower than fetching all the pixels in one go.
+-
+- // Note: The ordering ABGR or BGR corresponds to BufferedImage
+- // TYPE_4BYTE_ABGR and TYPE_3BYTE_BGR respectively
+- pImage.dispatchImage(0, 0, size.width, size.height, pAlpha ? "ABGR" : "BGR", pixels);
+-
+- // Init databuffer with array, to avoid allocation of empty array
+- DataBuffer buffer = new DataBufferByte(pixels, pixels.length);
+-
+- int[] bandOffsets = pAlpha ? BAND_OFF_TRANS : BAND_OFF_OPAQUE;
+-
+- WritableRaster raster =
+- Raster.createInterleavedRaster(buffer, size.width, size.height,
+- size.width * bands, bands, bandOffsets, LOCATION_UPPER_LEFT);
+-
+- return new BufferedImage(pAlpha ? CM_COLOR_ALPHA : CM_COLOR_OPAQUE, raster, pAlpha, null);
+- }
+-
+-
+-
+-
+- /**
+- * Converts an {@code MagickImage} to a {@code BufferedImage} which holds an CMYK ICC profile
+- *
+- * @param pImage the original {@code MagickImage}
+- * @param pAlpha keep alpha channel
+- * @return a new {@code BufferedImage}
+- *
+- * @throws MagickException if an exception occurs during conversion
+- *
+- * @see BufferedImage
+- */
+- private static BufferedImage cmykToBuffered(MagickImage pImage, boolean pAlpha) throws MagickException {
+- Dimension size = pImage.getDimension();
+- int length = size.width * size.height;
+-
+- // Retreive the ICC profile
+- ICC_Profile profile = ICC_Profile.getInstance(pImage.getColorProfile().getInfo());
+- ColorSpace cs = new ICC_ColorSpace(profile);
+-
+- int bands = cs.getNumComponents() + (pAlpha ? 1 : 0);
+-
+- int[] bits = new int[bands];
+- for (int i = 0; i < bands; i++) {
+- bits[i] = 8;
+- }
+-
+- ColorModel cm = pAlpha ?
+- new ComponentColorModel(cs, bits, true, true, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE) :
+- new ComponentColorModel(cs, bits, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
+-
+- byte[] pixels = new byte[length * bands];
+-
+- // TODO: If we do multiple dispatches (one per line, typically), we could provide listener
+- // feedback. But it's currently a lot slower than fetching all the pixels in one go.
+- // TODO: handle more generic cases if profile is not CMYK
+- // TODO: Test "ACMYK"
+- pImage.dispatchImage(0, 0, size.width, size.height, pAlpha ? "ACMYK" : "CMYK", pixels);
+-
+- // Init databuffer with array, to avoid allocation of empty array
+- DataBuffer buffer = new DataBufferByte(pixels, pixels.length);
+-
+- // TODO: build array from bands variable, here it just works for CMYK
+- // The values has not been tested with an alpha picture actually...
+- int[] bandOffsets = pAlpha ? new int[] {0, 1, 2, 3, 4} : new int[] {0, 1, 2, 3};
+-
+- WritableRaster raster =
+- Raster.createInterleavedRaster(buffer, size.width, size.height,
+- size.width * bands, bands, bandOffsets, LOCATION_UPPER_LEFT);
+-
+- return new BufferedImage(cm, raster, pAlpha, null);
+-
+- }
+-}
+diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java b/common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java
+index 73cc9cc..8bfc341 100644
+--- a/common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java
++++ b/common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java
+@@ -538,7 +538,7 @@ public class ResampleOp implements BufferedImageOp/* TODO: RasterOp */ {
+ }
+
+ // Try to use native ImageMagick code
+- BufferedImage result = MagickAccelerator.filter(this, input, output);
++ BufferedImage result = null;
+ if (result != null) {
+ return result;
+ }
+@@ -1626,4 +1626,4 @@ public class ResampleOp implements BufferedImageOp/* TODO: RasterOp */ {
+ }/* next dst column */
+ return pDest;
+ }/* resample */
+-}
+\ No newline at end of file
++}
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..0b5bf19
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,3 @@
+no-jmagick-and-imagemagick-support.patch
+use-local-jars.patch
+servlet3.1.patch
diff --git a/debian/patches/servlet3.1.patch b/debian/patches/servlet3.1.patch
new file mode 100644
index 0000000..cf707c9
--- /dev/null
+++ b/debian/patches/servlet3.1.patch
@@ -0,0 +1,35 @@
+From: Markus Koschany <apo at debian.org>
+Date: Tue, 27 Jun 2017 00:26:50 +0200
+Subject: servlet3.1
+
+---
+ .../java/com/twelvemonkeys/servlet/OutputStreamAdapter.java | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/servlet/src/main/java/com/twelvemonkeys/servlet/OutputStreamAdapter.java b/servlet/src/main/java/com/twelvemonkeys/servlet/OutputStreamAdapter.java
+index d3316f0..f4ce633 100755
+--- a/servlet/src/main/java/com/twelvemonkeys/servlet/OutputStreamAdapter.java
++++ b/servlet/src/main/java/com/twelvemonkeys/servlet/OutputStreamAdapter.java
+@@ -31,6 +31,7 @@ package com.twelvemonkeys.servlet;
+ import com.twelvemonkeys.lang.Validate;
+
+ import javax.servlet.ServletOutputStream;
++import javax.servlet.WriteListener;
+ import java.io.IOException;
+ import java.io.OutputStream;
+
+@@ -117,4 +118,14 @@ public class OutputStreamAdapter extends ServletOutputStream {
+ public void write(final byte pBytes[], final int pOff, final int pLen) throws IOException {
+ out.write(pBytes, pOff, pLen);
+ }
++
++ @Override
++ public void setWriteListener(WriteListener writeListener) {
++ throw new UnsupportedOperationException();
++ }
++
++ @Override
++ public boolean isReady() {
++ throw new UnsupportedOperationException();
++ }
+ }
diff --git a/debian/patches/use-local-jars.patch b/debian/patches/use-local-jars.patch
new file mode 100644
index 0000000..145eeba
--- /dev/null
+++ b/debian/patches/use-local-jars.patch
@@ -0,0 +1,57 @@
+From: Markus Koschany <apo at debian.org>
+Date: Sun, 25 Jun 2017 00:24:24 +0200
+Subject: use local jars
+
+---
+ common/common-image/pom.xml | 4 ++++
+ common/common-io/pom.xml | 3 ++-
+ pom.xml | 1 +
+ 3 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/common/common-image/pom.xml b/common/common-image/pom.xml
+index ef807bb..bef7cf8 100644
+--- a/common/common-image/pom.xml
++++ b/common/common-image/pom.xml
+@@ -17,11 +17,15 @@
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>common-lang</artifactId>
++ <scope>system</scope>
++ <systemPath>${user.dir}/lib/twelvemonkeys-common-lang-3.3.2.jar</systemPath>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>common-io</artifactId>
++ <scope>system</scope>
++ <systemPath>${user.dir}/lib/twelvemonkeys-common-io-3.3.2.jar</systemPath>
+ </dependency>
+
+ <dependency>
+diff --git a/common/common-io/pom.xml b/common/common-io/pom.xml
+index 511a045..9fc0af8 100644
+--- a/common/common-io/pom.xml
++++ b/common/common-io/pom.xml
+@@ -17,8 +17,9 @@
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>common-lang</artifactId>
++ <scope>system</scope>
++ <systemPath>${user.dir}/lib/twelvemonkeys-common-lang-3.3.2.jar</systemPath>
+ </dependency>
+-
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>common-lang</artifactId>
+diff --git a/pom.xml b/pom.xml
+index 1a27c5b..c56bea2 100755
+--- a/pom.xml
++++ b/pom.xml
+@@ -91,6 +91,7 @@
+ </properties>
+
+ <build>
++ <directory>${user.dir}/lib</directory>
+ <finalName>twelvemonkeys-${project.artifactId}-${project.version}</finalName>
+ <plugins>
+ <plugin>
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..08c86ca
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,10 @@
+#!/usr/bin/make -f
+
+%:
+ dh $@
+
+override_dh_auto_test:
+ # Do nothing here
+
+get-orig-source:
+ uscan --download-current-version --force-download --repack --compression xz
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..d4379e9
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,2 @@
+version=3
+https://github.com/haraldk/TwelveMonkeys/tags .*/(?:.*?)([\d\.]+)\.tar\.gz
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libtwelvemonkeys-java.git
More information about the pkg-java-commits
mailing list