pax_global_header00006660000000000000000000000064145276540160014524gustar00rootroot0000000000000052 comment=b4412afd5303aa6aa389b66ccea4bef2eabf0aca techblue-jmagick-b4412af/000077500000000000000000000000001452765401600153275ustar00rootroot00000000000000techblue-jmagick-b4412af/.gitattributes000066400000000000000000000000221452765401600202140ustar00rootroot00000000000000*.sh text eol=lf techblue-jmagick-b4412af/.github/000077500000000000000000000000001452765401600166675ustar00rootroot00000000000000techblue-jmagick-b4412af/.github/workflows/000077500000000000000000000000001452765401600207245ustar00rootroot00000000000000techblue-jmagick-b4412af/.github/workflows/jmagick_build.yml000066400000000000000000000021331452765401600242320ustar00rootroot00000000000000name: jmagick Makefile CI (multiple jdk versions) on: push: pull_request: branches: [ "master" ] jobs: build: runs-on: ubuntu-latest # jammy name: ${{ matrix.jdk }} on ${{ matrix.os }} strategy: fail-fast: true matrix: jdk: ['8', '11'] os: ['ubuntu', 'bullseye'] exclude: - jdk: '8' os: 'bullseye' container: image: dpokidov/imagemagick:7.1.1-10-${{ matrix.os }} options: --user root steps: - uses: actions/checkout@v3 - name: Package update run: apt-get update -y && apt-get install -y sudo curl wget apt-utils - name: Install build tools run: apt-get install -y autoconf automake libtool build-essential pkg-config openjdk-${{ matrix.jdk }}-jdk - name: Prepare autotools run: | touch NEWS AUTHORS ChangeLog autoreconf --force --install automake --add-missing - name: Configure run: | ./configure --with-java-home=/usr/lib/jvm/java-${{ matrix.jdk }}-openjdk-amd64 - name: Make run: make techblue-jmagick-b4412af/.gitignore000066400000000000000000000003461452765401600173220ustar00rootroot00000000000000autom4te.cache libtool Make.def config.log config.status classes generated lib obj /aclocal.m4 /config.log /config.status /configure /configure~ /ltmain.sh /config.guess /config.sub /missing /Makefile /Makefile.in /compile .idea/techblue-jmagick-b4412af/CREDITS000066400000000000000000000034361452765401600163550ustar00rootroot00000000000000DEVELOPERS AND CONTRIBUTORS ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following people have worked on or have contributed code to JMagick. They hold the appropriate copyright to their contributions. The list do not contain the copyright holders of ImageMagick (see the ImageMagick copyright statements). Eric Yeo Development and maintenance of JMagick. Abdulbaset Gaddah Contributed more functionality to JMagick. Jin Zhao Constributed to the Mac OS X port. Ibrahim Tannir Contributed the Makefile for Windows. Susan Dorr Contributed to some methods for MagickImage. Adam Heath Contributed the DESTDIR variable in Makefiles for packaging purposes. Conrtibuted the configure directive --with-java-includes Max Kollegov Contributed code to load JMagick shared library from the system class loader, thereby, making JMagick usable in the Resin server. Tim Griffin For pointing out a number of problems when compiling JMagick on Solaris using a Sun C compiler and contributions to code. Elizabeth Barham For code contributions. Susan Dorr For contributing MagickInfo and its associated native C code and pingImage. Mike Edmonds For contributing the MagickImage methods addNoiseImage, blurImage, charcoalImage, edgeImage, embossImage, enhanceImage, gaussianBlurImage, implodeImage, medianFilterImage, oilPaintImage, reduceNoiseImage, segmentImage, solarizeImage, spreadImage, swirlImage, unsharpMaskImage, waveImage SPECIAL THANKS ~~~~~~~~~~~~~~ Special thanks goes to Alexander Voynow for his help and patience in getting JMagick to work on Solaris. techblue-jmagick-b4412af/Changelog.txt000066400000000000000000000367261452765401600177750ustar00rootroot00000000000000========== Compatibility statement for JMagick 6.5.7 =========== The current verison of JMagick is compatible with ImageMagick version 6.4.1-2 and later. Some new values have been added to support new functionality in IM 6.5.7-6, but if you don't use the new values then JMagick 6.5.7 should be compatible with any version if ImageMagick from 6.4.1-2 to 6.5.7-6. ----- issues with ImageMagick 6.4.1 and later --------- In ImageMagick version 6.4.1-2 CompressionType's have been changed and therefore the class was changed to: public final static int UndefinedCompression = 0; public final static int NoCompression = 1; public final static int BZipCompression = 2; public final static int DXT1Compression = 3; // Revision 10867 - 05/10/08 - version 6.4.1-2 public final static int DXT3Compression = 4; // IM Revision 10867 public final static int DXT5Compression = 5; // IM Revision 10867 public final static int FaxCompression = 6; public final static int Group4Compression = 7; public final static int JPEGCompression = 8; public final static int JPEG2000Compression = 9; public final static int LosslessJPEGCompression = 10; public final static int LZWCompression = 11; public final static int RLECompression = 12; public final static int ZipCompression = 13; // IM Revision 10867 This makes JMagick incompatible with ImageMagick version 6.4.1 and before, if any of the values greater than 2 is used or stored in your code. ----- issues with ImageMagick before version 6.3.9 --------- There are only some very minor issues, namely that the classes ExceptionType and GeometryFlags have been changed. This *could* influence the return value of Magick.parseImageGeometry(), but existing values are compatible, so code should not break. IM Before version 6.2.9 does not support the DivideCompositeOp CompositeOperator. ========== Changelog =========== 2023-11-23 * Added CI workflow support, configure.ac improved, see https://github.com/techblue/jmagick/commits/master for recent changes 2023-06-09 * Added build support for Java 11, 17 2014-08-02 Christian Ferbar * Add Kerning, InterwordSpacing, InterlineSpacing, getTypeMetrics, FormatMagickCaption 2014-06-16 Andrew Kerr - JMagick 6.7.7 * Enum interfaces changed to reflect ImageMagick 6.7.7 .h files. ImageMagick 6.7.7 is the currently shipping version for Ubuntu 14.04 LTS. * Fix memory leak in MagickImage.imageToBlob(). (https://github.com/techblue/jmagick/issues/3) 2012-11-20 Andrew Kerr - JMagick 6.6.9 * Enum interfaces changed to reflect ImageMagick 6.6.9 .h files. The FilterType.java file is no longer compatibile with older versions, due to changes to the corresponding ImageMagick enum. ImageMagick 6.6.9 is the currently shipping version for Ubuntu 12.04.1 LTS. 2012-11-14 Andrew Kerr - JMagick 6.6.2 * Enum interfaces changed to reflect ImageMagick 6.6.2 .h files. The QuantumTypes.java file is no longer compatibile with older versions. * Added MagickImage.setQuality(). MagickInfo.setQuality() is ignored in newer ImageMagicks. See http://sourceforge.net/mailarchive/forum.php?thread_name=alpine.GSO.2.01.1201091112090.20764%40freddy.simplesystems.org&forum_name=jmagick-users for discussion. 2009-11-10 Jacob Nordfalk - JMagick 6.5.7 * Memory leak bug fixed. Affected code is Java_magick_DrawInfo_setGeometry, Java_magick_DrawInfo_setFont, Java_magick_ImageInfo_setServerName, Java_magick_ImageInfo_setFont, Java_magick_ImageInfo_setSize, Java_magick_ImageInfo_setTile, Java_magick_ImageInfo_setDensity, Java_magick_ImageInfo_setPage, Java_magick_ImageInfo_setTexture, Java_magick_ImageInfo_setView, Java_magick_MontageInfo_setGeometry, Java_magick_MontageInfo_setTile, Java_magick_MontageInfo_setTitle, Java_magick_MontageInfo_setFrame, Java_magick_MontageInfo_setTexture, Java_magick_MontageInfo_setFont, 2009-11-09 Jacob Nordfalk * Added new entries to CompositeOperator CompressionType ExceptionType QuantumTypes InterlaceType NoiseType which has been added from ImageMagick-6.5.7-6 to 6.4.1-2. all entries are backwards compatible, i.e. no old values have changed 2008-12-?? * Added setAntialias() and getAntialias() (contrib from ???? - check mailing list) 2008-08-05 * Added setImageOption() (contrib from Scott Knight at Specialized Business Software) 2008-07-01 Jacob Nordfalk - JMagick 6.4.0 * look for include files in both ${MPATH}/include/magick/api.h (old IM way) and ${MPATH}/include/ImageMagick/magick/api.h (IM 6.3.8.something and later) * Test run on Q16 (16 bits per pixed) 2008-05-22 Jacob Nordfalk * Small updates of javadoc 2008-??-?? Jacob Nordfalk * Added a test suite 2007-02-27 Jacob Nordfalk * Added methods setImageProfile and getImageProfile * Deprecated old and only partly working profile methods * Introduced package magicktest.BETA for test cases not yet finished 2007-02-25 Andy Lewis * Updated ExceptionType and GeometryFlags to reflect IM changes in 6.3.9 * This makes JM incompatible ImageMagick versions before 6.3.9 2007-02-26 Jacob Nordfalk * Renamed test classes and polished the tests * Updated Win32 Makefile.all for Visual Studio 8. 2007-02-25 Andy Lewis * Updated CompositeOperator to reflect IM changes made to composite.h since 6.2.9 (added public static final int DivideCompositeOp = 55;) * Added methods blurImageChannel() and trimImage() 2007-02-22 Jacob Nordfalk * First version on SourceForge.net * Renamed package test to magicktest and moved utility class MagickWindow to magick.util * configure.in now claims version is 6.3.8 2008-02-19 Eric O'Laughlen * A few tweaks to the output lib names to support version numbers and symlinks. For example, it outputs libJMagick-6.2.6.dylib and a link called libJMagick.dylib (.so's on Linux). An option to the configure.in offers an arg --with-shared-lib-ext=.dylib. 2007-11-26 Jacob Nordfalk * The ImageMagick engine wasnt initialized from JMagick! Fixed. Now setting environment variables also work, like: MAGICK_DEBUG=Resource (IM debugging) MAGICK_MEMORY_LIMIT=100 (limit mem use to 100MB) (see http://www.imagemagick.org/script/resources.php#environment) 2007-06-26 Ian Michell * Removed obj/magick from version control. We do not want objects inside. * Changed all RelinquishMemory casts to void* (this needs some testing) * Reverted RelinquishMemory casts back to void** <- should have thought about it haha * Fixed compile error in magick_MagickImage.c at line 3390 onwards: Please compile code before committing. * Renamed RelinquishMemory to RelinquishMagickMemory.... I am so sure it was RelinquishMemory in the docs.... OH WELL! 2007-06-26 Jacob Nordfalk * Update broken setColorProfile() and setIptcProfile() so they dont use deprecated IM557 color_profile and iptc_profile members. (reference http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=9063); 2007-06-20 Ian Michell * Replace deprecated LiberateMemory with RelinquishMemory to avoid crash (reference http://www.yeo.id.au/mailman/private/jmagick/2007-June/002591.html); 2007-xx-xx Jacob Nordfalk * Updated ColorspaceType to reflect that IM had changed values ---- OLD RELEASE FILE ---- JMagick 6.2.6-0 ~~~~~~~~~~~~~~~ Update to work with ImageMagick 6.2.6. Added MagickImage.setDepth, ImageInfo.getDepth, ImageInfo.setDepth. Contributed by harikrishna grandhi: Added MagickImage.setRenderingIntent and MagickImage.getRenderingIntent. JMagick 6.2.4-1 ~~~~~~~~~~~~~~~ Updated libtool. Fixed issue associated with autoconf. JMagick 6.2.4-0 ~~~~~~~~~~~~~~~ Fixed problems with retrieving Rectanage values. Updated to ImageMagick 6.2.4. Fixed up problems with overriding LDFLAGS. Fixed up build issues with Fedore Core 4. Added method MagickImage#getQuality. JMagick 6.0.4-0 ~~~~~~~~~~~~~~~ Fixed a number of constants that have gone out of sync with ImageMagick. Ensure that the build works with ImageMagick 6.0.4. JMagick 5.5.7-0 ~~~~~~~~~~~~~~~ Fixed a problem when the String is based on LATIN-1 rather than Unicode. Incorporated patch from Neeme Praks that adds declaration to setIntField to jmagick.h, remved an unused variable and correct a type cast. Added new parameter --with-javadoc-dir to configure for the Javadoc destination directory. JMagick 5.5.6-0 ~~~~~~~~~~~~~~~ Configure against ImageMagick 5.5.6. Fixed in problem that surfaced in 5.5.6 where by MagickImage.imageToBlob did not retrieve the ImageInfo properly. JMagick 5.5.1-0 ~~~~~~~~~~~~~~~ MagickImage.pingImage contributed by Susan Dorr. Mike Edmonds contributed the methods addNoiseImage, blurImage, charcoalImage, edgeImage, embossImage, enhanceImage, gaussianBlurImage, implodeImage, medianFilterImage, oilPaintImage, reduceNoiseImage, segmentImage, solarizeImage, spreadImage, swirlImage, unsharpMaskImage, waveImage JMagick 5.4.9-0 ~~~~~~~~~~~~~~~ Removed MagickImage.compressColormap because corresponding function was removed from ImageMagick. JMagick 5.4.8-0 ~~~~~~~~~~~~~~~ Clean up header. Added new include files as required by magick/api.h. Change the ping attribute type to boolean. JMagick 5.4.7-0 ~~~~~~~~~~~~~~~ Always set encoding in DrawInfo to "Unicode" since Java only gives us UTF-8. Replace all memory management routes with AcquireMemory, LiberateMemory, and AcquireString. Add contributed code for MagickInfo. The class loader is now the default class loader. Set the Java environment "jmagick.systemclassloader=yes", to change to the system class loader. This affect how the shared library is loaded. Implemented MagickIMage.SignatureImage. JMagick 5.4.6-0 ~~~~~~~~~~~~~~~~~ Added the method MagickImage.setCompression. Added the method MagickImage.signatureImage. Changed C comments delimiter from // to /* */. Added LosslessJPEGCompression to CompressionType. Fixed javadoc rule bug in Makefile. Fixed Make.rules. Missing semi-colon in rules for non-gcc compilers. Included sys/types.h before magick/api.h. Caused problems with Solaris. There appears to be a change in behaviour for Magick-config. It no longer provide the include path to the ImageMagick include directory. A workaround is provided in configure. JMagick 5.4.5-0 ~~~~~~~~~~~~~~~~~ Changes to support ImageMagick 5.4.5. JMagick no longer require ImageMagick to be compiled for shared library. Added DESTDIR variable to the Makefiles for packaging purposes. Added MagickImage.setBorderColor, MagickImage.getBorderColor Added ImageInfo.setBorderColor, ImageInfo.getBorderColor Added MagickImage.setDelay, MagickImage.getDelay Added MagickImage.setDispose, MagickImage.getDispose Added MagickImage.setIterations, MagickImage.getIterations Added MagickImage.getColors Added MagickImage.getTotalColors Added MagickImage.getColormap methods Added support for the Resin server - get the system class loader to load JMagick shared library. Removed DrawInfo.setBox, DrawInfo.getBox Added DrawInfo.setUnderColor, DrawInfo.getUnderColor Mixed fixes to remove some warnings. JMagick 5.4.3-1 ~~~~~~~~~~~~~~~ Fixed a bug in setIntFieldValue so that this function now returns status. JMagick 5.4.3-0 ~~~~~~~~~~~~~~~ Change MagickImage.profileImage to support ImageMagick 5.4.3. Updated ImageType.java. Added MagickImage.getCompression and MagickImage.getImageType. Changed configure.in so to include JMagick version numbers. Modified various constants in interfaces so that they are final static. JMagick 5.4.2-1 ~~~~~~~~~~~~~~~ Fixed bug in MagickImage.transformImage that causes deallocated image to be accessed. Remove AnnotateInfo.java and magick_AnnoateInfo.c from the distribution. JMagick 5.4.2-0 ~~~~~~~~~~~~~~~ Removed set/getCompose method in MontageInfo as it is no longer supported by ImageMagick-5.4.2. More Mac OS X patches. Added Makefile for windows. JMagick 5.4.1-2 ~~~~~~~~~~~~~~~ Added method Magick.parseImageGeometry. Added method MagickImage.levelImage. Added method MagickImage.sizeBlob. Rename MagickImage.setImageFormat to MagickImage.setMagick and MagickImage.getImageFormat to MagickImage.getMagick. Added MagickImage.setImageFormat and MagickImage.getImageFormat for compatibility. Fixed a bug in MagickImage.profileImage. Upgraded to libtool 1.4.2. Added patches to support Mac OS X. JMagick 5.4.1-1 ~~~~~~~~~~~~~~~ Fixed a bug in MagickImage.matteFloodfillImage. Added MagickImage.colorFloodfillImage. Added get/set method for the tile member of DrawInfo. As for this release, only JDK 1.2 and above are supported. Upgraded libtool to 1.4. Added patches to support Mac OS X. JMagick 5.4.1-0 ~~~~~~~~~~~~~~~ Replace all DestroyImage with DestroyImages so that image sequences gets deallocated properly. Verified to work with ImageMagick 5.4.1. JMagick 5.4.0-1 ~~~~~~~~~~~~~~~ Added methods to manipulate color, IPTC and generic profiles. Added new constructor for MagickImage to create image sequence. Added MonatageInfo class and support MontageImages method. Added AverageImages method. JMagick 5.4.0 ~~~~~~~~~~~~~ Adapted to support ImageMagick 5.4.0 JMagick 5.3.3-0 ~~~~~~~~~~~~~~~ Added a new parameter to MagickImage.transparentImage as per changes in ImageMagick 5.3.3. Make MagickImage.destroyImage public. This is so that the programmer may explicitly remove resources attributed to the image rather than waiting for the garbage collector to act. JMagick 5.2.9-0 ~~~~~~~~~~~~~~~ The use of libtool was incorrect. It is now generated for each platform. Fix in various places so that ImageMagick 5.2.9 gets supported. JMagick 5.2.7-1 ~~~~~~~~~~~~~~~ Changes to use libtool for link and compiling. Patch to break a list of images into an array. Sent in by Ian Burrell . Bug fix by Ian Burrell in MagickImage.imageToBlob. JMagick 5.2.7-0 ~~~~~~~~~~~~~~~ Removed AnnotateInfo from the list of files to make. Added more set and get methods in DrawInfo as DrawInfo now takes the role of AnnotateInfo in previous releases of ImageMagick. JMagick 5.2.6-1 ~~~~~~~~~~~~~~~ Fixed MagickImage.transformImage so that parameters may be NULL. Fixed jmagick.c so that the signature for the constructor of MagickApiException is correct. Fixed magick_MagickImage.c so that exception to ImageToBlob throws a MagickApiException. Bugs reported and patched by Ian Burrell . JMagick 5.2.6-0 ~~~~~~~~~~~~~~~ Removed some method so that it would compile for ImageMagick 5.2.6. JMagick 5.2.4-1 ~~~~~~~~~~~~~~~ Added access methods to the units attribute for MagickImage and ImageInfo. Added setXResolution, getXResolution, setYResolution and getYResolution methods in MagickImage. JMagick 5.2.4-0 ~~~~~~~~~~~~~~~ Some changes to support ImageMagick 5.2.4. Added methods MagickImage.blobToImage and MagickImage.imageToBlob. JMagick 5.2.3-0 ~~~~~~~~~~~~~~~ Added support for ImageMagick 5.2.3. Changes in SharpenImage function and AnnotateInfo structure. Added Javadoc generation: "make javadoc". Added some support for FreeBSD. Added MagickImage.scaleImage() to Loop.java. JMagick 5.2.1-1 ~~~~~~~~~~~~~~~ Added new functions: MagickImage.despeckleImage, MagickImage.convolveImage, MagickImage.getDepth, MagickImage.getStorageClass, MagickImage.setImageAttribute, MagickImage.getImageAttribute. Added new class Magick and make every other class inherit from it. This way, Magick can load the shared library on demand. JMagick 5.2.1-0 ~~~~~~~~~~~~~~~ Initial release of JMagick for ImageMagick 5.2.1. Too many changes to list but suffice to say that the ImageMagick API has significantly changed since 5.1.1. JMagick 5.1.1-6 ~~~~~~~~~~~~~~~ Added MagickImage.shearImage, MagickImage.rotateImage and MagickImage.sharpenImage. Added QuantizeInfo class and MagickImage.quantizeImage. Deprecated MagickImage.setGrayscale. Added lddcheck target in src/test to check library dependencies. techblue-jmagick-b4412af/Dockerfile000066400000000000000000000006301452765401600173200ustar00rootroot00000000000000FROM dpokidov/imagemagick:7.1.1-10-ubuntu RUN apt-get update -y RUN apt-get install -y autoconf automake libtool build-essential pkg-config openjdk-11-jdk COPY . . RUN touch NEWS AUTHORS ChangeLog RUN autoreconf --force --install RUN automake --add-missing RUN ./configure --with-java-home=/usr/lib/jvm/java-11-openjdk-amd64 RUN make # override "dpokidov/imagemagick" default entrypoint ENTRYPOINT [""] techblue-jmagick-b4412af/INSTALL000066400000000000000000000057751452765401600163760ustar00rootroot00000000000000INSTALL NOTES ~~~~~~~~~~~~~ 0. Prequisite. - GNU Autoconf (not strictly required) - The JMagick build scripts makes very extensive use of GNU Make 3.77. - A ANSI C compiler. The GNU or EGCS compiler is recommended. - ImageMagick developers libraries (libmagick-dev) See in Changelog.txt which version is supported - ImageMagick dependencies NOTE: If you compile IM yourself, remember to f.ex. install libtiff-dev to get TIFF support. On Ubuntu Linux 9.10, this commant would install TIFF and CMS support: > sudo apt-get install liblcms-dev libtiff4-dev libbz2-dev remember to install these _before_ you issue the ./configure command for ImageMagick - A Java2 JDK. JMagick was developed with Sun JDK 1.4.1. 1. Unpack the JMagick tar file. > tar xvfz JMagick-5.5.7-X.tar.gz 2. Make the JMagick distribution directory current. > cd JMagick-5.5.7-X 3. Not strictly required, but you might want to run autoconf: > autoconf 4. Make sure that java, javac, jar, gcc are in your path. Run the configuration script. > ./configure The configuration script has the following options: --prefix= The root path where the installation goes. For example, to install the libraries into /usr/local/jmagick/lib, use --prefix=/usr/local/jmagick --with-magick-home= Use this if your have ImageMagick install in non-standard places. E.g. ./configure --with-magick-home=/usr/local/ImageMagick --with-java-home= Use this to specify where your JDK is installed. This is NOT necessary if you have the JAVA_HOME environment set. E.g. ./configure --with-java-home=/usr/local/java --with-java-includes= Use this to specify a Java include directory. --with-jikes If you wish to use the IBM Jikes compiler instead --enable-diagnostic If you want verbose messages. Only a few messages are available at the moment. --with-javadoc-dir= To specify a directory path for the javadoc. For example: > ./configure --prefix=/usr/local --with-java-home=/usr/local/jdk1.4 --enable-diagnostic 5. Then make everything. > make all 6. To install the binaries run: > make install 7. To use JMagick, libJMagick.so must be in a directory where the runtime loader can find it or you must set the environment variable LD_LIBRARY_PATH. jmagick.jar must be in your Java class path. 8. Examples and some simple tests can be found in test/magicktest. Simply: > make simpletest For a more rigorous JUnit test, make sure to copy/link junit.jar to lib/ and run: > make test 9. To generate Javadoc documentation in HTML, run: > make javadoc 10. Enjoy. Subscribe to the mailing list for help and bug reports. NOTES ~~~~~ 1. If you pulled the source from the SVN server, the make might failed the first time you run it because GNU Make fails inference rules when directories are not created yet. Try running make after the failure. techblue-jmagick-b4412af/LICENSE000066400000000000000000000634761452765401600163540ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! techblue-jmagick-b4412af/Make.def.in000066400000000000000000000027151452765401600172760ustar00rootroot00000000000000# # Some macro definitions. # # Versions MAJOR = @VER_MAJOR@ MINOR = @VER_MINOR@ MICRO = @VER_MICRO@ JMSUB = @VER_JMSUB@ # Where the target installation directory is prefix = @prefix@ exec_prefix = @exec_prefix@ libdir = @libdir@ # Install program INSTALL = @INSTALL@ # libtool link mode flag LIBTOOL_LINK_FLAG = @LIBTOOL_LINK_FLAG@ JFLAGS = @JFLAGS@ CFLAGS = @C_DEBUG@ @CFLAGS@ LDFLAGS = @LDFLAGS@ EXTRA_LIBS = @LIBS@ SHARED_LDFLAGS = @SHARED_LDFLAGS@ # The C compiler to use CC = @CC@ # The Java interpreter to use JAVA = @JAVA@ # The Java compiler to use. JAVAC = @JAVAC@ # The Java header file generator. # If Java major version >= 9, use `javac` else `javah`. JAVAH = @JAVAH@ # javah command was superseded by "javac -h" in jdk9. # If Java major version >= 9, use `javac -h` else `javah -d`. JAVAH_OPT = @JAVAH_OPT@ # The Java archive maintainer JAR = @JAR@ # The Javadoc generator. JAVADOC = @JAVADOC@ # Where to generate the javadoc JAVADOC_DIR = @JAVADOC_DIR@ # Class path seperator. Platform dependent. CLASSSEP = @CLASSSEP@ # This is the base project directory. PROJ_BASE_DIR = $(subst //,/,@PROJ_BASE_DIR@/) # X11 directories X11_INCLUDES = @X11_INCLUDES@ X11_LIBS = @X11_LIBS@ # ImageMagick directories MAGICK_INCLUDES = @MAGICK_INCLUDES@ MAGICK_LIBS = @MAGICK_LIBS@ MAGICK_LIB_PATH = @MAGICK_LIB_PATH@ # Java include directories JAVA_INCLUDES = @JAVA_INCLUDES@ # Shared library extension SHARED_LIB_EXT = @SHARED_LIB_EXT@ # osx or not DARWIN = @DARWIN@techblue-jmagick-b4412af/Make.rules000066400000000000000000000247771452765401600173010ustar00rootroot00000000000000# Copyright (C) 1999 Eric Yeo. All rights reserved. # Fix obscure libtool issue ifdef CYGPATH export echo=echo endif # This is the main Java sources. ifndef JAVA_SRC_DIR JAVA_SRC_DIR = $(PROJ_BASE_DIR)src endif # This is where the Java classes are compiled to. ifndef JAVA_CLASSES_DIR JAVA_CLASSES_DIR = $(PROJ_BASE_DIR)classes endif # This is where generated files should go ifndef GENERATED_DIR GENERATED_DIR = $(PROJ_BASE_DIR)generated endif # This is where C object files should go ifndef OBJ_DIR OBJ_DIR = $(PROJ_BASE_DIR)obj endif # This is where the library files should go ifndef LIB_DIR LIB_DIR = $(PROJ_BASE_DIR)lib endif # This is where we generate javadoc files to ifndef JAVADOC_DIR JAVADOC_DIR = $(prefix)/doc/javadoc endif # Defines the Java compiler if one is not defined ifndef JAVAC JAVAC = javac endif # Define the Java header generator ifndef JAVAH JAVAH = javah endif # Define where libtool is ifndef LIBTOOL top_builddir = $(PROJ_BASE_DIR) LIBTOOL = /bin/bash $(PROJ_BASE_DIR)libtool endif # We have to work out the which package we are in CURRENT_DIR = $(shell pwd) JAVA_PACKAGE_REL_PATH = $(subst $(JAVA_SRC_DIR)/,,$(CURRENT_DIR)) JAVA_PACKAGE = $(subst /,.,$(JAVA_PACKAGE_REL_PATH)) JAVA_PACKAGE_DIR = $(JAVA_CLASSES_DIR)/$(JAVA_PACKAGE_REL_PATH) PACKAGE_GENERATED_INPUT_DIR = $(GENERATED_DIR)/$(JAVA_PACKAGE_REL_PATH) PACKAGE_OBJ_DIR = $(OBJ_DIR)/$(JAVA_PACKAGE_REL_PATH) # Workout if we need the class path from the environment ifdef CLASSPATH TRAILING_CLASSPATH = $(CLASSSEP)$(CLASSPATH) else TRAILING_CLASSPATH = endif ifdef CYGPATH JAVA_SRC_PATH = "$(shell cygpath -C UTF8 -s -w "$(JAVA_SRC_DIR)")" JAVA_CLASSES_PATH = "$(shell cygpath -C UTF8 -s -w "$(JAVA_CLASSES_DIR)")" PACKAGE_GENERATED_OUTPUT_DIR = "$(shell cygpath -C UTF8 -s -w "$(PACKAGE_GENERATED_INPUT_DIR)")" JAVA_CLASS_PATH = "$(shell cygpath -c UTF8 -s -w "$(JAVA_CLASSES_DIR)")$(TRAILING_CLASSPATH)" else JAVA_SRC_PATH = "$(JAVA_SRC_DIR)" JAVA_CLASSES_PATH = "$(JAVA_CLASSES_DIR)" PACKAGE_GENERATED_OUTPUT_DIR = "$(PACKAGE_GENERATED_INPUT_DIR)" JAVA_CLASS_PATH = "$(JAVA_CLASSES_DIR)$(TRAILING_CLASSPATH)" endif # The rule to make class files from java files. $(JAVA_PACKAGE_DIR)/%.class: %.java @-mkdir -p $(dir $@) $(JAVAC) $(JFLAGS) -d $(JAVA_CLASSES_PATH) \ -sourcepath $(JAVA_SRC_PATH) \ -classpath $(JAVA_CLASS_PATH) $< # Default make rule. default-target: java_classes_target lib_target dir_target # If the SRC_FILES are not defined, we use all .java files ifndef JAVA_SRC_FILES JAVA_SRC_FILES = $(wildcard *.java) endif # Work out the corresponding .class file we need to make JAVA_CLASSES := $(foreach i,$(JAVA_SRC_FILES),$(JAVA_PACKAGE_DIR)/$(subst .java,.class,$i)) java_classes_target: $(JAVA_CLASSES) ifdef JNI_LIB_NAME # If JNI_LIB_NAME is specified, that indicates to the rules that # we want a shared library generated. ifdef CYGPATH JNI_LIB = $(LIB_DIR)/lib$(JNI_LIB_NAME)-$(MAJOR).$(MINOR).$(MICRO)$(SHARED_LIB_EXT) else JNI_LIB = $(LIB_DIR)/lib$(JNI_LIB_NAME)-$(MAJOR).$(MINOR).$(MICRO).la endif # The Makefile should specify JNI_SRC_FILES to indicate which # Java source files can be used to generate JNI headers. JNI_BASE_HEADERS = $(subst .java,.h,$(JNI_SRC_FILES)) JNI_HEADER_PREFIX = $(subst .,_,$(JAVA_PACKAGE_REL_PATH)) JNI_HEADERS = $(foreach f,$(JNI_BASE_HEADERS),$(PACKAGE_GENERATED_INPUT_DIR)/$(JNI_HEADER_PREFIX)_$(f)) JNI_CLASS_BASE_FILES = $(subst .java,.class,$(JNI_SRC_FILES)) JNI_CLASS_FILES = $(foreach f,$(JNI_CLASS_BASE_FILES),$(JAVA_PACKAGE_DIR)/$(f)) # Need to force these files to be made $(JNI_CLASS_FILES): # Work out where the object files should go. JNI_IMPL = $(foreach f,$(subst .h,.c,$(JNI_BASE_HEADERS)),$(JNI_HEADER_PREFIX)_$(f)) $(JNI_EXTRAS) JNI_BASE_OBJ = $(foreach f,$(subst .c,.lo,$(JNI_IMPL)),$(f)) JNI_OBJ = $(foreach f,$(JNI_BASE_OBJ),$(PACKAGE_OBJ_DIR)/$(f)) # This is used to compile the C sources that defines the native # methods. The Makefile must specify INCLUDES for the include file # path. CFLAGS += $(INCLUDES) # The rule to make JNI header files from java files. # Rule to make header files from java class files. # The originating java source must contain native method specifications. $(PACKAGE_GENERATED_INPUT_DIR)/$(JNI_HEADER_PREFIX)_%.h: $(JAVA_PACKAGE_DIR)/%.class @-rm -f $@ > /dev/null 2>&1 @-mkdir -p $(dir $@) ifeq ($(notdir $(JAVAH)),javah) "$(JAVAH)" $(JAVAH_OPT) $(PACKAGE_GENERATED_OUTPUT_DIR) \ -classpath $(JAVA_CLASS_PATH) $(JAVA_PACKAGE).$(subst .class,,$(notdir $<)) else "$(JAVAH)" $(JAVAH_OPT) $(PACKAGE_GENERATED_OUTPUT_DIR) \ -classpath $(JAVA_CLASS_PATH) $(subst .class,.java,$(notdir $<)) endif # Rule to compile JNI C files $(PACKAGE_OBJ_DIR)/%.lo: %.c $(PACKAGE_GENERATED_INPUT_DIR)/%.h @-mkdir -p $(dir $@) $(LIBTOOL) --mode=compile $(CC) -I$(PACKAGE_GENERATED_INPUT_DIR) $(CFLAGS) -c $< -o $@ $(PACKAGE_OBJ_DIR)/%.lo: %.c @-mkdir -p $(dir $@) $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $< -o $@ # Rule to generate autodependencies in the case where JNI is used. JNI_DEP_FILE = .jnidep $(JNI_DEP_FILE): $(JNI_HEADERS) $(JNI_IMPL) Makefile @case $(CC) in \ *gcc) \ echo Autogenerating C dependencies.; \ $(CC) -M $(CFLAGS) -I$(PACKAGE_GENERATED_INPUT_DIR) \ $(JNI_IMPL) > .jnidep.tmp; \ sed -e "s;\(.*\)\.o:;$(PACKAGE_OBJ_DIR)/\1.lo:;" \ < .jnidep.tmp > $@; \ rm .jnidep.tmp > /dev/null 2>&1; \ $(MAKE) $(MFLAGS) lib_target; \ ;; \ *) \ touch $(JNI_DEP_FILE); \ echo Unable to autogenerate C dependencies.; \ echo Run "make clean" if rebuilding.; \ ;; \ esac lib_target: $(JNI_DEP_FILE) $(JNI_LIB) # Build the JNI shared library $(JNI_LIB): $(JNI_OBJ) ifdef CYGPATH $(LIBTOOL) --mode=link $(CC) \ -dynamiclib \ -shared -XCClinker -shared \ $(LIBTOOL_LINK_FLAG) \ -version-info $(MAJOR):$(MINOR):$(MICRO) \ -rpath $(libdir) $(SHARED_LDFLAGS) $(LDFLAGS) \ -o $(JNI_LIB) \ $(JNI_OBJ) $(JNI_LINK_LIBS) $(EXTRA_LIBS) else $(LIBTOOL) --mode=link $(CC) \ -dynamiclib \ -shared \ $(LIBTOOL_LINK_FLAG) \ -version-info $(MAJOR):$(MINOR):$(MICRO) \ -rpath $(libdir) $(SHARED_LDFLAGS) $(LDFLAGS) \ -o $(JNI_LIB) \ $(JNI_OBJ) $(JNI_LINK_LIBS) $(EXTRA_LIBS) endif # Change install name shown by otool -L if tool available. @-mkdir -p "$(JAVA_CLASSES_DIR)/resources" @-cp $(PROJ_BASE_DIR)lib/.libs/lib$(JNI_LIB_NAME)-$(MAJOR).$(MINOR).$(MICRO)$(SHARED_LIB_EXT) "$(JAVA_CLASSES_DIR)/resources/lib$(JNI_LIB_NAME)$(SHARED_LIB_EXT)" @-ln -s $(PROJ_BASE_DIR)lib/.libs/lib$(JNI_LIB_NAME)-$(MAJOR).$(MINOR).$(MICRO)$(SHARED_LIB_EXT) $(PROJ_BASE_DIR)/lib/lib$(JNI_LIB_NAME)$(SHARED_LIB_EXT) @-ln -s $(PROJ_BASE_DIR)lib/jmagick-$(MAJOR).$(MINOR).$(MICRO).jar $(PROJ_BASE_DIR)/lib/jmagick.jar ifdef DARWIN # Mac OS X @-echo "Using install_name_tool..." @-/usr/bin/install_name_tool -id $(PROJ_BASE_DIR)lib/lib$(JNI_LIB_NAME)$(SHARED_LIB_EXT) $(PROJ_BASE_DIR)/lib/lib$(JNI_LIB_NAME)-$(MAJOR).$(MINOR).$(MICRO)$(SHARED_LIB_EXT) endif ## @-install_name_tool -id $(JNI_LIB) $(PROJ_BASE_DIR)/lib/lib$(JNI_LIB_NAME)-$(MAJOR).$(MINOR).$(MICRO)$(SHARED_LIB_EXT) ## # @-ln -s $(PROJ_BASE_DIR)lib/lib$(JNI_LIB_NAME)-$(MAJOR).$(MINOR).$(MICRO)$(SHARED_LIB_EXT) $(PROJ_BASE_DIR)/lib/lib$(JNI_LIB_NAME)$(SHARED_LIB_EXT) ## @-ln -s $(PROJ_BASE_DIR)lib/lib$(JNI_LIB_NAME)-$(MAJOR).$(MINOR).$(MICRO)$(SHARED_LIB_EXT) $(PROJ_BASE_DIR)/lib/lib$(JNI_LIB_NAME)$(SHARED_LIB_EXT) ## @-ln -s $(PROJ_BASE_DIR)lib/jmagick-$(MAJOR).$(MINOR).$(MICRO).jar $(PROJ_BASE_DIR)/lib/jmagick.jar ifndef CLEANING ifeq ($(wildcard $(JNI_DEP_FILE)), $(JNI_DEP_FILE)) include $(JNI_DEP_FILE) endif endif else lib_target: endif ifdef DIRS dir_target: @for d in $(DIRS); do \ if [ -f $$d/Makefile ]; then \ $(MAKE) -C $$d -w; \ else \ echo Ignoring $$d. No Makefile.;\ fi; \ done else dir_target: endif # List of files we want to remove CLEAN_LIST += $(JAVA_CLASSES) $(JNI_HEADERS) $(JNI_DEP_FILE) $(JNI_OBJ) ./lib/jmagick.jar CLEAN_NESTED_CLASSES := $(filter %.class,$(CLEAN_LIST)) CLEAN_NESTED_CLASSES := $(patsubst %.class,%$$*.class,$(CLEAN_NESTED_CLASSES)) CLEAN_NESTED_CLASSES := $(foreach i,$(CLEAN_NESTED_CLASSES),$(wildcard $i)) CLEAN_NESTED_CLASSES := $(subst $$,\$$,$(CLEAN_NESTED_CLASSES)) CLEAN_LIST += $(CLEAN_NESTED_CLASSES) CLEAN_LIST += $(subst .lo,.o,$(JNI_OBJ)) clean: @echo Cleaning `pwd` ... @-rm -rf $(CLEAN_LIST) > /dev/null 2>&1 ifdef JNI_LIB_NAME @-rm -f $(PROJ_BASE_DIR)/lib/lib$(JNI_LIB_NAME)$(SHARED_LIB_EXT) > /dev/null 2>&1 endif ## @-rm $(libdir)/lib ifdef DIRS @for d in $(DIRS); do \ if [ -f $$d/Makefile ]; then \ $(MAKE) -C $$d -w CLEANING=yes clean; \ else \ echo Ignoring $$d. No Makefile.; \ fi; \ done endif # For each directory install the necessary files install: extra-install @echo Installing `pwd` ... ifdef DIRS @for d in $(DIRS); do \ if [ -f $$d/Makefile ]; then \ $(MAKE) -C $$d -w install; \ else \ echo Ignoring $$d. No Makefile.; \ fi; \ done endif ifdef JNI_LIB_NAME ## @-ln -s $(libdir)/lib$(JNI_LIB_NAME)-$(MAJOR).$(MINOR).$(MICRO)$(SHARED_LIB_EXT) $(libdir)/lib$(JNI_LIB_NAME)$(SHARED_LIB_EXT) # Mac OS X ifdef DARWIN @-echo "Using install_name_tool..." @-/usr/bin/install_name_tool -id $(libdir)/lib$(JNI_LIB_NAME)$(SHARED_LIB_EXT) $(libdir)/lib$(JNI_LIB_NAME)-$(MAJOR).$(MINOR).$(MICRO)$(SHARED_LIB_EXT) endif @-pwddir=`pwd`;cd $(libdir); ln -fs ./lib$(JNI_LIB_NAME)-$(MAJOR).$(MINOR).$(MICRO)$(SHARED_LIB_EXT) ./lib$(JNI_LIB_NAME)$(SHARED_LIB_EXT);cd $(pwddir) endif #JNI_LIB_NAME extra-install:: techblue-jmagick-b4412af/Makefile.am000066400000000000000000000035511452765401600173670ustar00rootroot00000000000000# # Toplevel Makefile for JMagick. # # NOTE: Define DESTDIR if you are not installing JMagick # to its final directories. This is for the purpose # of packaging. # Contributed by Adam Heath # MAKE_PATH = . include $(MAKE_PATH)/Make.def DIRS = src if USE_CYGPATH JAR_FILE = "$(shell cygpath -C UTF8 -w "$(LIB_DIR)/jmagick-$(MAJOR).$(MINOR).$(MICRO).jar")" CLEAN_LIST = $(LIB_DIR)/jmagick-$(MAJOR).$(MINOR).$(MICRO).jar JAVADOC_DEST = "$(shell cygpath -C UTF8 -s -w "$(DEST)$(JAVADOC_DIR)")" JAVADOC_SRC = "$(shell cygpath -C UTF8 -s -w "$(JAVA_SRC_DIR)")" else JAR_FILE = $(LIB_DIR)/jmagick-$(MAJOR).$(MINOR).$(MICRO).jar CLEAN_LIST = $(JAR_FILE) JAVADOC_DEST = $(DEST)$(JAVADOC_DIR) JAVADOC_SRC = $(JAVA_SRC_DIR) endif all: dir default-target cd classes; $(JAR) cvf $(JAR_FILE) magick resources include $(MAKE_PATH)/Make.rules dir: @-mkdir -p $(PROJ_BASE_DIR)classes @-mkdir -p $(PROJ_BASE_DIR)obj @-mkdir -p $(PROJ_BASE_DIR)generated @-mkdir -p $(PROJ_BASE_DIR)lib distclean: clean @-rm Make.def config.cache config.log config.status @-rm -rf $(JAVADOC_DIR) @-rm -rf classes @-rm -rf autom4te.cache javadoc: @-if [ -x "$(JAVADOC)" ]; then \ echo Generating Javadoc files ... ; \ $(INSTALL) -d $(DESTDIR)$(JAVADOC_DIR) ; \ "$(JAVADOC)" -author -version -d $(JAVADOC_DEST) \ -sourcepath $(JAVADOC_SRC) magick magick.util ; \ else \ echo Unable to generate javadoc; \ fi extra-install:: $(INSTALL) -d $(DESTDIR)$(libdir) $(INSTALL) $(JAR_FILE) $(DESTDIR)$(libdir) simpletest:: cd test/magicktest; make simpletest test:: cd test/magicktest; CLASSPATH=../../lib/junit.jar make test looptest:: cd test/magicktest; CLASSPATH=../../lib/junit.jar make looptest generateCorrect:: cd test/magicktest; CLASSPATH=../../lib/junit.jar make generateCorrect techblue-jmagick-b4412af/README000066400000000000000000000026271452765401600162160ustar00rootroot00000000000000Copyright (C) 1998-2002 Eric Yeo. All rights reserved. As of 2008 maintained by Jacob Nordfalk This software has a LGPL license. Please see the file LICENSE for details. DEVELOPMENT ENVIRONMENT ~~~~~~~~~~~~~~~~~~~~~~~ JMagick is developed and tested under Ubuntu Linux with OpenJDK 1.7. It has not been tested on any other operating systems. Please see top of Changelog.txt to see which which versions of ImageMagick is currently supported. BUILD WITH DOCKER ~~~~~~~~~~~~~~~~~~~~~~~ From source directory run: > docker build -t jmagick-builder . > docker run -v `pwd`:/src -v `pwd`/build-result:/build jmagick-builder GIT REPOSITORY ~~~~~~~~~~~~~~ The JMagick source is now hosted on GitHub, although the mailing list still lives on SourceForge. Source can be obtained by running > git clone git@github.com:techblue/jmagick.git WEB SITES ~~~~~~~~~ Information on JMagick can be found at: https://github.com/techblue/jmagick https://sourceforge.net/projects/jmagick/ https://sourceforge.net/p/jmagick/wiki/Home/ MAILING LIST ~~~~~~~~~~~~ The JMagick mailing list is jmagick-users@lists.sourceforge.net. However, only list members are allowed to post to the mailing. To join the JMagick mailing list, please point your web brower at https://lists.sourceforge.net/lists/listinfo/jmagick-users Please make use of the mailing list for help and bug reports. Jacob Nordfalk 1 July 2008 Andrew Kerr 20 June 2014 techblue-jmagick-b4412af/configure.ac000066400000000000000000000355601452765401600176260ustar00rootroot00000000000000dnl Copyright (C) 1999-2005 Eric Yeo. All rights reserved. dnl This is the autoconf input file for Java Magick. AC_PREREQ(2.6.1) dnl The version number must change with every release AC_INIT([jmagick], [7.0.4]) AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET AM_INIT_AUTOMAKE([-Wno-portability]) VER_MAJOR=$(echo "$PACKAGE_VERSION" | cut -d . -f 1) VER_MINOR=$(echo "$PACKAGE_VERSION" | cut -d . -f 2) VER_MICRO=$(echo "$PACKAGE_VERSION" | cut -d . -f 3) VER_JMSUB="0" AC_SUBST(VER_MAJOR, ${VER_MAJOR}) AC_SUBST(VER_MINOR, ${VER_MINOR}) AC_SUBST(VER_MICRO, ${VER_MICRO}) AC_SUBST(VER_JMSUB, ${VER_JMSUB}) LIB=lib if test -x "/usr/lib64" ; then LIB=lib64 fi SHARED_LIB_EXT=.so DARWIN=false AM_CONDITIONAL(USE_CYGPATH, false) dnl Need the -G flag on Solaris when creating shared libraries. case "$target" in *solaris*) SHARED_LDFLAGS="-G" ;; *freebsd*|*linux*) SHARED_LDFLAGS="-shared" ;; dnl Make sure we use -dynamiclib parameter for OS X Leopard *darwin9.*|*darwin10.*) SHARED_LDFLAGS="-dynamiclib" SHARED_LIB_EXT=.jnilib DARWIN=true ;; *darwin1.[0-2]) DARWIN=true ;; *darwin*) LIBTOOL_LINK_FLAG='-module' DARWIN=true ;; *-*-cygwin|*-*-mingw32) SHARED_LDFLAGS="-shared" SHARED_LIB_EXT=.dll JFLAGS="-Xlint:deprecation -Xlint:unchecked" AM_CONDITIONAL(USE_CYGPATH, true) JAVA_HOME=$(cygpath -C UTF8 "$(cygpath -C UTF8 -d "${JAVA_HOME}")") MAGICK_HOME=$(cygpath -C UTF-8 "$(cygpath -C UTF-8 -d "$(dirname "$(which convert)")")") ;; esac AC_SUBST(DARWIN) dnl By default, we look at /usr/local. Need to explicitly do this because dnl some compilers don't. LDFLAGS="${LDFLAGS} -L/usr/local/${LIB}" CFLAGS="${CFLAGS} -I/usr/local/include" dnl Get the full path of the source directory. PROJ_BASE_DIR=`cd ${srcdir} && pwd` AC_SUBST(PROJ_BASE_DIR) dnl Determine if we have gcc AC_PROG_CC if test -z "${CC}"; then AC_MSG_ERROR('No suitable C compiler found') fi if test "${GCC}" != yes; then AC_MSG_WARN('You don't have the GNU GCC. Should\'t you be using one?') fi AC_SUBST(CC) dnl Determine how to run the preprocessor AC_PROG_CPP dnl Check for install program AC_PROG_INSTALL dnl Check for large file support. This test was taken from ImageMagick. dnl If this step is removed, there will be a mismatch of structures in dnl the ImageMagick headers. AC_SYS_LARGEFILE dnl Determine the X11 install paths. We don't really need this dnl if we are using shared libraries. AC_PATH_X if (test -n "${x_includes}"); then X11_INCLUDES=-I${x_includes} fi if (test -n "${x_libraries}"); then X11_LIBS=-L${x_libraries} fi dnl Determine the OS we are running on and set the class path dnl separator accordingly. case ${build_os} in *-*-cygwin|*-*-mingw32) CLASSSEP=; ;; *) CLASSSEP=: esac AC_SUBST(CLASSSEP) dnl Determine if we have a decent Java distribution AC_ARG_WITH([java-home], AS_HELP_STRING([--with-java-home=PATH], [Java installation path]), [JAVA_HOME="${withval}"]) AC_ARG_WITH([java-includes], AS_HELP_STRING([--with-java-includes=PATH], [Java includes path]), [JAVA_INCLUDE_PATH="${withval}"]) if test -n "${JAVA_INCLUDE_PATH}" -a -d "${JAVA_INCLUDE_PATH}" ; then dnl Java include path supplied JAVA_INCLUDES=-I${JAVA_INCLUDE_PATH} elif test -d "${JAVA_HOME}/include" ; then JAVA_INCLUDES=-I${JAVA_HOME}/include dnl The Blackdown JDK seems to have genunix. if test -d "${JAVA_HOME}/include/genunix" ; then JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/genunix" fi dnl The Sun Linux JDK seems to use linux if test -d "${JAVA_HOME}/include/linux" ; then JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/linux" fi dnl The Sun Solaris JDK seems to use solaris if test -d "${JAVA_HOME}/include/solaris" ; then JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/solaris" fi dnl The Sun FreeBSD JDK seems to use freebsd if test -d "${JAVA_HOME}/include/freebsd" ; then JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/freebsd" fi dnl The Sun Windows JDK seems to use win32 if test -d "${JAVA_HOME}/include/win32" ; then JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/win32" fi if test -d "${JAVA_HOME}/include/bsd" ; then JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/bsd" fi dnl Modern Oracle JDK on OS X if test -d "${JAVA_HOME}/include/darwin" ; then JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/darwin" fi dnl check for Mac OS X series of systems with old Apple JDKs elif test -d "${JAVA_HOME}/Headers" ; then JAVA_INCLUDES=-I${JAVA_HOME}/Headers else AC_MSG_ERROR('Unable to locate Java directories') fi dnl Determine if there is a shared library extension supplied AC_ARG_WITH([shared_lib_ext], AS_HELP_STRING([--with-shared-lib-ext], [Shared library file extension]), [SHARED_LIB_EXT="${withval}"], [SHARED_LIB_EXT="${SHARED_LIB_EXT}"]) dnl Determine if jni.h is available OLD_CPPFLAGS=${CPPFLAGS} CPPFLAGS="${JAVA_INCLUDES} ${CPPFLAGS}" AC_CHECK_HEADER(jni.h, HAVE_JNI_HEADER=yes, HAVE_JNI_HEADER=no) if test ${HAVE_JNI_HEADER} = no ; then AC_MSG_ERROR('Unable to locate jni.h') fi CPPFLAGS=${OLD_CPPFLAGS} dnl Determine where the Java interpreter is OLDPATH=${PATH} PATH=${JAVA_HOME}/bin:${PATH} export PATH AC_PATH_PROG(JAVA, java, not_found) if test ${JAVA} = not_found; then AC_MSG_ERROR('No Java interpreter found') fi AC_SUBST(JAVA) dnl Determine if we prefer to use Jikes. AC_ARG_WITH([jikes], AS_HELP_STRING([--with-jikes], [use the IBM Jikes compiler]), [PREFER_JIKES="yes"], [PREFER_JIKES="no"]) if test ${PREFER_JIKES} = yes; then dnl Determine if Jikes is available. AC_PATH_PROG(JIKES, jikes, not_found) if test ${JIKES} = not_found; then dnl Jikes not found, so we check for javac AC_PATH_PROG(JAVAC, javac, not_found) if test ${JAVAC} = not_found; then AC_MSG_ERROR('No Java compiler found') else AC_MSG_WARN('Jikes not found. Use javac.') fi else JAVAC=${JIKES} fi else dnl Determine if we have the Java compiler. AC_PATH_PROG(JAVAC, javac, not_found) if test ${JAVAC} = not_found; then AC_PATH_PROG(JIKES, jikes, not_found) if test ${JIKES} = not_found; then AC_MSG_ERROR('No Java compiler found') else JAVAC=${JIKES} fi fi fi AC_SUBST(JAVAC) dnl Determine if we have the Java header file generator dnl if Java major version >= 9, use `javac -h` instead of `javah -d` AC_SUBST([JAVA_MAJOR_VERSION], [$( ${JAVAC} -version 2>&1 | awk '{print $2}' | awk -F. '{print $1}' )]) if test $JAVA_MAJOR_VERSION -ge 9; then JAVAH="${JAVAC}" JAVAH_OPT="-h" else AC_PATH_PROG(JAVAH, javah, not_found) if test ${JAVAH} = not_found; then AC_MSG_ERROR('No Java header generator (javah) found') fi JAVAH_OPT="-d" fi AC_SUBST(JAVAH) AC_SUBST(JAVAH_OPT) dnl Determine if we have jar AC_PATH_PROG(JAR, jar, not_found) if test ${JAR} = not_found; then AC_MSG_ERROR('No jar found') fi AC_SUBST(JAR) dnl Determine if we have javadoc AC_PATH_PROG(JAVADOC, javadoc, ) AC_SUBST(JAVADOC) PATH=${OLDPATH} export PATH dnl Check if javadoc destination specified JAVADOC_DIR='${prefix}/share/doc/jmagick' AC_ARG_WITH([javadoc-dir], AS_HELP_STRING([--with-javadoc-dir=PATH], [where Javadoc is generated]), [JAVADOC_DIR="${withval}"], [JAVADOC_DIR="${withval}"]) AC_SUBST(JAVADOC_DIR) dnl Do you print extra diagnostic? AC_ARG_ENABLE([diagnostic], AS_HELP_STRING([--enable-diagnostic], [enable C diagnostic output (default off)]), [C_DEBUG=-DDIAGNOSTIC], [C_DEBUG=]) AC_SUBST(C_DEBUG) AC_ARG_WITH([magick-version], AS_HELP_STRING([--with-magick-version=VERSION], [ImageMagick version]), [MAGICK_VERSION="${withval}"]) if (test -n "$MAGICK_VERSION"); then VER_MAJOR=$(echo "$MAGICK_VERSION" | cut -d . -f 1) VER_MINOR=$(echo "$MAGICK_VERSION" | cut -d . -f 2) VER_MICRO=$(echo "$MAGICK_VERSION" | cut -d . -f 3) fi dnl Check if ImageMagick home specified AC_ARG_WITH([magick-home], AS_HELP_STRING([--with-magick-home=PATH], [home directory of ImageMagick]), [MAGICK_HOME="${withval}"]) for MPATH in ${MAGICK_HOME} /usr /usr/local /usr/local/ImageMagick /usr/local/ImageMagick-${VER_MAJOR}.${VER_MINOR}.${VER_MICRO} ; do # Location before IM 6.3.8.something if test -f "${MPATH}/include/magick/api.h" ; then MAGICK_LIB_PATH=${MPATH}/lib case "$target" in *-*-cygwin|*-*-mingw32) MAGICK_LIBS="-L${MPATH}/lib -lCORE_RL_wand_ -lCORE_RL_magick_" MAGICK_CHECK_LIBS="CORE_RL_wand_ CORE_RL_magick_" ;; *) MAGICK_LIBS="-L${MPATH}/lib -lWand -lMagick" MAGICK_CHECK_LIBS="Wand Magick" ;; esac MAGICK_INCLUDES=-I${MPATH}/include MAGICK_REALHOME=${MPATH} MAGICK_VERSION=6 fi # Location after IM 6.3.8.something if test -f "${MPATH}/include/ImageMagick/magick/api.h" ; then MAGICK_LIB_PATH=${MPATH}/lib case "$target" in *-*-cygwin|*-*-mingw32) MAGICK_LIBS="-L${MPATH}/lib -lCORE_RL_wand_ -lCORE_RL_magick_" MAGICK_CHECK_LIBS="CORE_RL_wand_ CORE_RL_magick_" ;; *) MAGICK_LIBS="-L${MPATH}/lib -lWand -lMagick" MAGICK_CHECK_LIBS="Wand Magick" ;; esac MAGICK_INCLUDES=-I${MPATH}/include/ImageMagick MAGICK_REALHOME=${MPATH} MAGICK_VERSION=6 fi # Location after Ubuntu 16.04 if test -f "${MPATH}/include/ImageMagick-6/magick/api.h" ; then MAGICK_LIB_PATH=${MPATH}/lib case "$target" in *-*-cygwin|*-*-mingw32) MAGICK_LIBS="-L${MPATH}/lib -lCORE_RL_wand_ -lCORE_RL_magick_" MAGICK_CHECK_LIBS="CORE_RL_wand_ CORE_RL_magick_" ;; *) MAGICK_LIBS="-L${MPATH}/lib -lWand -lMagick" MAGICK_CHECK_LIBS="Wand Magick" ;; esac MAGICK_INCLUDES=-I${MPATH}/include/ImageMagick-6 MAGICK_REALHOME=${MPATH} MAGICK_VERSION=6 fi # Location after IM 7.something if test -f "${MPATH}/include/MagickCore/MagickCore.h" ; then MAGICK_LIB_PATH=${MPATH}/lib case "$target" in *-*-cygwin|*-*-mingw32) MAGICK_LIBS="-L${MPATH}/lib -lCORE_RL_MagickWand_ -lCORE_RL_MagickCore_" MAGICK_CHECK_LIBS="CORE_RL_MagickWand_ CORE_RL_MagickCore_" ;; *) MAGICK_LIBS="-L${MPATH}/lib -lMagickWand -lMagickCore" MAGICK_CHECK_LIBS="MagickWand MagickCore" ;; esac MAGICK_INCLUDES=-I${MPATH}/include MAGICK_REALHOME=${MPATH} MAGICK_VERSION=7 fi # Location for some Linux distros if test -f "${MPATH}/include/ImageMagick-7/MagickCore/MagickCore.h" ; then MAGICK_LIB_PATH=${MPATH}/lib case "$target" in *-*-cygwin|*-*-mingw32) MAGICK_LIBS="-L${MPATH}/lib -lCORE_RL_MagickWand_ -lCORE_RL_MagickCore_" MAGICK_CHECK_LIBS="CORE_RL_MagickWand_ CORE_RL_MagickCore_" ;; *) MAGICK_LIBS="-L${MPATH}/lib -lMagickWand -lMagickCore" MAGICK_CHECK_LIBS="MagickWand MagickCore" ;; esac MAGICK_INCLUDES=-I${MPATH}/include/ImageMagick-7 MAGICK_REALHOME=${MPATH} MAGICK_VERSION=7 fi done dnl Check if MagickWand-conf exists OLDPATH=${PATH} # MagickWand-config isn't installed in /usr/bin in Ubuntu 16.04+ due # to changes in libmagickcore-dev package. AC_ARG_WITH([magickwand-config], AS_HELP_STRING([--with-magickwand-config=PATH], [path to magickwand-config tool]), [magickwand_config="$withval"], [magickwand_config=""]) if test -n "$magickwand_config"; then MAGICKCONF="$magickwand_config" else PATH=${MAGICK_REALHOME}/bin:/usr/${LIB}/${build_os}/ImageMagick-${VER_MAJOR}.${VER_MINOR}.${VER_MICRO}-Q64HDRI/bin:/usr/${LIB}/${build_os}/ImageMagick-${VER_MAJOR}.${VER_MINOR}.${VER_MICRO}-Q64/bin:/usr/${LIB}/${build_os}/ImageMagick-${VER_MAJOR}.${VER_MINOR}.${VER_MICRO}-Q32HDRI/bin:/usr/${LIB}/${build_os}/ImageMagick-${VER_MAJOR}.${VER_MINOR}.${VER_MICRO}-Q32/bin:/usr/${LIB}/${build_os}/ImageMagick-${VER_MAJOR}.${VER_MINOR}.${VER_MICRO}-Q16HDRI/bin:/usr/${LIB}/${build_os}/ImageMagick-${VER_MAJOR}.${VER_MINOR}.${VER_MICRO}-Q16/bin:/usr/${LIB}/${build_os}/ImageMagick-${VER_MAJOR}.${VER_MINOR}.${VER_MICRO}-Q8HDRI/bin:/usr/${LIB}/${build_os}/ImageMagick-${VER_MAJOR}.${VER_MINOR}.${VER_MICRO}-Q8/bin:/usr/${LIB}/${build_os}/ImageMagick-${VER_MAJOR}.${VER_MINOR}.${VER_MICRO}/bin:${PATH} export PATH AC_PATH_PROG(MAGICKCONF, MagickWand-config, not_found) PATH=${OLDPATH} export PATH fi dnl Added $MAGICK_LIB_PATH and $MAGICK_INCLUDES here because of dnl a possible bug in Magick-conf for ImageMagick 5.4.6 if (test $MAGICKCONF != not_found); then LDFLAGS="${LDFLAGS} `$MAGICKCONF --ldflags`" MAGICK_LIBS="`$MAGICKCONF --libs`" MAGICK_INCLUDES=`$MAGICKCONF --cppflags` MAGICK_LIB_PATH=`$MAGICKCONF --exec-prefix`/lib MAGICK_REALHOME=`$MAGICKCONF --exec-prefix` MAGICK_CHECK_LIBS=`$MAGICKCONF --libs | awk 'function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s } function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s } function trim(s) { return rtrim(ltrim(s)); } END { for (i = 1; i <= NF; i++) { if ( substr($i, 0, 2) != "-l") {$i=""} else {$i=substr($i,3)}} print trim($0)}'` MAGICK_VERSION=`$MAGICKCONF --version | cut -c1` fi dnl Check if ImageMagick library path specified AC_ARG_WITH([magick-lib-dir], AS_HELP_STRING([--with-magick-lib-dir=PATH], [library path of ImageMagick]), [MAGICK_LIB_PATH="${withval}"], [MAGICK_LIBS="-L${withval}"]) dnl Check if ImageMagick include path specified AC_ARG_WITH([magick-inc-dir], AS_HELP_STRING([--with-magick-inc-dir=PATH], [path include path of ImageMagick]), [MAGICK_INCLUDES="-I${withval}"]) if ( test -f "${MAGICK_INCLUDE_PATH}/magick/api.h" ) ; then MAGICK_INCLUDES=-I${MAGICK_INCLUDE_PATH} MAGICK_VERSION=6 fi if ( test -f "${MAGICK_INCLUDE_PATH}/MagickCore/MagickCore.h" ) ; then MAGICK_INCLUDES=-I${MAGICK_INCLUDE_PATH} MAGICK_VERSION=7 fi dnl Ensure proper includes in source files CFLAGS="${CFLAGS} -DIMAGEMAGICK_HEADER_STYLE_${MAGICK_VERSION}" dnl Check for the ImageMagick headers OLD_CPPFLAGS=${CPPFLAGS} if test -n "${MAGICK_INCLUDES}"; then CPPFLAGS="${MAGICK_INCLUDES} ${CPPFLAGS}" fi if test "${MAGICK_VERSION}" = 7 ; then MAGICK_CHECK_HEADERS="MagickWand/MagickWand.h MagickCore/MagickCore.h" elif test "${MAGICK_VERSION}" = 6 ; then MAGICK_CHECK_HEADERS="wand/magick-wand.h magick/api.h" fi for MHEADER in ${MAGICK_CHECK_HEADERS} ; do AC_CHECK_HEADER(${MHEADER}, HAVE_MAGICK_HEADER=yes, HAVE_MAGICK_HEADER=no) if test "${HAVE_MAGICK_HEADER}" = no ; then AC_MSG_ERROR('Unable to find ImageMagick header file: ${MHEADER}') fi done dnl Check for the ImageMagick libraries OLD_LDFLAGS=${LDFLAGS} if test -n "${MAGICK_LIBS}"; then LDFLAGS="${MAGICK_LIBS} ${LDFLAGS}" fi MAGICK_CHECK_LIB_FUNCTIONS="NewPixelWand ConstituteImage" MLIB_INDEX=1 for MLIB in ${MAGICK_CHECK_LIBS} ; do MLIBFUNCTION=`echo ${MAGICK_CHECK_LIB_FUNCTIONS} | awk "{print \\$$MLIB_INDEX}"` AC_CHECK_LIB(${MLIB}, ${MLIBFUNCTION}, HAVE_MAGICK_LIB=yes, HAVE_MAGICK_LIB=no) if test ${HAVE_MAGICK_LIB} = no; then AC_MSG_ERROR('Unable to find ImageMagick library: ${MLIB}') fi (( MLIB_INDEX++ )) done CPPFLAGS=${OLD_CPPFLAGS} LDFLAGS=${OLD_LDFLAGS} dnl Configure libtool AC_DISABLE_STATIC LT_INIT AC_SUBST(JAVA_INCLUDES) AC_SUBST(X11_LIBS) AC_SUBST(X11_INCLUDES) AC_SUBST(MAGICK_LIB_PATH) AC_SUBST(MAGICK_LIBS) AC_SUBST(MAGICK_INCLUDES) AC_SUBST(CFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(JFLAGS) AC_SUBST(LIBS) AC_SUBST(SHARED_LDFLAGS) AC_SUBST(LIBTOOL_LINK_FLAG) AC_SUBST(SHARED_LIB_EXT) AC_CONFIG_FILES([Makefile Make.def]) AC_OUTPUT techblue-jmagick-b4412af/docker/000077500000000000000000000000001452765401600165765ustar00rootroot00000000000000techblue-jmagick-b4412af/docker/build.sh000066400000000000000000000002011452765401600202220ustar00rootroot00000000000000#!/bin/bash autoreconf -vi ./configure --with-java-home=/usr/lib/jvm/java-1.7.0-openjdk-amd64 --prefix=/build make make install techblue-jmagick-b4412af/install-sh000077500000000000000000000357761452765401600173550ustar00rootroot00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: techblue-jmagick-b4412af/jmagick.spec000066400000000000000000000052061452765401600176130ustar00rootroot00000000000000# for ImageMagick versions < 6.4.5, use 'rpmbuild --with oldIM' %define oldIM 0 %{?_without_oldIM: %global oldIM 0} %{?_with_oldIM: %global oldIM 1} # for Java SDKs supplied directly from Sun, use 'rpmbuild --with sunjdk' %define sunjdk 0 %{?_without_sunjdk: %global sunjdk 0} %{?_with_sunjdk: %global sunjdk 1} # %define magick_home %(convert --version | sed -n -e '1s@^.*file:@@' -e 's@/doc/index.html.*$@@' -e 1p) # %define magick_home "/usr/lib64/ImageMagick-6.8.6/" %define magick_home %(pkg-config --cflags-only-I ImageMagick | sed 's/^-I//') Summary: open source Java interface of ImageMagick Name: jmagick # check configure.in, too ! Version: %(awk -F[\.] '{print $1"."$2"."$3}' <<< `rpm -q --queryformat '%{version}\n' ImageMagick`) Release: 6 License: GPL Group: Application/Java URL: www.ablesky.com Source0: jmagick-ferbar-git-src.tar.bz2 #Patch0: magickcoregenesis-error.patch #Patch1: jmagick-getTypeMetric-kerning-spacing.patch #Patch2: jmagick-setStringMethod-segv.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %if %{oldIM} BuildRequires: ImageMagick-devel %else BuildRequires: ImageMagick-devel >= %{version} Requires: ImageMagick >= %{version} %endif # # logic for java dependencies Requires: jre %if %{sunjdk} # good for Sun RPMs BuildRequires: jdk %else # good for JPackage, java-*-gcj-compat, java-*-openjdk BuildRequires: java-sdk %endif %description JMagick is an open source Java interface of ImageMagick. It is implemented in the form of a thin Java Native Interface (JNI) layer into the ImageMagick API. %prep %setup -q -n jmagick-ferbar-git %if %{oldIM} #%patch -p1 -b .mcgenesis %endif #%patch1 -p1 #%patch2 -p1 %build autoreconf --force --install automake --add-missing %{configure} --with-magick-home=%{magick_home} --with-magick-version=%{version} %{__make} %install make DESTDIR=%{buildroot} install %{__ln_s} libJMagick-%{version}.so %{buildroot}%{_libdir}/libJMagick.so %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc CREDITS Changelog.txt INSTALL %{_libdir}/* %changelog * Mon Dec 18 2017 Jonathan Horowitz - Switch autoconf to autoreconf and automake * Thu Jun 4 2009 John Morris - 6.4.0-3 - Try to compute magick_home macro automatically - Remove configure --jdk-home switch to grab JAVA_HOME from environment - add rpmbuild --with sunjdk switch to build against Sun-supplied RPMs * Wed Jun 3 2009 John Morris - 6.4.0-2 - add option '--with oldIM' and patch to build for ImageMagick pre-6.4.5 (undefined symbol: MagickCoreGenesis) - add libJMagick.so symlink * Mon Jun 1 2009 John Morris - 6.4.0-1 - Initial build techblue-jmagick-b4412af/src/000077500000000000000000000000001452765401600161165ustar00rootroot00000000000000techblue-jmagick-b4412af/src/Makefile000066400000000000000000000001351452765401600175550ustar00rootroot00000000000000MAKE_PATH = .. include $(MAKE_PATH)/Make.def DIRS = magick include $(MAKE_PATH)/Make.rules techblue-jmagick-b4412af/src/magick/000077500000000000000000000000001452765401600173515ustar00rootroot00000000000000techblue-jmagick-b4412af/src/magick/.gitignore000066400000000000000000000000121452765401600213320ustar00rootroot00000000000000/.jnidep techblue-jmagick-b4412af/src/magick/ClassType.java000066400000000000000000000006501452765401600221240ustar00rootroot00000000000000package magick; public interface ClassType { /* Important! Constant values should correspond to: http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/magick-type.h */ public final static int UndefinedClass = 0; /** DirectClass for true color images */ public final static int DirectClass = 1; /** PseudoClass for colormapped images. */ public final static int PseudoClass = 2; } techblue-jmagick-b4412af/src/magick/ColorspaceType.java000066400000000000000000000040251452765401600231510ustar00rootroot00000000000000package magick; public interface ColorspaceType { /* Important! Constant values should correspond to: http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/colorspace.h */ public final static int UndefinedColorspace = 0; public final static int CMYColorspace = 1; /* negated linear RGB colorspace */ public final static int CMYKColorspace = 2; /* CMY with Black separation */ public final static int GRAYColorspace = 3; /* Single Channel greyscale (linear) image */ public final static int HCLColorspace = 4; public final static int HCLpColorspace = 5; public final static int HSBColorspace = 6; public final static int HSIColorspace = 7; public final static int HSLColorspace = 8; public final static int HSVColorspace = 9; /* alias for HSB */ public final static int HWBColorspace = 10; public final static int LabColorspace = 11; public final static int LCHColorspace = 12; /* alias for LCHuv */ public final static int LCHabColorspace = 13; /* Cylindrical (Polar) Lab */ public final static int LCHuvColorspace = 14; /* Cylindrical (Polar) Luv */ public final static int LogColorspace = 15; public final static int LMSColorspace = 16; public final static int LuvColorspace = 17; public final static int OHTAColorspace = 18; public final static int Rec601YCbCrColorspace = 19; public final static int Rec709YCbCrColorspace = 20; public final static int RGBColorspace = 21; /* Linear RGB colorspace */ public final static int scRGBColorspace = 22; /* ??? */ public final static int sRGBColorspace = 23; /* Default: non-linear sRGB colorspace */ public final static int TransparentColorspace = 24; public final static int xyYColorspace = 25; public final static int XYZColorspace = 26; /* IEEE Color Reference colorspace */ public final static int YCbCrColorspace = 27; public final static int YCCColorspace = 28; public final static int YDbDrColorspace = 29; public final static int YIQColorspace = 30; public final static int YPbPrColorspace = 31; public final static int YUVColorspace = 32; } techblue-jmagick-b4412af/src/magick/CompositeOperator.java000066400000000000000000000073041452765401600236760ustar00rootroot00000000000000package magick; public interface CompositeOperator { /* Important! Constant values should correspond to: http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/composite.h */ public static final int UndefinedCompositeOp = 0; public static final int AlphaCompositeOp = 1; public static final int AtopCompositeOp = 2; public static final int BlendCompositeOp = 3; public static final int BlurCompositeOp = 4; public static final int BumpmapCompositeOp = 5; public static final int ChangeMaskCompositeOp = 6; public static final int ClearCompositeOp = 7; public static final int ColorBurnCompositeOp = 8; public static final int ColorDodgeCompositeOp = 9; public static final int ColorizeCompositeOp = 10; public static final int CopyBlackCompositeOp = 11; public static final int CopyBlueCompositeOp = 12; public static final int CopyCompositeOp = 13; public static final int CopyCyanCompositeOp = 14; public static final int CopyGreenCompositeOp = 15; public static final int CopyMagentaCompositeOp = 16; public static final int CopyAlphaCompositeOp = 17; public static final int CopyRedCompositeOp = 18; public static final int CopyYellowCompositeOp = 19; public static final int DarkenCompositeOp = 20; public static final int DarkenIntensityCompositeOp = 21; public static final int DifferenceCompositeOp = 22; public static final int DisplaceCompositeOp = 23; public static final int DissolveCompositeOp = 24; public static final int DistortCompositeOp = 25; public static final int DivideDstCompositeOp = 26; public static final int DivideSrcCompositeOp = 27; public static final int DstAtopCompositeOp = 28; public static final int DstCompositeOp = 29; public static final int DstInCompositeOp = 30; public static final int DstOutCompositeOp = 31; public static final int DstOverCompositeOp = 32; public static final int ExclusionCompositeOp = 33; public static final int HardLightCompositeOp = 34; public static final int HardMixCompositeOp = 35; public static final int HueCompositeOp = 36; public static final int InCompositeOp = 37; public static final int IntensityCompositeOp = 38; public static final int LightenCompositeOp = 39; public static final int LightenIntensityCompositeOp = 40; public static final int LinearBurnCompositeOp = 41; public static final int LinearDodgeCompositeOp = 42; public static final int LinearLightCompositeOp = 43; public static final int LuminizeCompositeOp = 44; public static final int MathematicsCompositeOp = 45; public static final int MinusDstCompositeOp = 46; public static final int MinusSrcCompositeOp = 47; public static final int ModulateCompositeOp = 48; public static final int ModulusAddCompositeOp = 49; public static final int ModulusSubtractCompositeOp = 50; public static final int MultiplyCompositeOp = 51; public static final int NoCompositeOp = 52; public static final int OutCompositeOp = 53; public static final int OverCompositeOp = 54; public static final int OverlayCompositeOp = 55; public static final int PegtopLightCompositeOp = 56; public static final int PinLightCompositeOp = 57; public static final int PlusCompositeOp = 58; public static final int ReplaceCompositeOp = 59; public static final int SaturateCompositeOp = 60; public static final int ScreenCompositeOp = 61; public static final int SoftLightCompositeOp = 62; public static final int SrcAtopCompositeOp = 63; public static final int SrcCompositeOp = 64; public static final int SrcInCompositeOp = 65; public static final int SrcOutCompositeOp = 66; public static final int SrcOverCompositeOp = 67; public static final int ThresholdCompositeOp = 68; public static final int VividLightCompositeOp = 69; public static final int XorCompositeOp = 70; } techblue-jmagick-b4412af/src/magick/CompressionType.java000066400000000000000000000025531452765401600233640ustar00rootroot00000000000000package magick; public interface CompressionType { /* Important! Constant values should correspond to: http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/compress.h */ public final static int UndefinedCompression = 0; public final static int B44ACompression = 1; public final static int B44Compression = 2; public final static int BZipCompression = 3; public final static int DXT1Compression = 4; public final static int DXT3Compression = 5; public final static int DXT5Compression = 6; public final static int FaxCompression = 7; public final static int Group4Compression = 8; public final static int JBIG1Compression = 9; /* ISO/IEC std 11544 / ITU-T rec T.82 */ public final static int JBIG2Compression = 10; /* ISO/IEC std 14492 / ITU-T rec T.88 */ public final static int JPEG2000Compression = 11; /* ISO/IEC std 15444-1 */ public final static int JPEGCompression = 12; public final static int LosslessJPEGCompression = 13; public final static int LZMACompression = 14; /* Lempel-Ziv-Markov chain algorithm */ public final static int LZWCompression = 15; public final static int NoCompression = 16; public final static int PizCompression = 17; public final static int Pxr24Compression = 18; public final static int RLECompression = 19; public final static int ZipCompression = 20; public final static int ZipSCompression = 21; } techblue-jmagick-b4412af/src/magick/DecorationType.java000066400000000000000000000010041452765401600231400ustar00rootroot00000000000000package magick; /** * Interface to contain definition for Image Magick's DecorationType. * Must always correspond to http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/draw.h * @author Eric Yeo */ public interface DecorationType { public final static int UndefinedDecoration = 0; public final static int NoDecoration = 1; public final static int UnderlineDecoration = 2; public final static int OverlineDecoration = 3; public final static int LineThroughDecoration = 4; } techblue-jmagick-b4412af/src/magick/DrawInfo.java000066400000000000000000000264651452765401600217420ustar00rootroot00000000000000/** * https://www.informatik.uni-hamburg.de/RZ/software/ImageMagick/www/api/types.html#DrawInfo */ package magick; /** * Encapsulation of the ImageMagick DrawInfo structure. * * @author Eric Yeo */ public class DrawInfo extends Magick { /** * DrawInfo handle. */ private long drawInfoHandle = 0; /** * Constructor. Create a DrawInfo structure from defaults in * the ImageInfo structure. * * @param imageInfo default values for DrawInfo this taken from this * * @throws MagickException if any error occurs */ public DrawInfo(ImageInfo imageInfo) throws MagickException { init(imageInfo); } /** * Initialises the DrawInfo structure by taking some default values * fromt the ImageInfo. * * @param imageInfo the ImageInfo from which some default values are taken * * @throws MagickException if any error occurs */ private native void init(ImageInfo imageInfo) throws MagickException; /** * If the garbabe collector removes us, we had better release * the memory we occupy. */ protected void finalize() { destroyDrawInfo(); } /** * Remove the storage associated with DrawInfo. */ private native void destroyDrawInfo(); /** * Set the primitive field in the DrawInfo. * * @param primitive value of the primitive field * * @throws MagickException if any error occurs */ public native void setPrimitive(String primitive) throws MagickException; /** * Get the primitive field in the DrawInfo. * * @return value of the primitive field. * * @throws MagickException if any error occurs */ public native String getPrimitive() throws MagickException; /** * Get the text field in the DrawInfo. * * @return value of the text field. * * @throws MagickException if any error occurs */ public native String getText() throws MagickException; /** * Set the text field in the DrawInfo. * * @param text value of the text field * * @throws MagickException if any error occurs */ public native void setText(String text) throws MagickException; /** * Get the geometry field in the DrawInfo. * * @return value of the geometry field. * * @throws MagickException if any error occurs */ public native String getGeometry() throws MagickException; /** * Set the geometry field in the DrawInfo. * * @param geometry value of the geometry field * * @throws MagickException if any error occurs */ public native void setGeometry(String geometry) throws MagickException; /** * Set the font field in the DrawInfo. * * @param font value of the font field * * @throws MagickException if any error occurs */ public native void setFont(String font) throws MagickException; /** * Get the font field in the DrawInfo. * * @return value of the font field. * * @throws MagickException if any error occurs */ public native String getFont() throws MagickException; /** * Set the stroke_antialias attribute in the DrawInfo handle. * * @param strokeAntialias whether antialiasing is enable * * @throws MagickException if any error occurs */ public native void setStrokeAntialias(boolean strokeAntialias) throws MagickException; /** * Return the stroke_antialias attribute in the DrawInfo handle. * * @return value of the stroke_antialias attribute in DrawInfo * * @throws MagickException if any error occurs */ public native boolean getStrokeAntialias() throws MagickException; /** * Set the text_antialias attribute in the DrawInfo handle. * * @param textAntialias whether antialiasing is enable * * @throws MagickException if any error occurs */ public native void setTextAntialias(boolean textAntialias) throws MagickException; /** * Return the text_antialias attribute in the DrawInfo handle. * * @return value of the text_antialias attribute in DrawInfo * * @throws MagickException if any error occurs */ public native boolean getTextAntialias() throws MagickException; /** * Set the gravity attribute in the DrawInfo handle. * * @param gravity the new GravityType value * * @throws MagickException if any error occurs * @see GravityType */ public native void setGravity(int gravity) throws MagickException; /** * Get the gravity attribute in the DrawInfo handle. * * @return the value of the gravity attribute in the DrawInfo * * @throws MagickException if any error occurs * @see GravityType */ public native int getGravity() throws MagickException; /** * Set the opacity attribute in the DrawInfo handle. * * @param opacity the new opacity value * * @throws MagickException if any error occurs */ public native void setOpacity(int opacity) throws MagickException; /** * Get the opacity attribute in the DrawInfo handle. * * @return the value of the opacity attribute in the DrawInfo * * @throws MagickException if any error occurs */ public native int getOpacity() throws MagickException; /** * Set the decorate attribute in the DrawInfo handle. * * @param decoration the new DecorationType value * * @throws MagickException if any error occurs * @see DecorationType */ public native void setDecorate(int decoration) throws MagickException; /** * Get the decorate attribute in the DrawInfo handle. * * @return the value of the decorate attribute in the DrawInfo * * @throws MagickException if any error occurs * @see DecorationType */ public native int getDecorate() throws MagickException; /** * Set the kerning attribute in the DrawInfo handle. * * @param kerning value of the kerning attribute * * @throws MagickException if any error occurs */ public native void setKerning(double kerning) throws MagickException; /** * Get the kerning attribute in the DrawInfo handle. * * @return the value of the kerning attribute in DrawInfo * * @throws MagickException if any error occurs */ public native double getKerning() throws MagickException; /** * Set the interword_spacing attribute in the DrawInfo handle. * * @param interwordSpacing value of the interword_spacing attribute * * @throws MagickException if any error occurs */ public native void setInterwordSpacing(double interwordSpacing) throws MagickException; /** * Get the interword_spacing attribute in the DrawInfo handle. * * @return the value of the interword_spacing attribute in DrawInfo * * @throws MagickException if any error occurs */ public native double getInterwordSpacing() throws MagickException; /** * Set the interline_spacing attribute in the DrawInfo handle. * * @param interlineSpacing value of the interline_spacing attribute * * @throws MagickException if any error occurs */ public native void setInterlineSpacing(double interlineSpacing) throws MagickException; /** * Get the interline_spacing attribute in the DrawInfo handle. * * @return the value of the interline_spacing attribute in DrawInfo * * @throws MagickException if any error occurs */ public native double getInterlineSpacing() throws MagickException; /** * Set the stroke_width attribute in the DrawInfo handle. * * @param strokeWidth value of the stroke_width attribute * * @throws MagickException if any error occurs */ public native void setStrokeWidth(double strokeWidth) throws MagickException; /** * Get the stroke_width attribute in the DrawInfo handle. * * @return the value of the stroke_width attribute in DrawInfo * * @throws MagickException if any error occurs */ public native double getStrokeWidth() throws MagickException; /** * Set the pointsize attribute in the DrawInfo handle. * * @param pointsize value of the pointsize attribute * * @throws MagickException if any error occurs */ public native void setPointsize(double pointsize) throws MagickException; /** * Get the pointsize attribute in the DrawInfo handle. * * @return the value of the pointsize attribute in DrawInfo * * @throws MagickException if any error occurs */ public native double getPointsize() throws MagickException; /** * Set the fill attribute in the DrawInfo handle. * * @param fill new value of the fill attribute * * @throws MagickException if any error occurs */ public native void setFill(PixelPacket fill) throws MagickException; /** * Get the fill attribute in the DrawInfo handle. * * @return the fill attribute in the DrawInfo handle * * @throws MagickException if any error occurs */ public native PixelPacket getFill() throws MagickException; /** * Set the stroke attribute in the DrawInfo handle. * * @param stroke new value of the fill attribute * * @throws MagickException if any error occurs */ public native void setStroke(PixelPacket stroke) throws MagickException; /** * Get the stroke attribute in the DrawInfo handle. * * @return the stroke attribute in the DrawInfo handle * * @throws MagickException if any error occurs */ public native PixelPacket getStroke() throws MagickException; /** * Set the undercolor attribute in the DrawInfo handle. * * @param underColor new value of the fill attribute * * @throws MagickException if any error occurs */ public native void setUnderColor(PixelPacket underColor) throws MagickException; /** * Get the undercolor attribute in the DrawInfo handle. * * @return the undercolor attribute in the DrawInfo handle * * @throws MagickException if any error occurs */ public native PixelPacket getUnderColor() throws MagickException; /** * Set the border_color attribute in the DrawInfo handle. * * @param borderColor new value of the fill attribute * * @throws MagickException if any error occurs */ public native void setBorderColor(PixelPacket borderColor) throws MagickException; /** * Get the border_color attribute in the DrawInfo handle. * * @return the corber_color attribute in the DrawInfo handle * * @throws MagickException if any error occurs */ public native PixelPacket getBorderColor() throws MagickException; /** * Set the tile image in the DrawInfo. * @param image the tile image to set * @throws MagickException if any error occurs */ public native void setTile(MagickImage image) throws MagickException; /** * Get the tile image from the DrawInfo. * @return a copy of the title image * @throws MagickException if any error occurs */ public native MagickImage getTile() throws MagickException; } techblue-jmagick-b4412af/src/magick/ExceptionType.java000066400000000000000000000067601452765401600230250ustar00rootroot00000000000000package magick; /** * Corresponds to the ImageMagick ExceptionType enumeration. * Must correspond to http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/exception.h * * @author Eric Yeo */ public interface ExceptionType { public static final int UndefinedException = 0; public static final int WarningException = 300; public static final int ResourceLimitWarning = 300; public static final int TypeWarning = 305; public static final int OptionWarning = 310; public static final int DelegateWarning = 315; public static final int MissingDelegateWarning = 320; public static final int CorruptImageWarning = 325; public static final int FileOpenWarning = 330; public static final int BlobWarning = 335; public static final int StreamWarning = 340; public static final int CacheWarning = 345; public static final int CoderWarning = 350; public static final int FilterWarning = 352; public static final int ModuleWarning = 355; public static final int DrawWarning = 360; public static final int ImageWarning = 365; public static final int WandWarning = 370; public static final int RandomWarning = 375; public static final int XServerWarning = 380; public static final int MonitorWarning = 385; public static final int RegistryWarning = 390; public static final int ConfigureWarning = 395; public static final int PolicyWarning = 399; public static final int ErrorException = 400; public static final int ResourceLimitError = 400; public static final int TypeError = 405; public static final int OptionError = 410; public static final int DelegateError = 415; public static final int MissingDelegateError = 420; public static final int CorruptImageError = 425; public static final int FileOpenError = 430; public static final int BlobError = 435; public static final int StreamError = 440; public static final int CacheError = 445; public static final int CoderError = 450; public static final int FilterError = 452; public static final int ModuleError = 455; public static final int DrawError = 460; public static final int ImageError = 465; public static final int WandError = 470; public static final int RandomError = 475; public static final int XServerError = 480; public static final int MonitorError = 485; public static final int RegistryError = 490; public static final int ConfigureError = 495; public static final int PolicyError = 499; public static final int FatalErrorException = 700; public static final int ResourceLimitFatalError = 700; public static final int TypeFatalError = 705; public static final int OptionFatalError = 710; public static final int DelegateFatalError = 715; public static final int MissingDelegateFatalError = 720; public static final int CorruptImageFatalError = 725; public static final int FileOpenFatalError = 730; public static final int BlobFatalError = 735; public static final int StreamFatalError = 740; public static final int CacheFatalError = 745; public static final int CoderFatalError = 750; public static final int FilterFatalError = 752; public static final int ModuleFatalError = 755; public static final int DrawFatalError = 760; public static final int ImageFatalError = 765; public static final int WandFatalError = 770; public static final int RandomFatalError = 775; public static final int XServerFatalError = 780; public static final int MonitorFatalError = 785; public static final int RegistryFatalError = 790; public static final int ConfigureFatalError = 795; public static final int PolicyFatalError = 799; } techblue-jmagick-b4412af/src/magick/FilterType.java000066400000000000000000000032261452765401600223060ustar00rootroot00000000000000package magick; public interface FilterType { /* Important! Constant values should correspond to: http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/resample.h */ public static final int UndefinedFilter = 0; public static final int PointFilter = 1; public static final int BoxFilter = 2; public static final int TriangleFilter = 3; public static final int HermiteFilter = 4; public static final int HannFilter = 5; public static final int HammingFilter = 6; public static final int BlackmanFilter = 7; public static final int GaussianFilter = 8; public static final int QuadraticFilter = 9; public static final int CubicFilter = 10; public static final int CatromFilter = 11; public static final int MitchellFilter = 12; public static final int JincFilter = 13; public static final int SincFilter = 14; public static final int SincFastFilter = 15; public static final int KaiserFilter = 16; public static final int WelchFilter = 17; public static final int ParzenFilter = 18; public static final int BohmanFilter = 19; public static final int BartlettFilter = 20; public static final int LagrangeFilter = 21; public static final int LanczosFilter = 22; public static final int LanczosSharpFilter = 23; public static final int Lanczos2Filter = 24; public static final int Lanczos2SharpFilter = 25; public static final int RobidouxFilter = 26; public static final int RobidouxSharpFilter = 27; public static final int CosineFilter = 28; public static final int SplineFilter = 29; public static final int LanczosRadiusFilter = 30; public static final int SentinelFilter = 31; /* a count of all the filters, not a real filter */ } techblue-jmagick-b4412af/src/magick/GeometryFlags.java000066400000000000000000000034461452765401600227730ustar00rootroot00000000000000package magick; public interface GeometryFlags { /* Important! Constant values should correspond to: http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/geometry.h */ public static final int NoValue = 0x0000; public static final int XValue = 0x0001; public static final int XiValue = 0x0001; public static final int YValue = 0x0002; public static final int PsiValue = 0x0002; public static final int WidthValue = 0x0004; public static final int RhoValue = 0x0004; public static final int HeightValue = 0x0008; public static final int SigmaValue = 0x0008; public static final int ChiValue = 0x0010; public static final int XiNegative = 0x0020; public static final int XNegative = 0x0020; public static final int PsiNegative = 0x0040; public static final int YNegative = 0x0040; public static final int ChiNegative = 0x0080; public static final int PercentValue = 0x1000; /* '%' percentage of something */ public static final int AspectValue = 0x2000; /* '!' resize no-aspect - special use flag */ public static final int NormalizeValue = 0x2000; /* '!' ScaleKernelValue() in morphology.c */ public static final int LessValue = 0x4000; /* '<' resize smaller - special use flag */ public static final int GreaterValue = 0x8000; /* '>' resize larger - spacial use flag */ public static final int MinimumValue = 0x10000; /* '^' special handling needed */ public static final int CorrelateNormalizeValue = 0x10000; /* '^' see ScaleKernelValue() */ public static final int AreaValue = 0x20000; /* '@' resize to area - special use flag */ public static final int DecimalValue = 0x40000; /* '.' floating point numbers found */ public static final int SeparatorValue = 0x80000; /* 'x' separator found */ public static final int AllValues = 0x7fffffff; } techblue-jmagick-b4412af/src/magick/GravityType.java000066400000000000000000000014521452765401600225050ustar00rootroot00000000000000package magick; /** * Corresponds to the ImageMagick enumerated type of the same name. * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/geometry.h * * @author Eric Yeo */ public interface GravityType { public static final int UndefinedGravity = 0; public static final int ForgetGravity = 0; public static final int NorthWestGravity = 1; public static final int NorthGravity = 2; public static final int NorthEastGravity = 3; public static final int WestGravity = 4; public static final int CenterGravity = 5; public static final int EastGravity = 6; public static final int SouthWestGravity = 7; public static final int SouthGravity = 8; public static final int SouthEastGravity = 9; } techblue-jmagick-b4412af/src/magick/ImageInfo.java000066400000000000000000000400161452765401600220530ustar00rootroot00000000000000package magick; /** * Corresponds to the ImageMagick ImageInfo structure. * * @author Eric Yeo */ public class ImageInfo extends Magick { /** * Internal ImageMagick ImageInfo handle. * We use long (64-bits) for portability. */ private long imageInfoHandle = 0; /** * Constructor. * @throws MagickException if an error occurs */ public ImageInfo() throws MagickException { init(); } /** * Constructor. * * @param fileName initial value of the file_name attribute * @throws MagickException if an error occurs */ public ImageInfo(String fileName) throws MagickException { init(); setFileName(fileName); } /** * To release memory on cleanup. */ protected void finalize() { destroyImageInfo(); } /** * Initialises the internal native handle. * @throws MagickException if an error occurs */ public native void init() throws MagickException; /** * Set the file name attribute of the handle. * * @param fileName the new file name * @throws MagickException if an error occurs */ public native void setFileName(String fileName) throws MagickException; /** * Associates a value with an image option. * Example:
		 * ImageInfo info = new ImageInfo(...)
		 * info.setImageOption("quantum:polarity", "min-is-white");
		 * 
* This then ensures that our tiffs come out in a way that works with * Microsofts Tiff Viewer. * * @param option the image option * @param value the image option value * @since JMagick 6.4.3 (2008-08-05) * @throws MagickException if an error occurs */ public native void setImageOption(String option, String value) throws MagickException; /** * Return the file name attribute of the handle. * * @return the file name attribute value * @throws MagickException if an error occurs */ public native String getFileName() throws MagickException; /** * Set the affirm attribute. * * @param affirm new value of affirm * @throws MagickException if an error occurs */ public native void setAffirm(boolean affirm) throws MagickException; /** * Get the affirm attribute. * * @return the affirm attribute value * @throws MagickException if an error occurs */ public native boolean getAffirm() throws MagickException; /** * Set the subimage attribute. * * @param value new value of subimage * @throws MagickException if an error occurs */ public native void setSubimage(int value) throws MagickException; /** * Get the subimage attribute. * * @return the subimage attribute value * @throws MagickException if an error occurs */ public native int getSubimage() throws MagickException; /** * Set the subrange attribute. * * @param value the new value of subrange * @throws MagickException if an error occurs */ public native void setSubrange(int value) throws MagickException; /** * Get the subrange attribute. * * @return the subrange attribute value * @throws MagickException if an error occurs */ public native int getSubrange() throws MagickException; /** * Set the server_name attribute. * * @param name the new value of server_name * @throws MagickException if an error occurs */ public native void setServerName(String name) throws MagickException; /** * Get the server_name attribute. * * @return the server_name attribute value * @throws MagickException if an error occurs */ public native String getServerName() throws MagickException; /** * Set the font attribute. * * @param font the new value of font * @throws MagickException if an error occurs */ public native void setFont(String font) throws MagickException; /** * Get the font attribute. * * @return the font attribute value * @throws MagickException if an error occurs */ public native String getFont() throws MagickException; /** * Set the size attribute. * * @param size the new value of size * @throws MagickException if an error occurs */ public native void setSize(String size) throws MagickException; /** * Get the size attribute. * * @return the size attribute value * @throws MagickException if an error occurs */ public native String getSize() throws MagickException; /** * Set the tile attribute. * * @param tile the new value of tile * @throws MagickException if an error occurs */ public native void setTile(String tile) throws MagickException; /** * Get the tile attribute. * * @return the tile attribute value * @throws MagickException if an error occurs */ public native String getTile() throws MagickException; /** * Set the density attribute. * * @param density the new value of density * @throws MagickException if an error occurs */ public native void setDensity(String density) throws MagickException; /** * Get the density attribute. * * @return the density attribute value * @throws MagickException if an error occurs */ public native String getDensity() throws MagickException; /** * Set the page attribute. * * @param page the new value of page * @throws MagickException if an error occurs */ public native void setPage(String page) throws MagickException; /** * Get the page attribute. * * @return the page attribute value * @throws MagickException if an error occurs */ public native String getPage() throws MagickException; /** * Set the texture attribute. * * @param texture the new value of texture * @throws MagickException if an error occurs */ public native void setTexture(String texture) throws MagickException; /** * Get the texture attribute. * * @return the texture attribute value * @throws MagickException if an error occurs */ public native String getTexture() throws MagickException; /** * Set the view attribute. * * @param view the new value of view * @throws MagickException if an error occurs */ public native void setView(String view) throws MagickException; /** * Get the view attribute. * * @return the view attribute value * @throws MagickException if an error occurs */ public native String getView() throws MagickException; /** * Set the adjoin attribute. * * @param value the new value of adjoin * @throws MagickException if an error occurs */ public native void setAdjoin(int value) throws MagickException; /** * Get the adjoin attribute. * * @return the adjoin attribute value * @throws MagickException if an error occurs */ public native int getAdjoin() throws MagickException; /** * Set the colorspace attribute. * * @param value the new value of colorspace * @throws MagickException if an error occurs */ public native void setColorspace(int value) throws MagickException; /** * Get the colorspace attribute. * * @return the colorspace attribute value * @throws MagickException if an error occurs */ public native int getColorspace() throws MagickException; /** * Set the compression attribute. * * @param value the new value of compression * @throws MagickException if an error occurs */ public native void setCompression(int value) throws MagickException; /** * Get the compression attribute. * * @return the compression attribute value * @throws MagickException if an error occurs */ public native int getCompression() throws MagickException; /** * Set the dither attribute. * * @param value the new value of dither * @throws MagickException if an error occurs */ public native void setDither(int value) throws MagickException; /** * Get the dither attribute. * * @return the dither attribute value * @throws MagickException if an error occurs */ public native int getDither() throws MagickException; /** * Set the antialias attribute. * * @param value the new value of antialias * @throws MagickException if an error occurs */ public native void setAntialias(int value) throws MagickException; /** * Get the antialias attribute. * * @return the antialias attribute value * @throws MagickException if an error occurs */ public native int getAntialias() throws MagickException; /** * Set the interlace attribute. * * @param value the new value of interlace * @throws MagickException if an error occurs */ public native void setInterlace(int value) throws MagickException; /** * Get the interlace attribute. * * @return the interlace attribute value * @throws MagickException if an error occurs */ public native int getInterlace() throws MagickException; /** * Set the monochrome attribute. * * @param value the new value of monochrome * @throws MagickException if an error occurs */ public native void setMonochrome(int value) throws MagickException; /** * Get the monochrone attribute. * * @return the monochrone attribute value * @throws MagickException if an error occurs */ public native int getMonochrome() throws MagickException; /** * Set the fuzz attribute. * * @param value the new value of fuzz * @throws MagickException if an error occurs */ public native void setFuzz(double value) throws MagickException; /** * Get the fuzz attribute. * * @return the fuzz attribute value * @throws MagickException if an error occurs */ public native double getFuzz() throws MagickException; /** * Set the pointsize attribute. * * @param value the new value of pointsize * @throws MagickException if an error occurs */ public native void setPointSize(int value) throws MagickException; /** * Get the pointsize attribute. * * @return the pointsize attribute value * @throws MagickException if an error occurs */ public native int getPointSize() throws MagickException; /** * Set the quality attribute. * * @param value the new value of quality * @throws MagickException if an error occurs */ public native void setQuality(int value) throws MagickException; /** * Get the quality attribute. * * @return the quality attribute value * @throws MagickException if an error occurs */ public native int getQuality() throws MagickException; /** Set the verbose attribute. * This makes writeImage print out information about the written image on standard output, like: *
	 * TIFF Directory at offset 0x0
					 Image Width: 102 Image Length: 68
					 Resolution: 72, 72 pixels/inch
					 Bits/Sample: 8
					 Compression Scheme: None
					 Photometric Interpretation: RGB color
					 FillOrder: msb-to-lsb
					 Document Name: "test/output/black_and_White_In_RGBRGB.tif"
					 Orientation: row 0 top, col 0 lhs
					 Samples/Pixel: 3
					 Rows/Strip: 26
					 Planar Configuration: single image plane
					 ICC Profile: >present<, 560 bytes
					 Software: ImageMagick 6.2.6 10/06/06 Q8 http://www.imagemagick.org
	 * 
*

* Note: The verbose setting is primarily for use with the utility programs. * it is equivalent to the -verbose option for ImageMagick command line tool. * The delegates subsystem does * observe verbose, which is why setting verbose to true causes some * output when loading a PDF or PS file. *

* @param value the new verbosity value * @see MagickImage#writeImage(ImageInfo) * @throws MagickException if an error occurs */ public native void setVerbose(int value) throws MagickException; /** * Get the verbose attribute. * * @return verbosity * @throws MagickException if an error occurs * @see #setVerbose(int) */ public native int getVerbose() throws MagickException; /** * Set the preview_type attribute. * * @param value new value of the preview_type attribute * @throws MagickException if an error occurs */ public native void setPreviewType(int value) throws MagickException; /** * Get the preview_type attribute. * * @return the preview_type attribute value * @throws MagickException if an error occurs */ public native int getPreviewType() throws MagickException; /** * Set the ping attribute. * Used to get information about an image without having to read the image into memory. * Afterwards you can use readImage to get the width, height, file size in bytes, and the file format of the image, without loading the pixels. * @param value new value of the ping attribute * @throws MagickException if an error occurs */ public native void setPing(boolean value) throws MagickException; /** * Get the ping attribute. * * @return the ping attribute value * @throws MagickException if an error occurs * @see #setPing(boolean) */ public native boolean getPing() throws MagickException; /** * Clean up the memory allocated for the handle */ private native void destroyImageInfo(); /** * Set the magick attribute of the handle. * * @author: Abdulbaset Gaddah <agaddah@yahoo.com> * @param magick new value of the magick attribute * @throws MagickException if an error occurs */ public native void setMagick(String magick) throws MagickException; /** * Return the magick attribute of the handle. * * @author Abdulbaset Gaddah <agaddah@yahoo.com> * @return the magick attribute value * @throws MagickException if an error occurs */ public native String getMagick() throws MagickException; /** * Set the units attribute of the ImageInfo. * * @param resolutionType the resolution type as defined in ResolutionType * @see ResolutionType * @throws MagickException if an error occurs */ public native void setUnits(int resolutionType) throws MagickException; /** * Get the units attribute of the ImageInfo. * * @return A integer representing the resolution type as defined * in ResolutionType * @see ResolutionType * @exception MagickException on error * @throws MagickException if an error occurs */ public native int getUnits() throws MagickException; /** * Set the border colour.. * @param color the border colour * @see magick.MagickImage#borderImage * @throws MagickException if an error occurs */ public native void setBorderColor(PixelPacket color) throws MagickException; /** * Get the current border colour.. * @return the current border colour * @see magick.MagickImage#borderImage * @throws MagickException if an error occurs */ public native PixelPacket getBorderColor() throws MagickException; /** * Return the depth of the image. * * @return the depth of the image. * @throws MagickException if an error occurs */ public native int getDepth() throws MagickException; /** * Set the depth of the image. * * @param depth the depth of the image * @throws MagickException if an error occurs */ public native void setDepth(int depth) throws MagickException; public String toString() { try { return "Depth:"+this.getDepth()+" view:"+this.getView()+" monochrome:"+this.getMonochrome()+" size:"+this.getSize(); } catch (MagickException e) { // TODO Auto-generated catch block e.printStackTrace(); return "ImageInfo get error"; } } } techblue-jmagick-b4412af/src/magick/ImageMagick.java000066400000000000000000000000571452765401600223540ustar00rootroot00000000000000package magick; public class ImageMagick { } techblue-jmagick-b4412af/src/magick/ImageType.java000066400000000000000000000015541452765401600221050ustar00rootroot00000000000000package magick; /** * Corresponds to the ImageMagick enumerated type of the same name. * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/image.h * @see MagickImage#getImageType() * @author Eric Yeo */ public interface ImageType { public static final int UndefinedType = 0; public static final int BilevelType = 1; public static final int GrayscaleType = 2; public static final int GrayscaleAlphaType = 3; public static final int PaletteType = 4; public static final int PaletteAlphaType = 5; public static final int TrueColorType = 6; public static final int TrueColorAlphaType = 7; public static final int ColorSeparationType = 8; public static final int ColorSeparationAlphaType = 9; public static final int OptimizeType = 10; public static final int PaletteBilevelAlphaType = 11; } techblue-jmagick-b4412af/src/magick/InterlaceType.java000066400000000000000000000012321452765401600227620ustar00rootroot00000000000000package magick; /** * Corresponds to the ImageMagick enumerated type of the same name. * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/image.h * * @author Eric Yeo */ public interface InterlaceType { public static final int UndefinedInterlace = 0; public static final int NoInterlace = 1; public static final int LineInterlace = 2; public static final int PlaneInterlace = 3; public static final int PartitionInterlace = 4; public static final int GIFInterlace = 5; public static final int JPEGInterlace = 6; public static final int PNGInterlace = 7; } techblue-jmagick-b4412af/src/magick/InterpolatePixelMethod.java000066400000000000000000000024561452765401600246540ustar00rootroot00000000000000package magick; /** * Corresponds to ImageMagick enumerated type of the same name. * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/pixel.h */ public interface InterpolatePixelMethod { public final int UndefinedInterpolatePixel = 0; public final int AverageInterpolatePixel = 1; /* Average 4 nearest neighbours */ public final int Average9InterpolatePixel = 2; /* Average 9 nearest neighbours */ public final int Average16InterpolatePixel = 3; /* Average 16 nearest neighbours */ public final int BackgroundInterpolatePixel = 4; /* Just return background color */ public final int BilinearInterpolatePixel = 5; /* Triangular filter interpolation */ public final int BlendInterpolatePixel = 6; /* blend of nearest 1, 2 or 4 pixels */ public final int CatromInterpolatePixel = 7; /* Catmull-Rom interpolation */ public final int IntegerInterpolatePixel = 8; /* Integer (floor) interpolation */ public final int MeshInterpolatePixel = 9; /* Triangular Mesh interpolation */ public final int NearestInterpolatePixel = 10; /* Nearest Neighbour Only */ public final int SplineInterpolatePixel = 11; /* Cubic Spline (blurred) interpolation */ /*public final int FilterInterpolatePixel = 12; ** Use resize filter - (very slow) */ }techblue-jmagick-b4412af/src/magick/Magick.java000066400000000000000000000053371452765401600214170ustar00rootroot00000000000000package magick; import java.awt.Rectangle; /** * The sole purpose of this class is to cause the native * library to be loaded whenever a concrete class is used * and provide utility methods. * * @author Eric Yeo * @author Max Kollegov <virtual_max@geocities.com> */ public class Magick { static { String bprop = System.getProperty("jmagick.usingbundledlib"); if (!"yes".equalsIgnoreCase(bprop)) { String clprop = System.getProperty("jmagick.systemclassloader"); if (clprop == null || clprop.equalsIgnoreCase("yes")) { try { Magick.class.getClassLoader() // previously: ClassLoader.getSystemClassLoader() - see https://github.com/techblue/jmagick/issues/49 .loadClass("magick.MagickLoader").newInstance(); } catch(ClassNotFoundException e) { throw new RuntimeException("Can't load MagickLoader " + "(class not found)"); } catch(IllegalAccessException e) { throw new RuntimeException("Access to SystemClassLoader "+ "denied (IllegalAccessException)"); } catch(InstantiationException e) { throw new RuntimeException("Can't instantiate MagicLoader " + "(InstantiationException)"); } } else { System.loadLibrary("JMagick"); } } init(); } /** * Initializes the ImageMagic system */ private static native void init(); /** * Parses a geometry specification and returns the * width, height, x, and y values in the rectangle. * It also returns flags that indicates which of the * four values (width, height, xoffset, yoffset) were * located in the string, and whether the x and y values * are negative. In addition, there are flags to report * any meta characters (%, !, <, and >). * @param geometry String containing the geometry specifications * @param rect The rectangle of values x, y, width and height * @return bitmask indicating the values in the geometry string * @see magick.GeometryFlags */ public static native int parseImageGeometry(String geometry, Rectangle rect); /** * Gets an array of the names of the fonts that ImageMagick has that match the pattern * * @param pattern The query pattern * * @return array of font names. */ public static native String[] queryFonts(String pattern); } techblue-jmagick-b4412af/src/magick/MagickApiException.java000066400000000000000000000026441452765401600237260ustar00rootroot00000000000000package magick; /** * Encapsulation of the ImageMagick ExceptionInfo structure as * well as the exception that is thrown when an ImageMagick * API failed. * * @author Eric Yeo */ public class MagickApiException extends MagickException { /** * Takes a value in ExceptionType. */ private int severity; /** * An reason for failure. */ private String reason; /** * A description of the problem. */ private String description; /** * Construct an API exception. * * @param mesg error message * @param severity one of the value in ExceptionType * @qualifier error qualifier */ private MagickApiException(int severity, String reason, String description) { super(reason); this.severity = severity; this.reason = reason; this.description = description; } /* * Get the severity of the exception. * * @return severity of the Exception */ public int getSeverity() { return severity; } /* * Get the reason of the exception. * * @return reason of the exception. */ public String getReason() { return reason; } /** * Get the description of the exception. * * @return description of the exception. */ public String getDescription() { return description; } } techblue-jmagick-b4412af/src/magick/MagickException.java000066400000000000000000000005571452765401600232750ustar00rootroot00000000000000package magick; /** * Exception class for all encompassing Exception. * * @see MagickApiException * @author Eric Yeo */ public class MagickException extends Exception { /** * Construct an exception with a message. * * @param mesg message attached to the exception */ public MagickException(String mesg) { super(mesg); } } techblue-jmagick-b4412af/src/magick/MagickImage.java000066400000000000000000002235641452765401600223660ustar00rootroot00000000000000package magick; import java.awt.Dimension; import java.awt.Rectangle; /** * Encapsulation of the ImageMagick Image object. * We use MagickImage here so as not to be confused * with java.awt.Image. * * @author Eric Yeo */ public class MagickImage extends Magick { /** * Internal ImageMagick Image handle. * We use long (64-bits) for portability. */ private long magickImageHandle = 0; /** * Constructor. */ public MagickImage() { } /** * Construct a MagickImage that is made up of all * the images in the specified array. If any of * the images contains multiple frames, the frames * are also appended to the new image. All the * images are cloned. * * @param images array of images to linked */ public MagickImage(MagickImage[] images) throws MagickException { initMultiImage(images); } /** * Helper for the constcutor to create an image that * is made up of all the images in the specified array. * If any of the images contains multiple frames, the * frames are also appended to the new image. All the * images are cloned. * * @param images array of images to linked * @throws MagickException if the new image cannot be constructed * @see MagickImage */ private native void initMultiImage(MagickImage[] images) throws MagickException; /** * Constructor that also reads an image file * specified in the parameter. * * @param imageInfo the ImageInfo for an image file to read * @param ping true for ping the image only. * * @throws MagickException on error */ public MagickImage(ImageInfo imageInfo, boolean ping) throws MagickException { if (ping) { pingImage(imageInfo); } else { readImage(imageInfo); } } /** * Pings the image. * * @param imageInfo the ImageInfo for an image file to read * @see The underlying ImageMagick call * @throws MagickException if an error occurs */ public native void pingImage(ImageInfo imageInfo) throws MagickException; /** * Constructor that also reads an image file * specified in the parameter. * * @param imageInfo the ImageInfo for an image file to read * * @throws MagickException if an error occurs */ public MagickImage(ImageInfo imageInfo) throws MagickException { readImage(imageInfo); } /** * Constructor that takes the image to be read from memory. * * @param imageInfo the ImageInfo instance for default settings, etc * @param blob the image to be read in memory * * @throws MagickException if an error occurs */ public MagickImage(ImageInfo imageInfo, byte[] blob) throws MagickException { blobToImage(imageInfo, blob); } /** * This method will clean up the handle. */ protected void finalize() { destroyImages(); } /** * Allocate a blank image object. * * @param imageInfo specifies the parameters for the blank image */ public native void allocateImage(ImageInfo imageInfo); /** * Read the image specified in the ImageInfo object. * * @param imageInfo specifies the file to read from * @see The underlying ImageMagick call * @throws MagickException on error */ public native void readImage(ImageInfo imageInfo) throws MagickException; /** * Write the image specified in the ImageInfo object. * * @param imageInfo specifies the writing parameters * @return true for success, false for failure * * @throws MagickException on error */ public native boolean writeImage(ImageInfo imageInfo) throws MagickException; /** * Return the image file name of the image. * * @return the file name of the image * @throws MagickException on error */ public native String getFileName() throws MagickException; /** * Set the image file name. * * @param fileName new file name * * @throws MagickException on error */ public native void setFileName(String fileName) throws MagickException; /** * Set the filter type. * * @param filter the filter type from constants defined in the class FilterType * @see FilterType * @throws MagickException on error */ public native void setFilter(int filter) throws MagickException; /** * Get the filter type. * * @return the filter type as defined in the class FilterType * @see FilterType * @throws MagickException on error */ public native int getFilter() throws MagickException; /** * Adds random noise to the image. * * @param noiseType The type of noise: Uniform, Gaussian, Multiplicative, * Impulse, Laplacian, or Poisson. * @see NoiseType * @return An image with additional noise. * @see The underlying ImageMagick call * @throws MagickException on error */ public native MagickImage addNoiseImage(int noiseType) throws MagickException; /** * Adds random noise to the image. * * @param noiseType The type of noise: Uniform, Gaussian, Multiplicative, * Impulse, Laplacian, or Poisson. * @param attenuate The random distribution. * @see NoiseType * @return An image with additional noise. * @see The underlying ImageMagick call * @throws MagickException on error */ public native MagickImage addNoiseImage(int noiseType, double attenuate) throws MagickException; /** * Return the number of columns and rows of the image. * @return the dimension of the image * @throws MagickException on error */ public native Dimension getDimension() throws MagickException; /** * Return the depth of the image. * * @return the depth of the image. * @throws MagickException on error */ public native int getDepth() throws MagickException; /** * Set the depth of the image. * * @param depth the depth of the image * @throws MagickException on error */ public native void setDepth(int depth) throws MagickException; /** * Blurs an image. We convolve the image with a Gaussian operator of * the given radius and standard deviation (sigma). For reasonable * results, the radius should be larger than sigma. Use a radius of 0 * and BlurImage() selects a suitable radius for you. * * @param raduis The radius of the gaussian, in pixels, not counting * the center pixel * @param sigma The standard deviation of the gaussian, in pixels * * @return A blurred image. * @throws MagickException on error */ public native MagickImage blurImage(double raduis, double sigma) throws MagickException; /** * Blurs an image. We convolve the image with a Gaussian operator of * the given radius and standard deviation (sigma). For reasonable * results, the radius should be larger than sigma. Use a radius of 0 * and BlurImage() selects a suitable radius for you. * * @param channel The channel(s) to which the blurring should apply (see ChannelType) * @param raduis The radius of the gaussian, in pixels, not counting * the center pixel * @param sigma The standard deviation of the gaussian, in pixels * * @return A blurred image. * @throws MagickException on error */ public native MagickImage blurImageChannel(int channel, double raduis, double sigma) throws MagickException; /** * Trim edges that are the background color from the image. * * @return the trimmed image * @throws MagickException on error */ public native MagickImage trimImage() throws MagickException; /** * Resets the image page canvas and position. * * @param page String representing the new page geometry * @return true for success, false for failure * @throws MagickException on error */ public native boolean resetImagePage(String page) throws MagickException; /** * Return the storage class of the image. * * @return the store class as defined in ClassType * @see ClassType * @throws MagickException on error */ public native int getStorageClass() throws MagickException; /** * Annotates an image with test. Optionally the annotation can * include the image filename, type, width, height, or scene * number by embedding special format characters. * * @param info the anotation information */ public native void annotateImage(DrawInfo info); /** * Surrounds the image with a border of the color defined by * the border color member of the image structure. The width * and height of the border are defined by the corresponding * members of the Rectangle. * * @param borderInfo the rectangle for which border is drawn * @return an Image with a border around it * @throws MagickException on error * @see #setBorderColor * @see #getBorderColor */ public native MagickImage borderImage(Rectangle borderInfo) throws MagickException; /** * Surrounds the image with a border of the color defined by * the border color member of the image structure. The width * and height of the border are defined by the corresponding * members of the Rectangle. * * @param borderInfo the rectangle for which border is drawn * @param compositeOperator the composite operator * @return an Image with a border around it * @throws MagickException on error * @see #setBorderColor * @see #getBorderColor */ public native MagickImage borderImage(Rectangle borderInfo, int compositeOperator) throws MagickException; /** * Creates a new image that is a copy of an existing one with the * edges highlighted, producing a 'charcoal-drawing' effect. * * @param raduis The radius of the pixel neighborhood. * @param sigma The standard deviation of the gaussian, in pixels * * @return A charcoal-like image. * @throws MagickException on error */ public native MagickImage charcoalImage(double raduis, double sigma) throws MagickException; /** * Creates a simulated three-dimensional button-like effect by * lightening and darkening the edges of the image. Members width * and height of raiseInfo define the width of the vertical and * horizontal edge of the effect. * * @param raiseInfo the rectangle for which border is drawn * @param raise true to create raise effect, false to lower * * @return true if successful, false otherwise * @throws MagickException on error */ public native boolean raiseImage(Rectangle raiseInfo, boolean raise) throws MagickException; /** * Creates a new image that is a subregion of the original. * * @param chopInfo the rectange to chop the image * @throws MagickException on error */ public native MagickImage chopImage(Rectangle chopInfo) throws MagickException; /** * Colourises the image with a pen colour. * * @param opacity string percentage value for opacity * @param target a colour value * * @return the colourised image * @throws MagickException on error */ public native MagickImage colorizeImage(String opacity, PixelPacket target) throws MagickException; /** * Composite the image supplied onto itself at the specified offsets. * * @param compOp This operator affects how the composite is applied to the image. The operators and how they are utilized are listed here. * @param compImage the source image * @param xOff The column offset of the composited image. * @param yOff The row offset of the composited image. * * @see CompositeOperator * @see Command line explanation * @see The underlying ImageMagick call * @throws MagickException on error */ public native boolean compositeImage(int compOp, MagickImage compImage, int xOff, int yOff) throws MagickException; /** * Composite the image supplied onto itself at the specified offsets. * * @param compOp This operator affects how the composite is applied to the image. The operators and how they are utilized are listed here. * @param compImage the source image * @param clipToSelf Whether or not to limit composition to area composed * @param xOff The column offset of the composited image. * @param yOff The row offset of the composited image. * * @see CompositeOperator * @see Command line explanation * @see The underlying ImageMagick call * @throws MagickException on error */ public native boolean compositeImage(int compOp, MagickImage compImage, boolean clipToSelf, int xOff, int yOff) throws MagickException; /** * Composites a set of images while respecting any page offsets and disposal methods. * * @return the coalesced image * @see The underlying ImageMagick call * @throws MagickException on error */ public native MagickImage coalesceImages() throws MagickException; /** * Returns the coalesced frames of a GIF animation as it would appear after the GIF dispose method of that frame has been applied.. * * @return the disposed image * @see The underlying ImageMagick call * @throws MagickException on error */ public native MagickImage disposeImages() throws MagickException; /** * Enhances the intensity differences between the lighter and * darker elements of the image. * * @param sharpen * * @return a boolean value to indicate success * @throws MagickException on error */ public native boolean contrastImage(boolean sharpen) throws MagickException; /** * Returns a copy of all fields of the input image. * The the pixel memory is allocated but the pixel data copy is optional. * * @param columns * @param rows * @param clonePixels * * @return a cloned image * @throws MagickException on error */ public native MagickImage cloneImage(int columns, int rows, boolean clonePixels) throws MagickException; /** * Create a new image of 8-bit component of the specified dimensions. * * @param width the width of the new image * @param height the height of the new image * @param map the components of a pixel * @param pixels the raw image in an array of pixels * @see The underlying ImageMagick call * @throws MagickException on error */ public native void constituteImage(int width, int height, String map, byte[] pixels) throws MagickException; /** * Create a new image of 32-bit component of the specified dimensions. * * @param width the width of the new image * @param height the height of the new image * @param map the components of a pixel * @param pixels the raw image in an array of pixels * @see The underlying ImageMagick call * @throws MagickException on error */ public native void constituteImage(int width, int height, String map, int[] pixels) throws MagickException; /** * Create a new image of float component of the specified dimensions. * * @param width the width of the new image * @param height the height of the new image * @param map the components of a pixel * @param pixels the raw image in an array of pixels * @see The underlying ImageMagick call * @throws MagickException on error */ public native void constituteImage(int width, int height, String map, float[] pixels) throws MagickException; /** * Creates a new image that is a subregion of the original. * * @param chopInfo the subimage * @return a subimage of the original * @throws MagickException on error */ public native MagickImage cropImage(Rectangle chopInfo) throws MagickException; /** * Cycles the image colormap by a specified amount. * @throws MagickException on error */ public native void cycleColormapImage(int amount) throws MagickException; /** * Called by finalize to deallocate the image handle. */ public native void destroyImages(); /** * Draws a primitive (line, rectangle, ellipse) on the image. * @return a boolean value to indicate success * @throws MagickException on error */ public native boolean drawImage(DrawInfo aInfo) throws MagickException; /** * GetTypeMetrics() returns information for the specified font and text * * @see ImageMagick API: GetTypeMetrics * @throws MagickException on error */ public native TypeMetric getTypeMetrics(DrawInfo info) throws MagickException; /** * Finds edges in an image. Radius defines the radius of the convolution * filter. Use a radius of 0 and Edge() selects a suitable radius for you. * * @param raduis The radius of the pixel neighborhood. * * @return A new image with the edges hilighted. * @throws MagickException on error */ public native MagickImage edgeImage(double raduis) throws MagickException; /** * Returns a grayscale image with a three-dimensional effect. * We convolve the image with a Gaussian operator of the given radius * and standard deviation (sigma). For reasonable results, radius * should be larger than sigma. Use a radius of 0 and Emboss() selects * a suitable radius for you. * * @param raduis The radius of the pixel neighborhood. * @param sigma The standard deviation of the Gaussian, in pixels * * @return A new, embossed, image. * @throws MagickException on error */ public native MagickImage embossImage(double raduis, double sigma) throws MagickException; /** * Applies a digital filter that improves the quality of a noisy image. * * @return A new, enhanced, image. * @throws MagickException on error */ public native MagickImage enhanceImage() throws MagickException; /** * Performs histogram equalization. * @return a boolean value to indicate success * @throws MagickException on error */ public native boolean equalizeImage() throws MagickException; /** * Creates a new image that reflects each scanline * in the vertical direction. * @return a new image that has been flipped * @throws MagickException on error */ public native MagickImage flipImage() throws MagickException; /** * Creates a new image that reflects each scanline in the * horizontal direction * @return a new image that has been flopped * @throws MagickException on error */ public native MagickImage flopImage() throws MagickException; /** * Converts the reference image to gamma corrected colors. * @return a boolean value to indicate success * @throws MagickException on error */ public native boolean gammaImage(String gamma) throws MagickException; /** * Blurs the image using a gaussian operator. The effectiveness of the * operator - and the amount of blurring - is controlled by selecting * a 'radius' and a 'sigma'. The radius sets the circle around each * pixel of the 'neighborhood' used for calculating an average pixel * color. Sigma determines how much the calculated average affects the * pixel. * * @param raduis The radius of the Gaussian, in pixels, not counting * the center pixel * @param sigma The standard deviation of the Gaussian, in pixels. * * @return A new, blurred, image. * @throws MagickException on error */ public native MagickImage gaussianBlurImage(double raduis, double sigma) throws MagickException; /** * Implodes the image's pixels about the center. * * @param amount Amount of implosion if positive, explosion if negative. * * @return A new, imploded, image. * @throws MagickException on error */ public native MagickImage implodeImage(double amount) throws MagickException; /** * Implodes the image's pixels about the center. * * @param amount Amount of implosion if positive, explosion if negative. * @param pixelInterpolateMethod The pixel interpolation method. * * @return A new, imploded, image. * @throws MagickException on error */ public native MagickImage implodeImage(double amount, int pixelInterpolateMethod) throws MagickException; /** * Returns True if the image is grayscale otherwise False is returned. * @return a boolean value to indicate success * @throws MagickException on error */ public native boolean isGrayImage() throws MagickException; /** * Returns True if the image is monochrome otherwise False is returned. * @return a boolean value to indicate success * @throws MagickException on error */ public native boolean isMonochromeImage() throws MagickException; /** * Creates a new image that is a integral size greater * than an existing one. * * @return a magnified image * @throws MagickException on error */ public native MagickImage magnifyImage() throws MagickException; /** * Floodfills the designated area with a matte value. * @return a boolean value to indicate success * @throws MagickException on error */ public native boolean matteFloodfillImage(PixelPacket target, int matte, int x, int y, int method) throws MagickException; /** * Changes the color value of any pixel that matches target * and is an immediate neighbor. If the method FillToBorderMethod * is specified, the color value is changed for any neighbor pixel * that does not match the bordercolor member of image. * * By default target must match a particular pixel color exactly. * However, in many cases two colors may differ by a small amount. * The fuzz member of image defines how much tolerance is acceptable to * consider two colors as the same. For example, set fuzz to 10 and the * color red at intensities of 100 and 102 respectively are now * interpreted as the same color for the purposes of the floodfill. * * @param drawInfo The draw info * @param target The RGB value of the target colour * @param x the starting x location of the operation * @param y the starting y location of the operation * @param method either FloodfillMethod or FilltoBorderMethod * @return true or false depending on success or failure respectively * @throws MagickException if any error occurs * @see magick.PaintMethod */ public native boolean colorFloodfillImage(DrawInfo drawInfo, PixelPacket target, int x, int y, int method) throws MagickException; /** * Applies a digital filter that improves the quality of a noisy image. * Each pixel is replaced by the median in a set of neighboring pixels * as defined by radius. * * @param radius The radius of the pixel neighborhood. * * @return A new, filtered, image. * @throws MagickException on error */ public native MagickImage medianFilterImage(double radius) throws MagickException; /** * Creates a new image that is a integral size less than an existing one. * @return a minified image * @throws MagickException on error */ public native MagickImage minifyImage() throws MagickException; /** * Modulates the hue, saturation, and brightness of an image. * @return a boolean value to indicate success * @throws MagickException on error */ public native boolean modulateImage(String modulate) throws MagickException; /** * Negates the colors in the reference image. The Grayscale * option means that only grayscale values within the image are negated. * @return a boolean value to indicate success * @throws MagickException on error */ public native boolean negateImage(int grayscale) throws MagickException; /** * Normalizes the pixel values to span the full range of color values. * This is a contrast enhancement technique. * @return a boolean value to indicate success * @throws MagickException on error */ public native boolean normalizeImage() throws MagickException; /** * Applies a special effect filter that simulates an oil painting. * Each pixel is replaced by the most frequent color occurring in a * circular region defined by radius. * * @param radius The radius of the pixel neighborhood. * * @return A new, simulated oil-painting, image. * @throws MagickException on error */ public native MagickImage oilPaintImage(double radius) throws MagickException; /** * Applies a special effect filter that simulates an oil painting. * Each pixel is replaced by the most frequent color occurring in a * circular region defined by radius. * * @param radius The radius of the pixel neighborhood. * @param sigma The standard deviation of the Gaussian, in pixels. * * @return A new, simulated oil-painting, image. * @throws MagickException on error */ public native MagickImage oilPaintImage(double radius, double sigma) throws MagickException; /** * Changes the color of an opaque pixel to the pen color. * @param target the color to search for in the image * @param penColor the color to replace it with * @return a boolean value to indicate success * @throws MagickException on error */ public native boolean opaqueImage(PixelPacket target, PixelPacket penColor) throws MagickException; /** * This operation attempts to reduce the 'noise' in the image. This * can be used to eliminate minor dust and scratches from scanned * images. *

* The principal function of the noise peak elimination filter is to * smooth the objects within an image without losing edge information * and without creating undesired structures. The central idea of the * algorithm is to replace a pixel with its next neighbor in value in * a circular neighborhood if this pixel has been found to be noise. A * pixel is defined as noise if the pixel is a minimum or maximum * within the neighborhood. * * @param radius The radius of the pixel neighborhood. * * @return A new, filtered, image. * @throws MagickException on error */ public native MagickImage reduceNoiseImage(double radius) throws MagickException; /** * Converts the reference image from RGB to an alternate colorspace. * The transformation matrices are not the standard ones: the weights * are rescaled to normalized the range of the transformed values to * be [0..MaxRGB]. * @param colorspace the target colorspace to transform to * @return a boolean value to indicate success * @throws MagickException on error */ public native boolean rgbTransformImage(int colorspace) throws MagickException; /** * Rolls an image vertically and horizontally. * @param xOffset An integer that specifies the number of columns \ to roll in the horizontal direction * @param yOffset An integer that specifies the number of rows to \ roll in the vertical direction * @return the rolled image * @throws MagickException on error */ public native MagickImage rollImage(int xOffset, int yOffset) throws MagickException; /** * Creates a new image that is a scaled size of an existing one * using pixel sampling. * @param cols An integer that specifies the number of columns in \ the sampled image * @param rows An integer that specifies the number of rows in the \ sampled image * @return the sampled image * @throws MagickException on error */ public native MagickImage sampleImage(int cols, int rows) throws MagickException; /** * Return a new image that is a scaled version of the * original. To scale a scanline from x pixels to y pixels, each new * pixel represents x/y old pixels. To read x/y pixels, read * (x/y rounded up) pixels but only count the required fraction of * the last old pixel read in your new pixel. The remainder of the * old pixel will be counted in the next new pixel. * @param cols An integer that specifies the number of columns in \ the scaled image * @param rows An integer that specifies the number of rows in the \ scaled image * @return the scaled image * @throws MagickException on error */ public native MagickImage scaleImage(int cols, int rows) throws MagickException; /** * Return a new image that is a resized version of the original. * If an undefined filter is given the filter defaults to Mitchell for a * colormapped image, a image with a matte channel, or if the image is * enlarged. Otherwise the filter defaults to a Lanczos. * * @param cols An integer that specifies the number of columns in * the resized image * @param rows An integer that specifies the number of rows in the * resized image * @param blur - The blur factor where > 1 is blurry, < 1 is sharp. * Typically set this to 1.0. * @return the resized image * @throws MagickException on error * @author Pavel Cibulka */ public native MagickImage resizeImage(int cols, int rows, double blur) throws MagickException; /** * Return a new image that is a extended version of the original. * * @param cols An integer that specifies the number of columns in * the extended image * @param rows An integer that specifies the number of rows in the * extended image * @param gravity extent direction @see GravityType * @return the extended image * @throws MagickException on error */ public native MagickImage extentImage(int cols, int rows, int gravity) throws MagickException; /** * Segment an image by analyzing the histograms of the color components * and identifying units that are homogeneous using the fuzzy c-means * technique. * * @param colorspace A {@link ColorspaceType} value that indicates the * colorspace. Empirical evidence suggests that * distances in YUV or YIQ correspond to perceptual * color differences more closely than do distances * in RGB space. The image is then returned to RGB * colorspace after color reduction. * @param cluster_threshold Specify cluster threshold as the number of * pixels in each cluster must exceed the the * cluster threshold to be considered valid. * @param smoothing_threshold Smoothing threshold eliminates noise in * the second derivative of the histogram. As the * value is increased, you can expect a smoother * second derivative. The default is 1.5. * * @return The actual number of colors allocated in the colormap. * @throws MagickException on error * @see ColorspaceType */ public native int segmentImage(int colorspace, double cluster_threshold, double smoothing_threshold) throws MagickException; /** * Applies a special effect to the image, similar to the effect achieved * in a photo darkroom by selectively exposing areas of photo sensitive * paper to light. * * @param threshold Ranges from 0 to MaxRGB and is a measure of the * extent of the solarization. * * @throws MagickException on error */ public native void solarizeImage(double threshold) throws MagickException; /** * Set color fuzz * * @param fuzz fuzz value. * * @throws MagickException on error */ public native void setColorFuzz(double fuzz) throws MagickException; /** * Get bounding box * * @throws MagickException on error */ public native Rectangle getBoundingBox() throws MagickException; /** * Sorts the colormap of a PseudoClass image by decreasing * color intensity. * @return a boolean value indicating success * @throws MagickException on error */ public native boolean sortColormapByIntensity() throws MagickException; /** * A special effects method that randomly displaces each pixel in a * block defined by the radius parameter. * * @param radius Choose a random pixel in a neighborhood of this extent. * * @return A new, spread, image. * @throws MagickException on error */ public native MagickImage spreadImage(int radius) throws MagickException; /** * A special effects method that randomly displaces each pixel in a * block defined by the radius parameter. * * @param radius Choose a random pixel in a neighborhood of this extent. * @param pixelInterpolateMethod The pixel interpolation method. * * @return A new, spread, image. * @throws MagickException on error */ public native MagickImage spreadImage(int radius, int pixelInterpolateMethod) throws MagickException; /** * Swirls the pixels about the center of the image, where degrees * indicates the sweep of the arc through which each pixel is moved. * You get a more dramatic effect as the degrees move from 1 to 360. * * @param degrees Defines the tightness of the swirling effect. * * @return A new, swirled, image. * @throws MagickException on error */ public native MagickImage swirlImage(double degrees) throws MagickException; /** * Swirls the pixels about the center of the image, where degrees * indicates the sweep of the arc through which each pixel is moved. * You get a more dramatic effect as the degrees move from 1 to 360. * * @param degrees Defines the tightness of the swirling effect. * @param pixelInterpolateMethod The pixel interpolation method. * * @return A new, swirled, image. * @throws MagickException on error */ public native MagickImage swirlImage(double degrees, int pixelInterpolateMethod) throws MagickException; /** * Initializes the red, green, and blue intensities of each * pixel as defined by the colormap index. * @throws MagickException on error */ public native void syncImage() throws MagickException; /** * Layers a texture onto the background of an image. * @param image the image to use for texture * @throws MagickException on error */ public native void textureImage(MagickImage image) throws MagickException; /** * Thresholds the reference image. * @param threshold the threshold value * @return a boolean value indicating success * @throws MagickException on error */ public native boolean thresholdImage(double threshold) throws MagickException; /** * Creates a new image that is a transformed size of of * existing one as specified by the crop and image geometries. * * If a crop geometry is specified a subregion of the image is * obtained. If the specified image size, as defined by the image * and scale geometries, is smaller than the actual image size, the * image is first minified to an integral of the specified image * size with an antialias digital filter. The image is then scaled to * the exact specified image size with pixel replication. If the * specified image size is greater than the actual image size, the * image is first enlarged to an integral of the specified image size * with bilinear interpolation. The image is then scaled to the exact * specified image size with pixel replication. * * @param cropGeometry a crop geometry string. This geometry \ defines a subregion of the image. * @param imageGeometry a image geometry string. The specified \ width and height of this geometry string are absolute. * @throws MagickException on error */ public native void transformImage(String cropGeometry, String imageGeometry) throws MagickException; /** * Converts the reference image from an alternate colorspace. * The transformation matrices are not the standard ones: * the weights are rescaled to normalized the range of the * transformed values to be [0..MaxRGB]. * * @param colorspace An unsigned integer value defines which \ colorspace to transform the image from * @return a boolean value indicating success * @throws MagickException on error */ public native boolean transformRgbImage(int colorspace) throws MagickException; /** * Creates a matte image associated with the image. * @param color The color to search for in the image * @param opacity The opacity of the transparent image * @return a boolean value indicating success * @throws MagickException on error */ public native boolean transparentImage(PixelPacket color, int opacity) throws MagickException; /** * Create a Nx1 pixel image where N is the number of unique colors in * the image. Each pixel in the output image is the color of one of * the unique colors of the original image. **/ public native MagickImage uniqueImageColors() throws MagickException; /** * Creates a new image that is a copy of an existing one with * the pixels sharpened using an "unsharp" masking technique. *

* This process starts by building a temporary, {@link * #gaussianBlurImage blurred}, copy of the image. Then each * pixel in this "unsharp" image is compared * against its corresponding pixel in the original image. If * their difference is above a threshold, a percentage of the * difference is added back into the original pixel. *

* The first two arguments, radius and sigma, * specify the blurring used to create the "unsharp" image. See * {@link #gaussianBlurImage} for a detail explanation. It will * suffice to say that the larger the radius and sigma the more * this blurred image will diverge from the original. *

* The last two arguments, threshold and amount, * specify the difference threshold required to apply an adjustment * to each pixel and, once the threshold is reached, the amount of * the difference to be added back into the original pixels. A high * threshold will cause the algorithm to only adjust edge pixels. * Specifying a threshold will adjust every pixel. * * @param raduis The radius of the gaussian, in pixels, not counting the center pixel * @param sigma The standard deviation of the gaussian, in pixels * @param amount The percentage of the difference between the original * and the blur image that is added back into the original. * @param threshold The threshold in pixels needed to apply the diffence * amount. * * @return A sharpened image. * * @throws MagickException on error */ public native MagickImage unsharpMaskImage(double raduis, double sigma, double amount, double threshold) throws MagickException; /** * Creates a "ripple" effect in the image by shifting the pixels * vertically along a sine wave whose amplitude and wavelength is * specified by the given parameters. * * @param amplitude Define the amplitude of the sine wave. * @param wavelength Define the wave-length of the sine wave. * * @return A new, "waved", image. * @throws MagickException on error */ public native MagickImage waveImage(double amplitude, double wavelength) throws MagickException; /** * Creates a "ripple" effect in the image by shifting the pixels * vertically along a sine wave whose amplitude and wavelength is * specified by the given parameters. * * @param amplitude Define the amplitude of the sine wave. * @param wavelength Define the wave-length of the sine wave. * @param pixelInterpolateMethod The pixel interpolation method. * * @return A new, "waved", image. * @throws MagickException on error */ public native MagickImage waveImage(double amplitude, double wavelength, int pixelInterpolateMethod) throws MagickException; /** * Creates a new image that is a scaled size of an existing one. * @return the zoomed image * @throws MagickException on error */ public native MagickImage zoomImage(int cols, int rows) throws MagickException; /** * Get the pixels as 8-bit components from the image. * * @param x x coordinate of the origin of the subimage * @param y y coordinate of the origin of the subimage * @param width width of the subimage * @param height height of the subimage * @param map component order of the pixels * @param pixels pixels of the subimage * @return a boolean value indicating success * @throws MagickException on error */ public native boolean dispatchImage(int x, int y, int width, int height, String map, byte[] pixels) throws MagickException; /** * Get the pixels as 32-bit components from the image. * * @param x x coordinate of the origin of the subimage * @param y y coordinate of the origin of the subimage * @param width width of the subimage * @param height height of the subimage * @param map component order of the pixels * @param pixels pixels of the subimage * @return a boolean value indicating success * @throws MagickException on error */ public native boolean dispatchImage(int x, int y, int width, int height, String map, int[] pixels) throws MagickException; /** * Get the pixels as float components from the image. * * @param x x coordinate of the origin of the subimage * @param y y coordinate of the origin of the subimage * @param width width of the subimage * @param height height of the subimage * @param map component order of the pixels * @param pixels pixels of the subimage * @return a boolean value indicating success * @throws MagickException on error */ public native boolean dispatchImage(int x, int y, int width, int height, String map, float[] pixels) throws MagickException; /** * Return the image format (i.e., Gif, Jpeg,...) * * @return the string representing the image format * @throws MagickException on error * @author Abdulbaset Gaddah <agaddah@yahoo.com> */ public native String getMagick() throws MagickException; public String getImageFormat() throws MagickException { return getMagick(); } /* * Set the image format (i.e., Gif, Jpeg,...). * * @param imageFormat new image format * @throws MagickException on error * @author Abdulbaset Gaddah <agaddah@yahoo.com> */ public native void setMagick(String imageFormat) throws MagickException; public void setImageFormat(String imageFormat) throws MagickException { setMagick(imageFormat); } /** * Return the number of unique colors in an image. * @return the number of unique colors * @throws MagickException on error * @author Abdulbaset Gaddah <agaddah@yahoo.com> */ public native int getNumberColors() throws MagickException; /* * Set the number of unigue colors in an image. * * @param numberColors new number of unigue colors in an image * @throws MagickException on error * @author Abdulbaset Gaddah <agaddah@yahoo.com> */ public native void setNumberColors(int numberColors) throws MagickException; /** * Returns True if the Gif image is Animated otherwise False is returned. * * @return a boolean value representing the animated status of the image * @throws MagickException on error * @author Abdulbaset Gaddah <agaddah@yahoo.com> */ public native boolean isAnimatedImage() throws MagickException; /** * Creates a new image that is a rotated copy of an existing one. * Positive angles rotate counter-clockwise (right-hand rule), while * negative angles rotate clockwise. Rotated images are usually larger * than the originals and have 'empty' triangular corners. X axis. * Empty triangles left over from shearing the image are filled with * the color defined by the pixel at location (0,0). * * @param degrees angle of rotation. * @return A image that is a rotation of self * @throws MagickException on error */ public native MagickImage rotateImage(double degrees) throws MagickException; /** * Creates a new image that is a shear_image copy of an existing one. * Shearing slides one edge of an image along the X or Y axis, creating * a parallelogram. An X direction shear slides an edge along the X axis, * while a Y direction shear slides an edge along the Y axis. The amount * of the shear is controlled by a shear angle. For X direction shears, * x_shear is measured relative to the Y axis, and similarly, for Y * direction shears y_shear is measured relative to the X axis. Empty * triangles left over from shearing the image are filled with the color * defined by the pixel at location (0,0). * * @param x_shear x direction shear amount * @param y_shear y direction shear amount * @return a sheared image constructor from self. * @throws MagickException on error */ public native MagickImage shearImage(double x_shear, double y_shear) throws MagickException; /** * Analyzes the colors within a reference image and chooses a * fixed number of colors to represent the image. The goal of * the algorithm is to minimize the difference between the input * and output image while minimizing the processing time. * * @param quantizeInfo contains parameters for quantization * @return a boolean value indicating success of the process * @throws MagickException on error */ public native boolean quantizeImage(QuantizeInfo quantizeInfo) throws MagickException; /** * Convert any colored image to grayscale. * * @deprecated Use QuantizeInfo with MagickImage.quantizeImage * to acheive the same effect. * @throws MagickException on error */ public void setGrayscale() throws MagickException { QuantizeInfo quantizeInfo = new QuantizeInfo(); quantizeInfo.setColorspace(ColorspaceType.GRAYColorspace); quantizeInfo.setNumberColors(256); quantizeInfo.setTreeDepth(8); quantizeImage(quantizeInfo); } /** * Get the colorspace of the image. * * @return the colorspace as defined in ColorspaceType * @see ColorspaceType * @throws MagickException on error */ public native int getColorspace() throws MagickException; /** * Creates a new image that is a copy of an existing one with the * pixels sharpened. * * @param raduis The radius of the gaussian, in pixels, not counting \ the center pixel * @param sigma The standard deviation of the gaussian, in pixels * * @return a sharpened image. * @throws MagickException on error */ public native MagickImage sharpenImage(double raduis, double sigma) throws MagickException; /** * Creates a new image that is a copy of an existing one with the * speckle noise minified. It uses the eight hull algorithm described * in Applied Optics, Vol. 24, No. 10, 15 May 1985, ``Geometric filter * for Speckle Reduction'', by Thomas R Crimmins. Each pixel in the * image is replaced by one of its eight of its surrounding pixels * using a polarity and negative hull function. * * @return a despeckled image * @throws MagickException on error */ public native MagickImage despeckleImage() throws MagickException; /** * Applies a general image convolution kernel to an image returns * the results. ConvolveImage allocates the memory necessary for * the new Image structure and returns a pointer to the new image. * * @param order The number of columns and rows in the filter kernel. * @param kernel An array of double representing the convolution kernel * * @return a convoled image * @throws MagickException on error */ public native MagickImage convolveImage(int order, double[] kernel) throws MagickException; /** * Searches the list of image attributes and returns * the value of the attribute if it exists otherwise null. * * @param key the key of the attribute * @return the value of the attribute if exists, otherwise, null. * @throws MagickException on error */ public native String getImageAttribute(String key) throws MagickException; /** * Searches the list of image attributes and replaces the * attribute value. If it is not found in the list, the attribute name * and value is added to the list. SetImageAttribute returns True if the * attribute is successfully replaced or added to the list, otherwise * False. If the value is null, the matching key is deleted from the list. * * @param key the key of the attribute * @param value the value of the attribute * @return true if the attribute is replace or false if added * @throws MagickException on error */ public native boolean setImageAttribute(String key, String value) throws MagickException; /** * Takes from memory an image in a known format and read it into * itself. * * @param imageInfo a ImageInfo instance * @param blob memory containing an image in a known format * @throws MagickException on error */ public native void blobToImage(ImageInfo imageInfo, byte[] blob) throws MagickException; /** * Returns an array that contents the image format. * * @param imageInfo the magick member of this object determines * output format * @return a byte array containing the image in the specified format */ public native byte[] imageToBlob(ImageInfo imageInfo); /** * Returns the image sequence as a blob and its length. * * @param imageInfo the magick member of this object determines * output format * @return a byte array containing the image in the specified format */ public native byte[] imagesToBlob(ImageInfo imageInfo); /** * Set the units attribute of the image. * * @param resolutionType the resolution type as defined in ResolutionType * @see ResolutionType * @throws MagickException on error */ public native void setUnits(int resolutionType) throws MagickException; /** * Get the units attribute of the image. * * @return A integer representing the resolution type as defined * in ResolutionType * @see ResolutionType * @throws MagickException on error */ public native int getUnits() throws MagickException; /** * Set the x_resolution attribute in the image. * * @param xRes x_resolution value * @throws MagickException on error */ public native void setXResolution(double xRes) throws MagickException; /** * Get the x_resolution attribute in the image. * * @return x_resolution value * @throws MagickException on error */ public native double getXResolution() throws MagickException; /** * Get the y_resolution attribute in the image. * * @param yRes y_resolution value * @throws MagickException on error */ public native void setYResolution(double yRes) throws MagickException; /** * Get the y_resolution attribute in the image. * * @return y_resolution value * @throws MagickException on error */ public native double getYResolution() throws MagickException; /** * Return image object for next image in sequence of frames. * Also sets the next image pointer to NULL. * * @return next image or null if end of list. * @throws MagickException on error */ protected native MagickImage nextImage() throws MagickException; /** * Check if the image has multiple frames. * * @return true if the image has multiple frames, false, otherwise. * @throws MagickException on error */ public native boolean hasFrames() throws MagickException; /* * Count the number of frames in image. * * @return number of frame in image * @throws MagickException on error */ public native int getNumFrames() throws MagickException; /** * Destructively create array of image frames. Contains this image * as the first object and frames in sequence. * * @return an array of image frame * @throws MagickException on error */ public MagickImage[] breakFrames() throws MagickException { int length = getNumFrames(); MagickImage[] list = new MagickImage[length]; MagickImage image = this; for (int i = 0; i < length && image != null; i++) { list[i] = image; image = image.nextImage(); } return list; } /** * Set a new color profile for the image. * @param profile a new color profile. This parameter cannot be null. * Note: The profile.name attribute is ignored * @see #profileImage * @throws MagickException if an error occurs */ public native void setColorProfile(ProfileInfo profile) throws MagickException; /** * Obtain the color profile from the image. * @return the color profile of the image * @see #profileImage * @throws MagickException if an error occurs */ public native ProfileInfo getColorProfile() throws MagickException; /** * Set a new IPTC profile for the image. * @param profile a new IPTC profile. This parameter cannot be null. * Note: The profile.name attribute is ignored * @see #profileImage * @throws MagickException if an error occurs */ public native void setIptcProfile(ProfileInfo profile) throws MagickException; /** * Obtain the IPTC profile from the image. * @return the IPTC profile of the image * @see #profileImage * @throws MagickException if an error occurs */ public native ProfileInfo getIptcProfile() throws MagickException; /** * Return the number of generic profiles. * @return number of generic profiles * @deprecated No longer works (after ImageMagick 5.5.7 ?) * @throws MagickException if the profile count cannot be retrieved */ public native int getGenericProfileCount() throws MagickException; /** * Return the generic profile specified by the index. * @param i the index of the generic profile to retrieve * @return a generic ProfileInfo if found, null otheriwse. * @deprecated No longer works (after ImageMagick 5.5.7 ?) * @throws MagickException if an error occurs */ public native ProfileInfo getGenericProfile(int i) throws MagickException; /** * ProfileImage adds or removes a ICM, IPTC, or generic profile * from an image. If the profile name is defined it is deleted * from the image. If a filename is given, one or more profiles * are read and added to the image. * @param profileName name of profile to add or remove * @param profileData contents of the profile * @return Returns a true if the profile is successfully added or removed * @throws MagickException if an error occurs */ public native boolean profileImage(String profileName, byte[] profileData) throws MagickException; /** * SetImageProfile() adds a named profile to the image. If a profile with * the same name already exists, it is replaced. This method differs from * the ProfileImage() method in that it does not apply CMS color profiles. * @param profileName the profile name, for example icc, exif, and 8bim (8bim is the Photoshop wrapper for iptc profiles). * @param profileData contents of the profile * @return Returns a true if the profile is successfully set * @author Jacob Nordfalk * @since JMagick 6.3.9 * @throws MagickException if an error occurs * @see The ImageMagick SetImageProfile documentation */ public native boolean setImageProfile(String profileName, byte[] profileData) throws MagickException; /** * GetImageProfile() gets a profile associated with an image by name. * @param profileName name of profile get * @return contents of the profile * @author Jacob Nordfalk * @since JMagick 6.3.9 * @throws MagickException if an error occurs * @see The ImageMagick GetImageProfile documentation */ public native byte[] getImageProfile(String profileName) throws MagickException; /** * GetNextImageProfile() gets the next profile name associated with an image. * * @return the profile name * @author Jonathan Horowitz * @throws MagickException if an error occurs * @see The ImageMagick GetNextImageProfile documentation */ public native String getNextImageProfile() throws MagickException; /** * Resets the image profile iterator. * * @author Jonathan Horowitz * @throws MagickException if an error occurs */ public native void resetImageProfileIterator() throws MagickException; /** * Create a montage of all the images in the list. * @param montageInfo parameter used in the creation of the montage * @return a montage of all images in the list * @throws MagickException if an error occurs */ public native MagickImage montageImages(MontageInfo montageInfo) throws MagickException; /** * This operator reads and resets the EXIF image profile setting 'Orientation' * and then performs the appropriate 90 degree rotation on the image * to orient the image, for correct viewing. * @return a new image operated * @throws MagickException upon errors */ public native MagickImage autoOrientImage() throws MagickException; /** * The Average() method takes a set of images and * averages them together. Each image in the set must * have the same width and height. * @return an image with the pixel component of each image averaged. * @throws MagickException upon errors */ public native MagickImage averageImages() throws MagickException; /** * Adjusts the levels of an image given these points: black, * mid, and white. * @param levels String representing the black, mid and white levels * @return true if successful, false otherwise. */ public native boolean levelImage(String levels) throws MagickException; /** * Returns the current length of the image file or blob. * @return current length of the image file or blob */ public native int sizeBlob() throws MagickException; /** * Set the compression attribute. * This will affect a following call to writeImage * @see #writeImage * @param value a value from CompressionType * @see CompressionType * @see Command line explanation * @throws MagickException on error */ public native void setCompression(int value) throws MagickException; /** * Get the CompressionType of the image. * @return the compression as defined in CompressionType * @throws MagickException on error * @see CompressionType * @author Susan Dorr <sdorr@contentcube.com> */ public native int getCompression() throws MagickException; /** * Get the image type from the MagickImage * @see ImageType * @author Susan Dorr <sdorr@contentcube.com> */ public native int getImageType() throws MagickException; /** * Set the border colour for the method borderImage. * @param color the border colour * @see #borderImage * @throws MagickException on error */ public native void setBorderColor(PixelPacket color) throws MagickException; /** * Get the current border colour used by method borderImage. * @return the current border colour * @see #borderImage * @throws MagickException on error */ public native PixelPacket getBorderColor() throws MagickException; /** * Set the background colour. * @param color the background colour * @throws MagickException on error */ public native void setBackgroundColor(PixelPacket color) throws MagickException; /** * Get the current background colour. * @return the current background colour * @throws MagickException on error */ public native PixelPacket getBackgroundColor() throws MagickException; /** * Set the time in 1/100ths of a second (0 to 65535) which must * expire before displaying the next image in an animated sequence. * This option is useful for regulating the animation of a sequence * of GIF images within Netscape. * @param delay the time delay in 1/100th of a second * @throws MagickException upon error */ public native void setDelay(int delay) throws MagickException; /** * Get the time in 1/100ths of a second (0 to 65535) which must * expire before displaying the next image in an animated sequence. * This option is useful for regulating the animation of a sequence * of GIF images within Netscape. * @return the current time delay in 1/100th of a second * @throws MagickException upon error */ public native int getDelay() throws MagickException; /** * Set the GIF disposal method. This option is used to control how * successive frames are rendered (how the preceding frame is disposed * of) when creating a GIF animation. * @param dispose the disposal method for GIF animation * @throws MagickException upon error */ public native void setDispose(int dispose) throws MagickException; /** * Get the GIF disposal method. This option is used to control how * successive frames are rendered (how the preceding frame is disposed * of) when creating a GIF animation. * @return the current disposal method for GIF animation * @throws MagickException upon error */ public native int getDispose() throws MagickException; /** * Set the number of iterations to loop an animation (e.g. Netscape * loop extension) for. * @param iterations the number of iterations * @throws MagickException upon error */ public native void setIterations(int iterations) throws MagickException; /** * Get the number of iterations to loop an animation (e.g. Netscape * loop extension) for. * @return the current number of iterations * @throws MagickException upon error */ public native int getIterations() throws MagickException; /** * The number of colors in the colourmap. * @return the current number of colors in the image * @see #quantizeImage * @throws MagickException upon error */ public native int getColors() throws MagickException; /** * Get the The number of colors in the image after QuantizeImage(), * or QuantizeImages(). * @return the current number of colors in the image * @throws MagickException upon error */ public native int getTotalColors() throws MagickException; /** * Get the colour specified by the index. * @param index the index for which to return a colour * @return the colour of the index * @throws MagickException upon error */ public native PixelPacket getColormap(int index) throws MagickException; /** * Get the entire colour map. * @return the colour map of the image * @throws MagickException upon error */ public native PixelPacket[] getColormap() throws MagickException; /** * Get the colour at the specified row and column * @param x the x position of the pixel to fetch * @param y the y position of the pixel to fetch * @return the colour of the index * @throws MagickException upon error */ public native PixelPacket getOnePixel(int x, int y) throws MagickException; /** * Determine signature of image and place signature * in the image's attributes. * @return true if successful, false, otherwise * @throws MagickException on error * @author Elizabeth Barham <soggytrousers@yahoo.com> */ public native boolean signatureImage() throws MagickException; /** * @return the quality the image was saved * @throws MagickException on error */ public native int getQuality() throws MagickException; // Set the quality attribute. public native void setQuality(int value) throws MagickException; /** * Set the intent attribute of the image. * @param renderingIntent the rendering Intent type as defined in RenderingIntent * @see RenderingIntent * @throws MagickException on error */ public native void setRenderingIntent(int renderingIntent) throws MagickException; /** * Get the intent attribute of the image. * @return A integer representing the rendering Intent type as defined * in RenderingIntent * @throws MagickException on error */ public native int getRenderingIntent() throws MagickException; /** * Set the matte attribute of the image. * @param matte the matte value * @throws MagickException on error */ public native void setMatte(boolean matte) throws MagickException; /** * Get the matte attribute of the image. * @return A boolean representing the value of the matte attribute * @throws MagickException on error */ public native boolean getMatte() throws MagickException; /** * Get the number of images * @return number of images * @throws MagickException */ public native int getNumberImages() throws MagickException; /** * Strips an image of all profiles and comments.. * * @throws MagickException on error */ public native boolean strip() throws MagickException; /** * formatMagickCaption in fact does not need an Image Object * @see The ImageMagick FormatMagickCaption documentation * @param maxWidth * @param draw_info the draw info. (text field is changed) * @param caption the caption, newlines are inserted * @return output String * @throws MagickException */ public TypeMetric formatMagickCaption(int maxWidth, DrawInfo draw_info, StringBuilder caption) throws MagickException { return this.formatMagickCaption(maxWidth, 0, false, draw_info, caption); } /** * * @param maxWidth * @param indent2ndLine * @param trimLineEnds if line ends with "xyz \n" line might be wrapped at the first space, " \n" will produce an empty line - that option deletes whitespaces before \n * @param draw_info the draw info. (text field is changed) * @param caption the caption, newlines are inserted * @return * @throws MagickException */ public TypeMetric formatMagickCaption(int maxWidth, int indent2ndLine, boolean trimLineEnds, DrawInfo draw_info, StringBuilder caption) throws MagickException { int lastSpacePos=-1; int lastNewlinePos=0; if(trimLineEnds) { String tmp=caption.toString().replaceAll("[\t ]+\n", "\n"); // " \n" => "\n" caption.setLength(0); caption.append(tmp); } StringBuilder ret=new StringBuilder(caption); caption.append(" "); // append space at end of string to check for linebreak at end of string int lineNr=0; TypeMetric retTypeMetric=null; TypeMetric lastTypeMetric=null; for(int i=0, len=caption.length(); i < len; i++) { if(Character.isWhitespace(caption.charAt(i))) { // check if char == whitespace or end of string // System.out.println("check text: "+caption.substring(lastNewlinePos,i)); draw_info.setText(caption.substring(lastNewlinePos,i)); TypeMetric typeMetric=this.getTypeMetrics(draw_info); // System.out.println(" width:"+typeMetric.width); if(retTypeMetric == null) retTypeMetric = typeMetric; if(lastTypeMetric == null) lastTypeMetric = typeMetric; if(typeMetric.width > (maxWidth - (lineNr >= 1 ? indent2ndLine : 0))) { if(lastSpacePos >= 0) { // only place newline at last saved position if we already had a whitespace ret.setCharAt(lastSpacePos,'\n'); lastNewlinePos=lastSpacePos+1; lastSpacePos=i; if(retTypeMetric.width < lastTypeMetric.width) retTypeMetric = lastTypeMetric; } lineNr++; } else { if(i > 0 && Character.isWhitespace(caption.charAt(i-1))) { // last character already was a whitespace } else { lastSpacePos=i; } } if(caption.charAt(i) == '\n') { // current char is a newline, place newline: lastNewlinePos=i+1; lastSpacePos=-1; lineNr++; if(retTypeMetric.width < lastTypeMetric.width) retTypeMetric = lastTypeMetric; } lastTypeMetric=typeMetric; } } caption.setLength(0); caption.append(ret.toString()); if(retTypeMetric == null) { // empty string draw_info.setText(caption.toString()); retTypeMetric=this.getTypeMetrics(draw_info); } return retTypeMetric; } /** * Sets the colorspace member of the Image structure. * * @param colorspace An unsigned integer value defines which \ colorspace to transform the image to * @return a boolean value indicating success * @author Jonathan Horowitz * @throws MagickException on error */ public native boolean setImageColorspace(int colorspace) throws MagickException; /** * Return a new image that is a resized version of the * original, with the specified filter applied. To scale a scanline from x pixels to y pixels, each new * pixel represents x/y old pixels. To read x/y pixels, read * (x/y rounded up) pixels but only count the required fraction of * the last old pixel read in your new pixel. The remainder of the * old pixel will be counted in the next new pixel. * @param cols An integer that specifies the number of columns in \ the scaled image * @param rows An integer that specifies the number of rows in the \ scaled image * @return the scaled image * @throws MagickException on error */ public native MagickImage resizeImage(int cols, int rows, int filter, double blur) throws MagickException; /** * Transforms an image colorspace. * * @param colorspace An unsigned integer value defines which \ colorspace to transform the image to * @return a boolean value indicating success * @throws MagickException on error */ public native boolean transformImageColorspace(int colorspace) throws MagickException; public native MagickImage deconstructImages() throws MagickException; public native MagickImage optimizeLayer(ImageInfo imageInfo) throws MagickException; } techblue-jmagick-b4412af/src/magick/MagickInfo.java000066400000000000000000000021631452765401600222250ustar00rootroot00000000000000package magick; /** * Encapsulation of the MagickInfo structure. * * @author Susan Dorr */ public class MagickInfo extends Magick { // Internal handle. Used as pointer to MagickInfo // structure in memory. We use long (64-bits) for // portibility. private long magickInfoHandle = 0; /** * Constructor. * * @param name the name * @throws MagickException on error */ public MagickInfo(String name) throws MagickException { init(name); } /** * Automated destructor. */ public void finalize() { destroyMagickInfo(); } /** * Initialise the MagickInfo structure. * * @param name the name * @throws MagickException on error */ public native void init(String name) throws MagickException; /** * Deallocate the MagickInfo structure. */ private native void destroyMagickInfo(); /** * Return the description attribute of the handle. * * @return the description * @throws MagickException on error */ public native String getDescription() throws MagickException; } techblue-jmagick-b4412af/src/magick/MagickLoader.java000066400000000000000000000005201452765401600225330ustar00rootroot00000000000000package magick; /** * The sole purpouse of this class is to cause the native * library to be loaded in SYSTEM classloader whenever a * concrete class is used. * * @author Max Kollegov <Virtual_Max@geocities.com> */ public class MagickLoader { static { System.loadLibrary("JMagick"); } } techblue-jmagick-b4412af/src/magick/MagickProducer.java000066400000000000000000000104651452765401600231210ustar00rootroot00000000000000package magick; import java.awt.image.ImageProducer; import java.awt.image.ImageConsumer; import java.awt.image.DirectColorModel; import java.awt.Dimension; import java.util.Vector; import magick.MagickImage; import magick.MagickException; /** * This class implements the ImageProducer class. * It reads the pixels off a MagickImage and sends * the pixels to the specified ImageConsumer. * * @author Eric Yeo */ public class MagickProducer extends Magick implements ImageProducer { /** * This keeps a copy of the image. */ private MagickImage image = null; private Vector consumers = null; /** * Constructor. * * @param image the MagickImage to produce an Image from */ public MagickProducer(MagickImage image) { this.image = image; consumers = new Vector(); } /** * This method is used to register an ImageConsumer with the * ImageProducer for access to the image data during a later * reconstruction of the Image. * * @param consumer to register with the producer */ public void addConsumer(ImageConsumer consumer) { if (consumer != null && !consumers.contains(consumer)) { consumers.addElement(consumer); } } /** * This method determines if a given ImageConsumer object is * currently registered with this ImageProducer as one of its * consumers. * * @param consumer to consumer to register with the producer */ public boolean isConsumer(ImageConsumer consumer) { return consumers.contains(consumer); } /** * This method removes the given ImageConsumer object from the * list of consumers currently registered to receive image data. * It is not considered an error to remove a consumer that is * not currently registered. * * @param consumer the consumer to check for registration */ public void removeConsumer(ImageConsumer consumer) { consumers.removeElement(consumer); } /** * This method both registers the given ImageConsumer object * as a consumer and starts an immediate reconstruction of the * image data which will then be delivered to this consumer and * any other consumer which may have already been registered * with the producer. * * @param consumer to be registered before producing the image */ public void startProduction(ImageConsumer consumer) { addConsumer(consumer); // Get the pixels from the image Dimension dim; int size; byte[] pixels; try { dim = image.getDimension(); size = dim.width * dim.height; pixels = new byte[size*4]; image.dispatchImage(0, 0, dim.width, dim.height, "RGBA", pixels); } catch(MagickException ex) { for (int i = 0; i < consumers.size(); i++) { ImageConsumer aConsumer = (ImageConsumer) consumers.elementAt(i); aConsumer.imageComplete(ImageConsumer.IMAGEERROR); } return; } // Set the pixels in the consumers int[] img = new int[size]; DirectColorModel cmodel = new DirectColorModel(32, 255 << 24, 255 << 16, 255 << 8, 255); for (int i = 0; i < size; i++) { img[i] = ((pixels[i*4] & 255) << 24) | ((pixels[i*4+1] & 255) << 16) | ((pixels[i*4+2] & 255) << 8) | (pixels[i*4+3] & 255); } for (int i = 0; i < consumers.size(); i++) { ImageConsumer aConsumer = consumers.elementAt(i); aConsumer.setHints(ImageConsumer.TOPDOWNLEFTRIGHT| ImageConsumer.COMPLETESCANLINES| ImageConsumer.SINGLEPASS| ImageConsumer.SINGLEFRAME); aConsumer.setDimensions(dim.width, dim.height); aConsumer.setPixels(0, 0, dim.width, dim.height, cmodel, img, 0, dim.width); aConsumer.imageComplete(ImageConsumer.STATICIMAGEDONE); } } /** * This method is used by an ImageConsumer to request that the * ImageProducer attempt to resend the image data one more time * in TOPDOWNLEFTRIGHT order so that higher quality conversion * algorithms which depend on receiving pixels in order can be * used to produce a better output version of the image. * * @param consumer the consumer to register before producing the image */ public void requestTopDownLeftRightResend(ImageConsumer consumer) { startProduction(consumer); } } techblue-jmagick-b4412af/src/magick/Makefile000066400000000000000000000031321452765401600210100ustar00rootroot00000000000000# # Source level Makefile for JMagick. # # NOTE: Define DESTDIR if you are not installing JMagick # to its final directories. This is meant for the # purpose of packaging. # Contributed by Adam Heath # include ../../Make.def JAVA_SRC_FILES = \ Magick.java \ MagickException.java \ MagickApiException.java \ ExceptionType.java \ ProfileInfo.java \ PixelPacket.java \ ImageInfo.java \ ClassType.java \ ColorspaceType.java \ CompositeOperator.java \ CompressionType.java \ FilterType.java \ GeometryFlags.java \ GravityType.java \ DrawInfo.java \ ImageMagick.java \ DecorationType.java \ ImageType.java \ InterlaceType.java \ QuantizeInfo.java \ MontageInfo.java \ MagickImage.java \ NoiseType.java \ PaintMethod.java \ PreviewType.java \ PrimitiveType.java \ RenderingIntent.java \ ResolutionType.java \ MagickProducer.java \ MagickLoader.java \ MagickInfo.java # JNI specifications JNI_LIB_NAME = JMagick JNI_SRC_FILES = PixelPacket.java \ ImageInfo.java \ QuantizeInfo.java \ DrawInfo.java \ MagickImage.java \ MontageInfo.java \ Magick.java \ MagickInfo.java JNI_LINK_LIBS = $(MAGICK_LIBS) JNI_EXTRAS = jmagick.c INCLUDES = $(JAVA_INCLUDES) $(MAGICK_INCLUDES) $(X11_INCLUDES) DIRS = util CLEAN_LIST = $(JNI_LIB) $(LIB_DIR)/.libs include ../../Make.rules test: LD_LIBRARY_PATH=. java $(CLASS_PATH) magick.Test extra-install:: $(INSTALL) -d $(DESTDIR)$(libdir) $(LIBTOOL) --mode=install $(INSTALL) $(JNI_LIB) $(DESTDIR)$(libdir) techblue-jmagick-b4412af/src/magick/MapMode.java000066400000000000000000000005661452765401600215450ustar00rootroot00000000000000package magick; /** * Corresponds to ImageMagick enumerated type of the same name. * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/blob.h * @author Eric Yeo */ public interface MapMode { public final int ReadMode = 0; public final int WriteMode = 1; public final int IOMode = 2; } techblue-jmagick-b4412af/src/magick/MontageInfo.java000066400000000000000000000205321452765401600224240ustar00rootroot00000000000000package magick; /** * Encapsulation of the MontageInfo structure. * @author Eric Yeo */ public class MontageInfo { /** * Internal ImageMagick MontageInfo handle. * We use long (64-bits) for portability. */ private long montageInfoHandle = 0; /** * Constructor. * @param imageInfo contains initial values for MontageInfo * @throws MagickException upon irrecoverable errors */ public MontageInfo(ImageInfo imageInfo) throws MagickException { init(imageInfo); } /** * To release memory on cleanup. */ protected void finalize() { destroyMontageInfo(); } /** * Initialises the MontageInfo structure. * @param imageInfo used in the initialisation of MontageInfo * @throws MagickException upon irrecoverable errors */ private native void init(ImageInfo imageInfo) throws MagickException; /** * Deallocate the handle used for MontageInfo. */ private native void destroyMontageInfo(); /** * Set the geometry string value. * @param str new geometry value * @throws MagickException upon irrecoverable errors */ public native void setGeometry(String str) throws MagickException; /** * Get the geometry string value. * @return the current geometry value * @throws MagickException upon irrecoverable errors */ public native String getGeometry() throws MagickException; /** * Set the tile string value. * @param str new tile value * @throws MagickException upon irrecoverable errors */ public native void setTile(String str) throws MagickException; /** * Get the tile string value. * @return the current tile value * @throws MagickException upon irrecoverable errors */ public native String getTile() throws MagickException; /** * Set the title string value. * @param str new title value * @throws MagickException upon irrecoverable errors */ public native void setTitle(String str) throws MagickException; /** * Get the title string value. * @return the current title value * @throws MagickException upon irrecoverable errors */ public native String getTitle() throws MagickException; /** * Set the frame string value. * @param str new frame value * @throws MagickException upon irrecoverable errors */ public native void setFrame(String str) throws MagickException; /** * Get the frame string value. * @return the current frame value * @throws MagickException upon irrecoverable errors */ public native String getFrame() throws MagickException; /** * Set the texture string value. * @param str new texture value * @throws MagickException upon irrecoverable errors */ public native void setTexture(String str) throws MagickException; /** * Get the texture string value. * @return the current texture value * @throws MagickException upon irrecoverable errors */ public native String getTexture() throws MagickException; /** * Set the font string value. * @param str new font value * @throws MagickException upon irrecoverable errors */ public native void setFont(String str) throws MagickException; /** * Get the font string value. * @return the current font value * @throws MagickException upon irrecoverable errors */ public native String getFont() throws MagickException; /** * Set the pointsize value. * @param pointsize new pointsize value * @throws MagickException upon irrecoverable errors */ public native void setPointSize(double pointsize) throws MagickException; /** * Get the pointsize value. * @return the current pointsize value * @throws MagickException upon irrecoverable errors */ public native double getPointSize() throws MagickException; /** * Set the border_width value. * @param borderWidth new border_width value * @throws MagickException upon irrecoverable errors */ public native void setBorderWidth(int borderWidth) throws MagickException; /** * Get the border_width value. * @return the current border_width value * @throws MagickException upon irrecoverable errors */ public native int getBorderWidth() throws MagickException; /** * Set the gravity value. * @param gravity new gravity value * @throws MagickException upon irrecoverable errors * @see GravityType */ public native void setGravity(int gravity) throws MagickException; /** * Get the gravity value. * @return the current gravity value * @throws MagickException upon irrecoverable errors * @see GravityType */ public native int getGravity() throws MagickException; /** * Set the shadow flag. * @param shadow new shadow flag * @throws MagickException upon irrecoverable errors */ public native void setShadow(boolean shadow) throws MagickException; /** * Get the shadow flag. * @return the current shadow flag * @throws MagickException upon irrecoverable errors */ public native boolean getShadow() throws MagickException; /** * Set the fill PixelPacket value. * @param fill new fill PixelPacket value * @throws MagickException upon irrecoverable errors */ public native void setFill(PixelPacket fill) throws MagickException; /** * Get the fill PixelPacket value * @return the current fill PixelPacket value * @throws MagickException upon irrecoverable errors */ public native PixelPacket getFill() throws MagickException; /** * Set the stroke PixelPacket value. * @param stroke new stroke PixelPacket value * @throws MagickException upon irrecoverable errors */ public native void setStroke(PixelPacket stroke) throws MagickException; /** * Get the stroke PixelPacket value * @return the current stroke PixelPacket value * @throws MagickException upon irrecoverable errors */ public native PixelPacket getStroke() throws MagickException; /** * Set the background_color PixelPacket value. * @param backgroundColor new background_color PixelPacket value * @throws MagickException upon irrecoverable errors */ public native void setBackgroundColor(PixelPacket backgroundColor) throws MagickException; /** * Get the background_color PixelPacket value * @return the current background_color PixelPacket value * @throws MagickException upon irrecoverable errors */ public native PixelPacket getBackgroundColor() throws MagickException; /** * Set the border_color PixelPacket value. * @param borderColor new border_color PixelPacket value * @throws MagickException upon irrecoverable errors */ public native void setBorderColor(PixelPacket borderColor) throws MagickException; /** * Get the border_color PixelPacket value * @return the current border_color PixelPacket value * @throws MagickException upon irrecoverable errors */ public native PixelPacket getBorderColor() throws MagickException; /** * Set the matte_color PixelPacket value. * @param matteColor new matte_color PixelPacket value * @throws MagickException upon irrecoverable errors */ public native void setMatteColor(PixelPacket matteColor) throws MagickException; /** * Get the matte_color PixelPacket value * @return the current matte_color PixelPacket value * @throws MagickException upon irrecoverable errors */ public native PixelPacket getMatteColor() throws MagickException; /** * Set the filename value. * @param filename new filename value * @throws MagickException upon irrecoverable errors */ public native void setFileName(String filename) throws MagickException; /** * Get the filename value * @return the current filename value * @throws MagickException upon irrecoverable errors */ public native String getFileName() throws MagickException; } techblue-jmagick-b4412af/src/magick/MontageMode.java000066400000000000000000000006611452765401600224160ustar00rootroot00000000000000package magick; /** * Corresponds to ImageMagick enumerated type of the same name. * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/montage.h * @author Eric Yeo */ public interface MontageMode { public final int UndefinedMode = 0; public final int FrameMode = 1; public final int UnframeMode = 2; public final int ConcatenateMode = 3; } techblue-jmagick-b4412af/src/magick/NoiseType.java000066400000000000000000000011751452765401600221370ustar00rootroot00000000000000package magick; /** * Corresponds to ImageMagick enumerated type of the same name. * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/fx.h */ public interface NoiseType { public final static int UndefinedNoise = 0; public final static int UniformNoise = 1; public final static int GaussianNoise = 2; public final static int MultiplicativeGaussianNoise = 3; public final static int ImpulseNoise = 4; public final static int LaplacianNoise = 5; public final static int PoissonNoise = 6; public final static int RandomNoise = 7; } techblue-jmagick-b4412af/src/magick/PaintMethod.java000066400000000000000000000007631452765401600224360ustar00rootroot00000000000000package magick; /** * Corresponds to ImageMagick enumerated type of the same name. * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/draw.h */ public interface PaintMethod { public final int UndefinedMethod = 0; public final int PointMethod = 1; public final int ReplaceMethod = 2; public final int FloodfillMethod = 3; public final int FillToBorderMethod = 4; public final int ResetMethod = 5; } techblue-jmagick-b4412af/src/magick/PixelPacket.java000066400000000000000000000052401452765401600224260ustar00rootroot00000000000000package magick; public class PixelPacket extends Magick { private int red, green, blue, opacity; /** * Constructor * * @param red the red channel value * @param green the green channel value * @param blue the blue channel value * @param opacity the opacity/alpha channel value */ public PixelPacket(int red, int green, int blue, int opacity) { this.red = red; this.green = green; this.blue = blue; this.opacity = opacity; } /** * Set the red channel value. * * @param red the new red channel value */ public void setRed(int red) { this.red = red; } /** * Set the green channel value. * * @param green the new green channel value */ public void setGreen(int green) { this.green = green; } /** * Set the blue channel value. * * @param blue the new blue channel value */ public void setBlue(int blue) { this.blue = blue; } /** * Set the opacity/alpha channel value. * * @param opacity the new opacity/alpha channel value */ public void setOpacity(int opacity) { this.opacity = opacity; } /** * Get the red channel value. * * @return the red channel value */ public int getRed() { return red; } /** * Get the green channel value. * * @return the green channel value */ public int getGreen() { return green; } /** * Get the blue channel value. * * @return the blue channel value */ public int getBlue() { return blue; } /** * Get the opacity/alpha channel value. * * @return the opacity/alpha channel value */ public int getOpacity() { return opacity; } /** * looks up a RGB values for a color given in the target string. * * @param target Specifies the color to lookup in the X color database * @return a PixelPacket that represents the target * @throws MagickException on error */ public static native PixelPacket queryColorDatabase(String target) throws MagickException; /** * Converts a web (i.e. css-compliant) color string to a pixel packet. * * @param target Specifies the color string to convert * @return a PixelPacket that represents the target * @throws MagickException on error */ public static native PixelPacket getColor(String target) throws MagickException; /** * Display the object as a String */ @Override public String toString() { return "PixelPacket("+getRed()+","+getGreen()+","+getBlue()+","+getOpacity()+")"; } } techblue-jmagick-b4412af/src/magick/PreviewType.java000066400000000000000000000033151452765401600225010ustar00rootroot00000000000000package magick; /** * Corresponds to the ImageMagick enumerated type of the same name. * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/effect.h * @author Eric Yeo */ public interface PreviewType { public final static int UndefinedPreview = 0; public final static int RotatePreview = 1; public final static int ShearPreview = 2; public final static int RollPreview = 3; public final static int HuePreview = 4; public final static int SaturationPreview = 5; public final static int BrightnessPreview = 6; public final static int GammaPreview = 7; public final static int SpiffPreview = 8; public final static int DullPreview = 9; public final static int GrayscalePreview = 10; public final static int QuantizePreview = 11; public final static int DespecklePreview = 12; public final static int ReduceNoisePreview = 13; public final static int AddNoisePreview = 14; public final static int SharpenPreview = 15; public final static int BlurPreview = 16; public final static int ThresholdPreview = 17; public final static int EdgeDetectPreview = 18; public final static int SpreadPreview = 19; public final static int SolarizePreview = 20; public final static int ShadePreview = 21; public final static int RaisePreview = 22; public final static int SegmentPreview = 23; public final static int SwirlPreview = 24; public final static int ImplodePreview = 25; public final static int WavePreview = 26; public final static int OilPaintPreview = 27; public final static int CharcoalDrawingPreview = 28; public final static int JPEGPreview = 29; } techblue-jmagick-b4412af/src/magick/PrimitiveType.java000066400000000000000000000020631452765401600230270ustar00rootroot00000000000000package magick; /** * Corresponds to the ImageMagick enumerated type of the same name. * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/draw.h * @author Eric Yeo */ public interface PrimitiveType { public final static int UndefinedPrimitive = 0; public final static int AlphaPrimitive = 1; public final static int ArcPrimitive = 2; public final static int BezierPrimitive = 3; public final static int CirclePrimitive = 4; public final static int ColorPrimitive = 5; public final static int EllipsePrimitive = 6; public final static int ImagePrimitive = 7; public final static int LinePrimitive = 8; public final static int PathPrimitive = 9; public final static int PointPrimitive = 10; public final static int PolygonPrimitive = 11; public final static int PolylinePrimitive = 12; public final static int RectanglePrimitive = 13; public final static int RoundRectanglePrimitive = 14; public final static int TextPrimitive = 15; } techblue-jmagick-b4412af/src/magick/ProfileInfo.java000066400000000000000000000033311452765401600224300ustar00rootroot00000000000000package magick; /** * Class encapsulating some profile related to a image. * This class corresponds to the ProfileInfo structure in * the C API. ProfileInfo is currently used in the Image * structure to store the ICC and IPTC profiles. * @deprecated This class is only needed for the old (ImageMagick 5.5.7 ?) * methods get/setColorProfile() and get/setIptcProfile(). * Recommended is to use the new generic methods getImageProfile() and * setImageProfile() instead * @see MagickImage#setColorProfile * @author Eric Yeo <ttey@yeo.nu> */ public class ProfileInfo { /** * Name of the profile. */ String name = null; /** * Profile information. */ byte[] info = null; /** * Constructor. */ public ProfileInfo() { } /** * Constructor. * @param name name of the profile * @param info the profile information */ public ProfileInfo(String name, byte[] info) { this.name = name; this.info = info; } /** * Get the profile name. * @deprecated After ImageMagick 5.5.7 (?) names are not available * @return the profile name */ public String getName() { return name; } /** * Set the profile name. * * @param name the new profile name attribute value */ public void setName(String name) { this.name = name; } /** * Get the profile info. * * @return the profile info */ public byte[] getInfo() { return info; } /** * Set the profile info. * * @param info the new profile info attribute value */ public void setInfo(byte[] info) { this.info = info; } } techblue-jmagick-b4412af/src/magick/QuantizeInfo.java000066400000000000000000000066431452765401600226410ustar00rootroot00000000000000package magick; /** * Encapsulation of the QuantizedInfo structure. * * @author Eric Yeo * */ public class QuantizeInfo extends Magick { // Internal handle. Used as pointer to QuantizedInfo // structure in memory. We use long (64-bits) for // portibility. private long quantizeInfoHandle = 0; /** * Constructor. * * @throws MagickException on error */ public QuantizeInfo() throws MagickException { init(); } /** * Automated destructor. */ protected void finalize() { destroyQuantizeInfo(); } /** * Initialise the QuantizeInfo structure. * * @throws MagickException on error */ public native void init() throws MagickException; /** * Deallocate the QuantizeInfo structure. */ private native void destroyQuantizeInfo(); /** * Set the value of number_colors field in the QuantizeInfo structure. * * @param value new value of number_colors * * @throws MagickException on error */ public native void setNumberColors(int value) throws MagickException; /** * Return the value of number_colors field in the QuantizInfo structure. * * @return current value of number_colors field * * @throws MagickException on error */ public native int getNumberColors() throws MagickException; /** * Set the value of tree_depth field in the QuantizeInfo structure. * * @param value new value of tree_depth * * @throws MagickException on error */ public native void setTreeDepth(int value) throws MagickException; /** * Return the value of tree_depth field in the QuantizInfo structure. * * @return current value of tree_depth field * * @throws MagickException on error */ public native int getTreeDepth() throws MagickException; /** * Set the value of dither field in the QuantizeInfo structure. * * @param value new value of dither * * @throws MagickException on error */ public native void setDither(int value) throws MagickException; /** * Return the value of dither field in the QuantizInfo structure. * * @return current value of dither field * * @throws MagickException on error */ public native int getDither() throws MagickException; /** * Set the value of colorspace field in the QuantizeInfo structure. * * @param value new value of colorspace * @see ColorspaceType * * @throws MagickException on error */ public native void setColorspace(int value) throws MagickException; /** * Return the value of color_space field in the QuantizInfo structure. * * @return current value of color_space field * * @throws MagickException on error */ public native int getColorspace() throws MagickException; /** * Set the value of measure_error field in the QuantizeInfo structure. * * @param value new value of measure_error * * @throws MagickException on error */ public native void setMeasureError(int value) throws MagickException; /** * Return the value of measure_error field in the QuantizInfo structure. * * @return current value of measure_error field * * @throws MagickException on error */ public native int getMeasureError() throws MagickException; } techblue-jmagick-b4412af/src/magick/QuantumTypes.java000066400000000000000000000030131452765401600226700ustar00rootroot00000000000000package magick; /** * Corresponds to the ImageMagick enumerated type of the same name. * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/quantum.h * @author Eric Yeo */ public interface QuantumTypes { public static final int UndefinedQuantum = 0; public static final int AlphaQuantum = 1; public static final int BGRAQuantum = 2; public static final int BGROQuantum = 3; public static final int BGRQuantum = 4; public static final int BlackQuantum = 5; public static final int BlueQuantum = 6; public static final int CbYCrAQuantum = 7; public static final int CbYCrQuantum = 8; public static final int CbYCrYQuantum = 9; public static final int CMYKAQuantum = 10; public static final int CMYKOQuantum = 11; public static final int CMYKQuantum = 12; public static final int CyanQuantum = 13; public static final int GrayAlphaQuantum = 14; public static final int GrayQuantum = 15; public static final int GreenQuantum = 16; public static final int IndexAlphaQuantum = 17; public static final int IndexQuantum = 18; public static final int MagentaQuantum = 19; public static final int OpacityQuantum = 20; public static final int RedQuantum = 21; public static final int RGBAQuantum = 22; public static final int RGBOQuantum = 23; public static final int RGBPadQuantum = 24; public static final int RGBQuantum = 25; public static final int YellowQuantum = 26; } techblue-jmagick-b4412af/src/magick/RenderingIntent.java000066400000000000000000000007651452765401600233230ustar00rootroot00000000000000package magick; /** * Corresponds to the ImageMagick enumerated type of the same name. * * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/profile.h * * @author Eric Yeo */ public interface RenderingIntent { public final int UndefinedIntent = 0; public final int SaturationIntent = 1; public final int PerceptualIntent = 2; public final int AbsoluteIntent = 3; public final int RelativeIntent = 4; } techblue-jmagick-b4412af/src/magick/ResolutionType.java000066400000000000000000000006661452765401600232310ustar00rootroot00000000000000package magick; /** * Corresponds to the ImageMagick enumerated type of the same name. * * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/image.h */ public interface ResolutionType { public final static int UndefinedResolution = 0; public final static int PixelsPerInchResolution = 1; public final static int PixelsPerCentimeterResolution = 2; } techblue-jmagick-b4412af/src/magick/SegmentInfo.java000066400000000000000000000003101452765401600224240ustar00rootroot00000000000000package magick; public class SegmentInfo { public double x1,y1, x2,y2; public SegmentInfo(double x1, double y1, double x2, double y2) { this.x1=x1; this.y1=y1; this.x2=x2; this.y2=y2; } } techblue-jmagick-b4412af/src/magick/StorageType.java000066400000000000000000000012111452765401600224550ustar00rootroot00000000000000package magick; /** * Used in MagickImage.createImage to specify the size * of component. * * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/pixel.h * * @author Eric Yeo */ public interface StorageType { public final static int UndefinedPixel = 0; public final static int CharPixel = 1; public final static int DoublePixel = 2; public final static int FloatPixel = 3; public final static int LongPixel = 4; public final static int LongLongPixel = 5; public final static int QuantumPixel = 6; public final static int ShortPixel = 7; } techblue-jmagick-b4412af/src/magick/TimerState.java000066400000000000000000000006461452765401600223030ustar00rootroot00000000000000package magick; /** * Used in MagickImage.createImage to specify the size * of component. * * Important! Constant values should correspond to: * http://git.imagemagick.org/repos/ImageMagick/blob/master/MagickCore/timer.h * * @author Eric Yeo */ public interface TimerState { public final int UndefinedTimerState = 0; public final int StoppedTimerState = 1; public final int RunningTimerState = 2; } techblue-jmagick-b4412af/src/magick/TypeMetric.java000066400000000000000000000032371452765401600223060ustar00rootroot00000000000000package magick; import java.awt.Point; /** * Encapsulation of the TypeMetric structure. * MagickCore/draw.h */ public class TypeMetric extends Magick { public Point pixels_per_em; public double ascent, descent, width, height, max_advance, underline_position, underline_thickness; public SegmentInfo bounds; public Point origin; public TypeMetric(double pixels_per_emX, double pixels_per_emY, double ascent, double descent, double width, double height, double max_advance, double underline_position, double underline_thickness, double boundsX1, double boundsY1, double boundsX2, double boundsY2, double originX, double originY) { this.pixels_per_em = new Point((int)pixels_per_emX,(int)pixels_per_emY); this.ascent=ascent; this.descent=descent; this.width=width; this.height=height; this.max_advance=max_advance; this.underline_position=underline_position; this.underline_thickness=underline_thickness; this.bounds=new SegmentInfo(boundsX1,boundsY1,boundsX2,boundsY2); this.origin=new Point((int)originX,(int)originY); } public TypeMetric() { } public String toString() { SegmentInfo segmentInfo=this.bounds; return "typeMetrics: pixels_per_em .x="+this.pixels_per_em.x+" .y="+this.pixels_per_em.x+ " ascent="+this.ascent+" descent="+this.descent+" "+ " width="+this.width+" height="+this.height+" max_advance="+this.max_advance+ " underline_position="+this.underline_position+" underline_thickness="+this.underline_thickness+ " bounds x1="+segmentInfo.x1+" y1="+segmentInfo.y1+" x2="+segmentInfo.x2+" y2="+segmentInfo.y2+ " origin .x="+this.origin.x+" .y="+this.origin.y; } } techblue-jmagick-b4412af/src/magick/jmagick.c000066400000000000000000000546741452765401600211420ustar00rootroot00000000000000#include #include #include #include #include #include #if defined (IMAGEMAGICK_HEADER_STYLE_7) # include #else # include #endif #include "jmagick.h" #if MagickLibVersion >= 0x700 MagickBooleanType LevelImageShim(Image *image,const char *levels) { double black_point, gamma, white_point; GeometryInfo geometry_info; MagickBooleanType status; MagickStatusType flags; /* Parse levels. */ if (levels == (char *) NULL) return(MagickFalse); flags=ParseGeometry(levels,&geometry_info); black_point=geometry_info.rho; white_point=(double) QuantumRange; if ((flags & SigmaValue) != 0) white_point=geometry_info.sigma; gamma=1.0; if ((flags & XiValue) != 0) gamma=geometry_info.xi; if ((flags & PercentValue) != 0) { black_point*=(double) image->columns*image->rows/100.0; white_point*=(double) image->columns*image->rows/100.0; } if ((flags & SigmaValue) == 0) white_point=(double) QuantumRange-black_point; ExceptionInfo *exception = AcquireExceptionInfo(); if ((flags & AspectValue ) == 0) { ChannelType channel_mask=SetImageChannelMask(image, DefaultChannels); status=LevelImage(image,black_point,white_point,gamma,exception); (void) SetImageChannelMask(image,channel_mask); } else { status=LevelizeImage(image,black_point,white_point,gamma,exception); } DestroyExceptionInfo(exception); return status; } #endif /* * Convenience function to help throw an MagickException. */ void throwMagickException(JNIEnv *env, const char *mesg) { jclass magickExceptionClass; magickExceptionClass = (*env)->FindClass(env, "magick/MagickException"); if (magickExceptionClass == 0) { fprintf(stderr, "Cannot find MagickException class\n"); return; } (*env)->ThrowNew(env, magickExceptionClass, mesg); } /* * Convenience function to help throw an MagickApiException. * * Input: * mesg JMagick message * exception points to a ImageMagick ExceptionInfo structure */ void throwMagickApiException(JNIEnv *env, const char *mesg, const ExceptionInfo *exception) { jclass magickApiExceptionClass; jmethodID consMethodID = 0; jobject newObj; jstring jreason, jdescription; int result; #ifdef DIAGNOSTIC fprintf(stderr, "throwMagickApiException reason: %s - desc: %s \n", exception->reason, exception->description); #endif /* Find the class ID */ magickApiExceptionClass = (*env)->FindClass(env, "magick/MagickApiException"); if (magickApiExceptionClass == 0) { fprintf(stderr, "Cannot find MagickApiException class\n"); return; } /* Find the constructor ID */ consMethodID = (*env)->GetMethodID(env, magickApiExceptionClass, "", "(ILjava/lang/String;Ljava/lang/String;)V"); if (consMethodID == 0) { return; } /* Obtain the string objects */ jreason = (*env)->NewStringUTF(env, exception->reason != NULL ? exception->reason : ""); if (jreason == NULL) { #ifdef DIAGNOSTIC fprintf(stderr, "throwMagickApiException: " "Unable to create reason string\n"); #endif return; } jdescription = (*env)->NewStringUTF(env, exception->description != NULL ? exception->description : ""); if (jdescription == NULL) { #ifdef DIAGNOSTIC fprintf(stderr, "throwMagickApiException: " "Unable to create description string\n"); #endif return; } /* Create the MagickApiException object */ newObj = (*env)->NewObject(env, magickApiExceptionClass, consMethodID, exception->severity, jreason, jdescription); if (newObj == NULL) { #ifdef DIAGNOSTIC fprintf(stderr, "throwMagickApiException: " "Unable to create MagickApiException object\n"); #endif return; } /* Throw the exception. */ result = (*env)->Throw(env, newObj); #ifdef DIAGNOSTIC if (result != 0) { fprintf(stderr, "throwMagickApiException: " "Fail to throw MagickApiException"); } #endif } /* * Convenience function to retreive a handle from an object. * * Input: * env Java VM environment * obj Java object for which handle is to be retrieved * handleName name of the handle in the object * fieldId if non-null, contains the field ID. 0 to request retrieval. * * Output: * fieldId if non-null, will contain field ID of the handle on output. */ void *getHandle(JNIEnv *env, jobject obj, const char *handleName, jfieldID *fieldId) { jclass objClass; jfieldID handleFid; /* Retrieve the field ID of the handle */ if (fieldId == NULL) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return NULL; } handleFid = (*env)->GetFieldID(env, objClass, handleName, "J"); } else if (*fieldId == 0) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return NULL; } handleFid = *fieldId = (*env)->GetFieldID(env, objClass, handleName, "J"); } else { handleFid = *fieldId; } return (void*) (*env)->GetLongField(env, obj, handleFid); } /* * Convenience function to set a handle in an object. * * Input: * env Java VM environment * obj Java object for which handle is to be retrieved * handleName name of the handle in the object * fieldId if non-null, contains the field ID. 0 to request retrieval. * * Output: * fieldId if non-null, will contain field ID of the handle on output. * * Return: * non-zero if successful * zero if failure */ int setHandle(JNIEnv *env, jobject obj, const char *handleName, void *handle, jfieldID *fieldId) { jclass objClass; jfieldID handleFid; /* Retrieve the field ID of the handle */ if (fieldId == NULL) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return 0; } handleFid = (*env)->GetFieldID(env, objClass, handleName, "J"); } else if (fieldId == 0) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return 0; } handleFid = *fieldId = (*env)->GetFieldID(env, objClass, handleName, "J"); } else { handleFid = *fieldId; } if (handleFid == 0) { return 0; } (*env)->SetLongField(env, obj, handleFid, (jlong) handle); return 1; } /* * Retrieve the int value of the specified field. * * Input: * env Java VM environment. * obj Java object for which the value is to be retrieved. * fieldName name of the field to be retrieved. * fieldID if non-null, points to field ID. 0 to request retrieval. * * Output: * iRect to be initilised by values in jRect. * fieldID if non-null, will contain the field ID. * value to contain the retrieved value. Must not be null. * * Return: * non-zero if successful * zero if failed */ int getIntFieldValue(JNIEnv *env, jobject obj, const char *fieldName, jfieldID *fieldID, jint *value) { jclass objClass = 0; jfieldID objFieldID = 0; if (fieldID == NULL) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return 0; } objFieldID = (*env)->GetFieldID(env, objClass, fieldName, "I"); } else if (*fieldID == 0) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return 0; } objFieldID = *fieldID = (*env)->GetFieldID(env, objClass, fieldName, "I"); } else { objFieldID = *fieldID; } if (objFieldID == 0) { return 0; } *value = (*env)->GetIntField(env, obj, objFieldID); return 1; } /* * Store the int value of the specified field. * * Input: * env Java VM environment. * obj Java object for which the value is to be retrieved. * fieldName name of the field to be retrieved. * fieldID if non-null, points to field ID. 0 to request retrieval. * value to contain the value to be stored. * * Output: * fieldID if non-null, will contain the field ID. * * Return: * non-zero if successful * zero if failed */ int setIntFieldValue(JNIEnv *env, jobject obj, const char *fieldName, jfieldID *fieldID, jint value) { jclass objClass = 0; jfieldID objFieldID = 0; if (fieldID == NULL) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return 0; } objFieldID = (*env)->GetFieldID(env, objClass, fieldName, "I"); } else if (*fieldID == 0) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return 0; } objFieldID = *fieldID = (*env)->GetFieldID(env, objClass, fieldName, "I"); } else { objFieldID = *fieldID; } if (objFieldID == 0) { return 0; } (*env)->SetIntField(env, obj, objFieldID, value); return 1; } /* * Retrieve the byte value of the specified field. * * Input: * env Java VM environment. * obj Java object for which the value is to be retrieved. * fieldName name of the field to be retrieved. * fieldID if non-null, points to field ID. 0 to request retrieval. * * Output: * iRect to be initilised by values in jRect. * fieldID if non-null, will contain the field ID. * value to contain the retrieved value. Must not be null. * * Return: * non-zero if successful * zero if failed */ int getByteFieldValue(JNIEnv *env, jobject obj, const char *fieldName, jfieldID *fieldID, jbyte *value) { jclass objClass = 0; jfieldID objFieldID = 0; if (fieldID == NULL) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return 0; } objFieldID = (*env)->GetFieldID(env, objClass, fieldName, "B"); } else if (*fieldID == 0) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return 0; } objFieldID = *fieldID = (*env)->GetFieldID(env, objClass, fieldName, "B"); } else { objFieldID = *fieldID; } if (objFieldID == 0) { return 0; } *value = (*env)->GetByteField(env, obj, objFieldID); return 1; } /* * Retrieve the short value of the specified field. * * Input: * env Java VM environment. * obj Java object for which the value is to be retrieved. * fieldName name of the field to be retrieved. * fieldID if non-null, points to field ID. 0 to request retrieval. * * Output: * iRect to be initilised by values in jRect. * fieldID if non-null, will contain the field ID. * value to contain the retrieved value. Must not be null. * * Return: * non-zero if successful * zero if failed */ int getShortFieldValue(JNIEnv *env, jobject obj, const char *fieldName, jfieldID *fieldID, jshort *value) { jclass objClass = 0; jfieldID objFieldID = 0; if (fieldID == NULL) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return 0; } objFieldID = (*env)->GetFieldID(env, objClass, fieldName, "S"); } else if (*fieldID == 0) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return 0; } objFieldID = *fieldID = (*env)->GetFieldID(env, objClass, fieldName, "S"); } else { objFieldID = *fieldID; } if (objFieldID == 0) { return 0; } *value = (*env)->GetShortField(env, obj, objFieldID); return 1; } /* * Retrieve the string value of the specified field. * * Input: * env Java VM environment. * obj Java object for which the value is to be retrieved. * fieldName name of the field to be retrieved. * fieldID if non-null, points to field ID. 0 to request retrieval. * * Output: * fieldID if non-null, will contain the field ID. * * Return: * The string value requested. The caller is responsible for * deallocating this string. */ char* getStringFieldValue(JNIEnv *env, jobject obj, const char *fieldName, jfieldID *fieldID) { jclass objClass = 0; jfieldID objFieldID = 0; jobject stringObj = 0; char *stringVal = NULL; char *stringCpy = NULL; if (fieldID == NULL) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return NULL; } objFieldID = (*env)->GetFieldID(env, objClass, fieldName, "Ljava/lang/String;"); } else if (*fieldID == 0) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return NULL; } objFieldID = *fieldID = (*env)->GetFieldID(env, objClass, fieldName, "Ljava/lang/String;"); } else { objFieldID = *fieldID; } if (objFieldID == 0) { return NULL; } stringObj = (*env)->GetObjectField(env, obj, objFieldID); if (stringObj == NULL) { return NULL; } stringVal = (char *) (*env)->GetStringUTFChars(env, stringObj, 0); stringCpy = (char *) AcquireString(stringVal); (*env)->ReleaseStringUTFChars(env, stringObj, stringVal); return stringCpy; } /* * Retrieve the byte array from the specified field. * * Input: * env Java VM environment. * obj Java object for which the value is to be retrieved. * fieldName name of the field to be retrieved. * fieldID if non-null, points to field ID. 0 to request retrieval. * * Output: * fieldID if non-null, will contain the field ID. * size the size of the array is returned here. Must not be NULL. * * Return: * The byte array requested. The caller is responsible for * deallocating this byte array. */ unsigned char* getByteArrayFieldValue(JNIEnv *env, jobject obj, const char *fieldName, jfieldID *fieldID, int *size) { jclass objClass = 0; jfieldID objFieldID = 0; jobject byteArrayObj = 0; unsigned char *byteArray = NULL; char *byteArrayCpy = NULL; if (fieldID == NULL) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return NULL; } objFieldID = (*env)->GetFieldID(env, objClass, fieldName, "[B"); } else if (*fieldID == 0) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return NULL; } objFieldID = *fieldID = (*env)->GetFieldID(env, objClass, fieldName, "[B"); } else { objFieldID = *fieldID; } if (objFieldID == 0) { return NULL; } /* Get the array object */ byteArrayObj = (*env)->GetObjectField(env, obj, objFieldID); if (byteArrayObj == NULL) { return NULL; } /* Determine the size of the array */ *size = (*env)->GetArrayLength(env, byteArrayObj); if (*size == 0) { return NULL; } /* Get and copy the array elements */ byteArray = (jbyte *) (*env)->GetByteArrayElements(env, byteArrayObj, 0); byteArrayCpy = (unsigned char *) AcquireMagickMemory(*size); if (byteArray == NULL) { return NULL; } memcpy(byteArrayCpy, byteArray, *size); (*env)->ReleaseByteArrayElements(env, byteArrayObj, byteArray, JNI_ABORT); return byteArrayCpy; } /* * From a java.awt.Rectangle object, construct a ImageMagick * RectangleInfo, as passed in from the parameter. * * Input: * env Java VM environment * jRect an instance of java.awt.Rectangle * * Output: * iRect to be initilised by values in jRect * * Return: * non-zero if successful * zero if failed */ int getRectangle(JNIEnv *env, jobject jRect, RectangleInfo *iRect) { jint width, height, x, y; int retVal = getIntFieldValue(env, jRect, "width", NULL, (jint *) &width) && getIntFieldValue(env, jRect, "height", NULL, (jint *) &height) && getIntFieldValue(env, jRect, "x", NULL, (jint *) &x) && getIntFieldValue(env, jRect, "y", NULL, (jint *) &y); if (retVal) { iRect->width = width; iRect->height = height; iRect->x = x; iRect->y = y; } return retVal; } /* * From a magick.PixelPacket object, construct a ImageMagick * PixelPacket, as passed in from the parameter. * * Input: * env Java VM environment * jPixel an instance of magick.PixelPacket * * Output: * iPixel to be initilised by values in jPixel * * Return: * non-zero if successful * zero if failed */ int getPixelPacket(JNIEnv *env, jobject jPixel, #if MagickLibVersion < 0x700 PixelPacket *iPixel) #else PixelInfo *iPixel) #endif { jint red, green, blue, transparency; int successful = getIntFieldValue(env, jPixel, "red", NULL, &red) && getIntFieldValue(env, jPixel, "green", NULL, &green) && getIntFieldValue(env, jPixel, "blue", NULL, &blue) && getIntFieldValue(env, jPixel, "opacity", NULL, &transparency); if (!successful) { return successful; } iPixel->red = (Quantum) red; iPixel->green = (Quantum) green; iPixel->blue = (Quantum) blue; #if MagickLibVersion < 0x700 iPixel->opacity = #else iPixel->alpha = #endif (Quantum) transparency; return successful; } /* * Construct a new Java magick.MagickImage object and set the * handle. * * Input: * env Java VM environment * image ImageMagick image handle * * Return: * A new instance of magick.MagickImage object. * */ jobject newImageObject(JNIEnv *env, Image* image) { jclass magickImageClass = 0; jmethodID consMethodID = 0; jobject newObj; magickImageClass = (*env)->FindClass(env, "magick/MagickImage"); if (magickImageClass == 0) { return NULL; } consMethodID = (*env)->GetMethodID(env, magickImageClass, "", "()V"); if (consMethodID == 0) { return NULL; } newObj = (*env)->NewObject(env, magickImageClass, consMethodID); if (newObj == NULL) { return NULL; } if (!setHandle(env, newObj, "magickImageHandle", (void*) image, NULL)) { #ifdef DIAGNOSTIC fprintf(stderr, "newImageObject: Unable to set handle\n"); #endif return NULL; } return newObj; } /* * Set a attribute in a generic handle to string. * * Input: * env Java VM environment * attribVar points to a C string so as to set the value * jstr Java string for which to set the attrib * * Output: * attribVar points to a new C string with content from jstr */ void setHandleAttribute(JNIEnv *env, char **attribVar, jstring jstr) { const char *cstr = NULL; if (*attribVar != NULL) { RelinquishMagickMemory(*attribVar); } cstr = (*env)->GetStringUTFChars(env, jstr, 0); *attribVar = (char *) AcquireString(cstr); (*env)->ReleaseStringUTFChars(env, jstr, cstr); } /* * Given the C ProfileInfo structure and the Java ProfileInfo object, * acquire the contents of the Java ProfileInfo object and store it in * the C ProfileInfo structure. * * Input: * env JNI environment * profileObj Java ProfileInfo object for which field values are to be * obtain to store into the C ProfileInfo structure * Output: * profileInfo C ProfileINfo structure to store field values */ void setProfileInfo(JNIEnv *env, ProfileInfo *profileInfo, jobject profileObj) { char *name; unsigned char *info; int infoSize = 0; if (profileObj == NULL) { throwMagickException(env, "ProfileInfo cannot be null"); return; } name = getStringFieldValue(env, profileObj, "name", NULL); info = getByteArrayFieldValue(env, profileObj, "info", NULL, &infoSize); if (profileInfo->name != NULL) { RelinquishMagickMemory(profileInfo->name); } profileInfo->name = name; if (profileInfo->info != NULL) { RelinquishMagickMemory(profileInfo->info); } profileInfo->info = info; profileInfo->length = infoSize; } /* * Given the C ProfileInfo structure, construct a Java ProfileInfo * object with values obtained from the C ProfileInfo structure. * Input: * env JNI environment * profileInfo C ProfileInfo structure * Return: * Java ProfileInfo object */ jobject getProfileInfo(JNIEnv *env, ProfileInfo *profileInfo) { jclass profileInfoClass; jmethodID consMethodID; jobject profileObject; jstring name; jbyteArray byteArray; unsigned char *byteElements; /* Get the ProfileInfo class ID */ profileInfoClass = (*env)->FindClass(env, "magick/ProfileInfo"); if (profileInfoClass == 0) { throwMagickException(env, "Unable to locate class " "magick.ProfileInfo"); return NULL; } /* Get the constructor method ID */ consMethodID = (*env)->GetMethodID(env, profileInfoClass, "", "(Ljava/lang/String;[B)V"); if (consMethodID == 0) { throwMagickException(env, "Unable to locate constructor " "ProfileInfo(String, byte[])"); return NULL; } /* Construct the name */ if (profileInfo->name != NULL) { name = (*env)->NewStringUTF(env, profileInfo->name); if (name == NULL) { throwMagickException(env, "Unable to allocate Java String " "for profile name"); return NULL; } } else { name = NULL; } /* Construct the byte array */ if (profileInfo->length > 0) { byteArray = (*env)->NewByteArray(env, profileInfo->length); if (byteArray == NULL) { throwMagickException(env, "Unable to allocate byte array " "for profile info"); return NULL; } byteElements = (*env)->GetByteArrayElements(env, byteArray, JNI_FALSE); if (byteElements == NULL) { throwMagickException(env, "Unable to obtain byte array elements " "for profile info"); return NULL; } memcpy(byteElements, profileInfo->info, profileInfo->length); (*env)->ReleaseByteArrayElements(env, byteArray, byteElements, 0); } else { byteArray = NULL; } /* Construct the ProfileInfo object */ profileObject = (*env)->NewObject(env, profileInfoClass, consMethodID, name, byteArray); if (profileObject == NULL) { throwMagickException(env, "Unable to construct ProfileInfo object"); return NULL; } return profileObject; } techblue-jmagick-b4412af/src/magick/jmagick.h000066400000000000000000000622341452765401600211360ustar00rootroot00000000000000#ifndef __JMAGICK__ #define __JMAGICK__ #include #include #if defined (IMAGEMAGICK_HEADER_STYLE_7) # include #else # include #endif #if MagickLibVersion >= 0x700 MagickBooleanType LevelImageShim(Image *image,const char *levels); // This should be kept in sync with the struct defined in MagickCore/profile.c struct _ProfileInfo { char *name; size_t length; unsigned char *info; size_t signature; }; #endif /* * Convenience function to help throw an MagickException. */ void throwMagickException(JNIEnv *env, const char *mesg); /* * Convenience function to help throw an MagickApiException. * * Input: * mesg JMagick message * exception points to a ImageMagick ExceptionInfo structure */ void throwMagickApiException(JNIEnv *env, const char *mesg, const ExceptionInfo *exception); /* * Convenience function to retreive a handle from an object. * * Input: * env Java VM environment * obj Java object for which handle is to be retrieved * handleName name of the handle in the object * fieldId if non-null, contains the field ID. 0 to request retrieval. * * Output: * fieldId if non-null, will contain field ID of the handle on output. */ void *getHandle(JNIEnv *env, jobject obj, const char *handleName, jfieldID *fieldId); /* * Convenience function to set a handle in an object. * * Input: * env Java VM environment * obj Java object for which handle is to be retrieved * handleName name of the handle in the object * fieldId if non-null, contains the field ID. 0 to request retrieval. * * Output: * fieldId if non-null, will contain field ID of the handle on output. * * Return: * non-zero if successful * zero if failure */ int setHandle(JNIEnv *env, jobject obj, const char *handleName, void *handle, jfieldID *fieldId); /* * Retrieve the int value of the specified field. * * Input: * env Java VM environment. * obj Java object for which the value is to be retrieved. * fieldName name of the field to be retrieved. * fieldID if non-null, points to field ID. 0 to request retrieval. * * Output: * iRect to be initilised by values in jRect. * fieldID if non-null, will contain the field ID. * value to contain the retrieved value. Must not be null. * * Return: * non-zero if successful * zero if failed */ int getIntFieldValue(JNIEnv *env, jobject obj, const char *fieldName, jfieldID *fieldID, jint *value); /* * Store the int value of the specified field. * * Input: * env Java VM environment. * obj Java object for which the value is to be retrieved. * fieldName name of the field to be retrieved. * fieldID if non-null, points to field ID. 0 to request retrieval. * value to contain the value to be stored. * * Output: * fieldID if non-null, will contain the field ID. * * Return: * non-zero if successful * zero if failed */ int setIntFieldValue(JNIEnv *env, jobject obj, const char *fieldName, jfieldID *fieldID, jint value); /* * Retrieve the byte array from the specified field. * * Input: * env Java VM environment. * obj Java object for which the value is to be retrieved. * fieldName name of the field to be retrieved. * fieldID if non-null, points to field ID. 0 to request retrieval. * * Output: * fieldID if non-null, will contain the field ID. * size the size of the array is returned here. Must not be NULL. * * Return: * The byte array requested. The caller is responsible for * deallocating this byte array. */ unsigned char* getByteArrayFieldValue(JNIEnv *env, jobject obj, const char *fieldName, jfieldID *fieldID, int *size); /* * From a java.awt.Rectangle object, construct a ImageMagick * RectangleInfo, as passed in from the parameter. * * Input: * env Java VM environment * jRect an instance of java.awt.Rectangle * * Output: * iRect to be initilised by values in jRect * * Return: * non-zero if successful * zero if failed */ int getRectangle(JNIEnv *env, jobject jRect, RectangleInfo *iRect); /* * From a magick.PixelPacket object, construct a ImageMagick * PixelPacket, as passed in from the parameter. * * Input: * env Java VM environment * jPixelPacket an instance of magick.PixelPacket * * Output: * iPixelPacket to be initilised by values in jPixelPacket * * Return: * non-zero if successful * zero if failed */ int getPixelPacket(JNIEnv *env, jobject jPixelPacket, #if MagickLibVersion < 0x700 PixelPacket *iPixelPacket); #else PixelInfo *iPixelInfo); #endif /* * Construct a new Java magick.MagickImage object and set the * handle. * * Input: * env Java VM environment * image ImageMagick image handle * * Return: * A new instance of magick.MagickImage object. * */ jobject newImageObject(JNIEnv *env, Image* image); /* * Set a attribute in a generic handle to string. * * Input: * env Java VM environment * attribVar points to a C string so as to set the value * jstr Java string for which to set the attrib * * Output: * attribVar points to a new C string with content from jstr */ void setHandleAttribute(JNIEnv *env, char **attribVar, jstring jstr); /* * Given the C ProfileInfo structure and the Java ProfileInfo object, * acquire the contents of the Java ProfileInfo object and store it in * the C ProfileInfo structure. * * Input: * env JNI environment * profileObj Java ProfileInfo object for which field values are to be * obtain to store into the C ProfileInfo structure * Output: * profileInfo C ProfileINfo structure to store field values */ void setProfileInfo(JNIEnv *env, ProfileInfo *profileInfo, jobject profileObj); /* * Given the C ProfileInfo structure, construct a Java ProfileInfo * object with values obtained from the C ProfileInfo structure. * Input: * env JNI environment * profileInfo C ProfileInfo structure * Return: * Java ProfileInfo object */ jobject getProfileInfo(JNIEnv *env, ProfileInfo *profileInfo); // Return whether a string represents the given double. static inline int aisd(double f, char* s) { double r; sscanf(s, "%lf", &r); return r == f; } // Return the shortest lossless string representation of an IEEE double. // Guaranteed to fit in 23 characters (including the final '\0'). static inline char* dtoa(char* res, double f) { int i, j, lenF = 1e9; char fmt[8]; int e = floor(log10(f)) + 1; if (f > DBL_MAX) { sprintf(res, "1e999"); return res; } // converts to Inf if (f < -DBL_MAX) { sprintf(res, "-1e999"); return res; } // converts to -Inf if (isnan(f)) { sprintf(res, "NaN"); return res; } // NaNs don't work under MSVCRT // compute the shortest representation without exponent ("123000", "0.15") if (!f || e>-4 && e<21) { for (i=0; i<=20; i++) { sprintf(fmt, "%%.%dlf", i); sprintf(res, fmt, f); if (aisd(f, res)) { lenF = strlen(res); break; } } } if (!f) return res; // compute the shortest representation with exponent ("123e3", "15e-2") for (i=0; i<19; i++) { sprintf(res, "%.0lfe%d", f * pow(10,-e), e); if (aisd(f, res)) break; j = strlen(res); if (j >= lenF) break; while (res[j] != 'e') j--; res[j-1]--; if (aisd(f, res)) break; // try mantissa -1 res[j-1]+=2; if (aisd(f, res)) break; // try mantissa +1 e--; } if (lenF <= strlen(res)) sprintf(res, fmt, f); return res; } /* * Convenience macro to set an attribute in the object handle. */ #define setMethod(funcName, fieldName, handleName, handleType, fieldType) \ JNIEXPORT void JNICALL funcName \ (JNIEnv *env, jobject self, fieldType value) \ { \ handleType *info = NULL; \ \ info = (handleType *) getHandle(env, self, handleName, NULL); \ if (info == NULL) { \ throwMagickException(env, "Unable to retrieve handle"); \ return; \ } \ \ info->fieldName = value; \ } /* * Convenience macro to get an attribute of an object handle. */ #define getMethod(funcName, fieldName, handleName, handleType, fieldType) \ JNIEXPORT fieldType JNICALL funcName \ (JNIEnv *env, jobject self) \ { \ handleType *info = NULL; \ \ info = (handleType *) getHandle(env, self, handleName, NULL); \ if (info == NULL) { \ throwMagickException(env, "Unable to retrieve handle"); \ return (fieldType) 0; \ } \ \ return info->fieldName; \ } // throwMagickException(env, "Unable to retrieve handle " funcName+fieldName); \ /* * Convenience macro to set an integer attribute in the object handle. */ #define setIntMethod(funcName, fieldName, handleName, handleType) \ setMethod(funcName, fieldName, handleName, handleType, jint) /* * Convenience macro to get an integer attribute of an object handle. */ #define getIntMethod(funcName, fieldName, handleName, handleType) \ getMethod(funcName, fieldName, handleName, handleType, jint) /* * Convenience macro to set an boolean attribute in the object handle. */ #define setBoolMethod(funcName, fieldName, handleName, handleType) \ setMethod(funcName, fieldName, handleName, handleType, jboolean) /* * Convenience macro to get an boolean attribute of an object handle. */ #define getBoolMethod(funcName, fieldName, handleName, handleType) \ getMethod(funcName, fieldName, handleName, handleType, jboolean) /* * Convenience macro to set an short attribute in the object handle. */ #define setShortMethod(funcName, fieldName, handleName, handleType) \ setMethod(funcName, fieldName, handleName, handleType, jshort) /* * Convenience macro to get an byte attribute of an object handle. */ #define getByteMethod(funcName, fieldName, handleName, handleType) \ getMethod(funcName, fieldName, handleName, handleType, jbyte) /* * Convenience macro to set an byte attribute in the object handle. */ #define setByteMethod(funcName, fieldName, handleName, handleType) \ setMethod(funcName, fieldName, handleName, handleType, jbyte) /* * Convenience macro to get a double attribute of an object handle. */ #define getDoubleMethod(funcName, fieldName, handleName, handleType) \ getMethod(funcName, fieldName, handleName, handleType, jdouble) /* * Convenience macro to set an double attribute in the object handle. */ #define setDoubleMethod(funcName, fieldName, handleName, handleType) \ setMethod(funcName, fieldName, handleName, handleType, jdouble) // Fix memory leak bug. Below was: RelinquishMagickMemory((void**) &info->fieldName); \ // info->fieldName = NULL; \ /* * Convenience macro to set a string attribute in the object handle. */ #define setStringMethod(funcName, fieldName, handleName, handleType) \ JNIEXPORT void JNICALL funcName \ (JNIEnv *env, jobject self, jstring value) \ { \ handleType *info = NULL; \ const char *cstr = NULL; \ \ info = (handleType *) getHandle(env, self, handleName, NULL); \ if (info == NULL) { \ throwMagickException(env, "Unable to retrieve handle"); \ return; \ } \ \ if (info->fieldName != NULL) { \ info->fieldName=(char *) RelinquishMagickMemory((void*) info->fieldName); \ } \ \ cstr = (*env)->GetStringUTFChars(env, value, 0); \ if (cstr == NULL) { \ throwMagickException(env, "Unable to retrieve Java string chars"); \ return; \ } \ info->fieldName = (char *) AcquireString(cstr); \ if (info->fieldName == NULL) { \ throwMagickException(env, "Unable to allocate memory"); \ } \ (*env)->ReleaseStringUTFChars(env, value, cstr); \ } /* * Convenience macro which does nothing. Used for removed attributes with no analog. */ #define setDeprecatedMethod(funcName, fieldName, handleName, handleType, fieldType) \ JNIEXPORT void JNICALL funcName \ (JNIEnv *env, jobject self, fieldType value) \ {} /* * Convenience macro to get a string attribute which has been removed with no analog. */ #define getStringDeprecatedMethod(funcName, fieldName, handleName, handleType) \ JNIEXPORT jstring JNICALL funcName \ (JNIEnv *env, jobject self) \ { \ return NULL; \ } /* * Convenience macro to get a string attribute which has been removed with no analog. */ #define getDeprecatedMethod(funcName, fieldName, handleName, handleType, fieldType) \ JNIEXPORT fieldType JNICALL funcName \ (JNIEnv *env, jobject self) \ { \ return (fieldType) 0; \ } /* * Convenience macro to get a string attribute in the object handle. */ #define getStringMethod(funcName, fieldName, handleName, handleType) \ JNIEXPORT jstring JNICALL funcName \ (JNIEnv *env, jobject self) \ { \ handleType *info = NULL; \ jstring jstr = NULL; \ \ info = (handleType *) getHandle(env, self, handleName, NULL); \ if (info == NULL) { \ throwMagickException(env, "Unable to retrieve handle"); \ return NULL; \ } \ \ if (info->fieldName == NULL) { \ return NULL; \ } \ \ jstr = (*env)->NewStringUTF(env, info->fieldName); \ if (jstr == NULL) { \ throwMagickException(env, "Unable to construct new string"); \ return NULL; \ } \ \ return jstr; \ } /* * Convenience macro to set a PixelPacket attribute in the object handle. */ #define setPixelPacketMethod(funcName, fieldName, handleName, handleType) \ JNIEXPORT void JNICALL funcName \ (JNIEnv *env, jobject self, jobject jPixelPacket) \ { \ handleType *info = NULL; \ \ info = (handleType *) getHandle(env, self, handleName, NULL); \ if (info == NULL) { \ throwMagickException(env, "Unable to retrieve handle"); \ return; \ } \ \ if (!getPixelPacket(env, jPixelPacket, &info->fieldName)) { \ throwMagickException(env, "Unable to set PixelPacket"); \ return; \ } \ } /* * Convenience macro to get a PixelPacket attribute in the object handle. */ #if MagickLibVersion < 0x700 #define getPixelPacketMethod(funcName, fieldName, handleName, handleType) \ JNIEXPORT jobject JNICALL funcName \ (JNIEnv *env, jobject self) \ { \ handleType *info = NULL; \ jobject jPixelPacket = NULL; \ jclass pixelPacketClass; \ jmethodID consMethodID; \ \ info = (handleType *) getHandle(env, self, handleName, NULL); \ if (info == NULL) { \ throwMagickException(env, "Unable to retrieve handle"); \ return NULL; \ } \ \ pixelPacketClass = (*env)->FindClass(env, "magick/PixelPacket"); \ if (pixelPacketClass == 0) { \ throwMagickException(env, \ "Unable to locate class magick.PixelPacket"); \ return NULL; \ } \ \ consMethodID = (*env)->GetMethodID(env, pixelPacketClass, \ "", "(IIII)V"); \ if (consMethodID == 0) { \ throwMagickException(env, "Unable to construct magick.PixelPacket"); \ return NULL; \ } \ \ jPixelPacket = (*env)->NewObject(env, pixelPacketClass, consMethodID, \ (jint) info->fieldName.red, \ (jint) info->fieldName.green, \ (jint) info->fieldName.blue, \ (jint) info->fieldName.opacity); \ if (jPixelPacket == NULL) { \ throwMagickException(env, "Unable to construct magick.PixelPacket"); \ return NULL; \ } \ \ return jPixelPacket; \ } #else #define getPixelPacketMethod(funcName, fieldName, handleName, handleType) \ JNIEXPORT jobject JNICALL funcName \ (JNIEnv *env, jobject self) \ { \ handleType *info = NULL; \ jobject jPixelPacket = NULL; \ jclass pixelPacketClass; \ jmethodID consMethodID; \ \ info = (handleType *) getHandle(env, self, handleName, NULL); \ if (info == NULL) { \ throwMagickException(env, "Unable to retrieve handle"); \ return NULL; \ } \ \ pixelPacketClass = (*env)->FindClass(env, "magick/PixelPacket"); \ if (pixelPacketClass == 0) { \ throwMagickException(env, \ "Unable to locate class magick.PixelPacket"); \ return NULL; \ } \ \ consMethodID = (*env)->GetMethodID(env, pixelPacketClass, \ "", "(IIII)V"); \ if (consMethodID == 0) { \ throwMagickException(env, "Unable to construct magick.PixelPacket"); \ return NULL; \ } \ \ jPixelPacket = (*env)->NewObject(env, pixelPacketClass, consMethodID, \ (jint) info->fieldName.red, \ (jint) info->fieldName.green, \ (jint) info->fieldName.blue, \ (jint) info->fieldName.alpha); \ if (jPixelPacket == NULL) { \ throwMagickException(env, "Unable to construct magick.PixelPacket"); \ return NULL; \ } \ \ return jPixelPacket; \ } #endif #endif /* __JMAGICK__ */ techblue-jmagick-b4412af/src/magick/magick_DrawInfo.c000066400000000000000000000361111452765401600225430ustar00rootroot00000000000000#include #include #include #include #include #include #if defined (IMAGEMAGICK_HEADER_STYLE_7) # include #else # include #endif #include "jmagick.h" #include "magick_DrawInfo.h" /* * Class: magick_DrawInfo * Method: init * Signature: (Lmagick/ImageInfo;)V */ JNIEXPORT void JNICALL Java_magick_DrawInfo_init (JNIEnv *env, jobject self, jobject jImageInfo) { jfieldID drawInfoFieldID = 0; ImageInfo *imageInfo = NULL; DrawInfo *drawInfo = NULL; /* Get the ImageInfo handle. */ imageInfo = (ImageInfo*) getHandle(env, jImageInfo, "imageInfoHandle", NULL); if (imageInfo == NULL) { throwMagickException(env, "Unable to get ImageInfo handle"); return; } /* If the DrawInfo handle is not NULL, we destroy the old * handle before creating a new one. */ drawInfo = (DrawInfo*) getHandle(env, self, "drawInfoHandle", &drawInfoFieldID); if (drawInfo != NULL) { DestroyDrawInfo(drawInfo); } /* Initialise and set the new DrawInfo handle. */ drawInfo = AcquireDrawInfo(); if (drawInfo == NULL) { throwMagickException(env, "Memory allocation failure"); return; } GetDrawInfo(imageInfo, drawInfo); // drawInfo->encoding = (char *) AcquireString("Unicode"); if (!setHandle(env, self, "drawInfoHandle", drawInfo, &drawInfoFieldID)) { throwMagickException(env, "Unable to set DrawInfo handle"); return; } } /* * Class: magick_DrawInfo * Method: destroyDrawInfo * Signature: ()V */ JNIEXPORT void JNICALL Java_magick_DrawInfo_destroyDrawInfo (JNIEnv *env, jobject self) { DrawInfo *info = NULL; jfieldID fieldID = 0; info = (DrawInfo*) getHandle(env, self, "drawInfoHandle", &fieldID); if (info != NULL) { DestroyDrawInfo(info); setHandle(env, self, "drawInfoHandle", NULL, &fieldID); } } /* * Class: magick_DrawInfo * Method: setPrimitive * Signature: (Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_magick_DrawInfo_setPrimitive (JNIEnv *env, jobject self, jstring primitive) { DrawInfo *info = NULL; const char *cstr = NULL; const jchar *jstr = NULL; int i, len, is8bits; info = (DrawInfo *) getHandle(env, self, "drawInfoHandle", NULL); if (info == NULL) { throwMagickException(env, "Unable to retrieve handle"); return; } if (info->primitive != NULL) { RelinquishMagickMemory(info->primitive); } jstr = (*env)->GetStringChars(env, primitive, 0); len = (*env)->GetStringLength(env, primitive); is8bits = JNI_TRUE; for (i = 0; i < len; i++) { if (jstr[i] > 255) { is8bits = JNI_FALSE; break; } } if (is8bits) { char *str = (char *) AcquireMagickMemory(len+1); if (str == NULL) { throwMagickException(env, "Unable to allocate memory"); (*env)->ReleaseStringChars(env, primitive, jstr); return; } for (i = 0; i < len; i++) { str[i] = (char) jstr[i]; } str[len] = '\0'; info->primitive = str; #ifdef DIAGNOSTIC fprintf(stderr,"String: %s\n", str); #endif if (info->encoding != NULL) { RelinquishMagickMemory(info->encoding); } } (*env)->ReleaseStringChars(env, primitive, jstr); if (!is8bits) { cstr = (*env)->GetStringUTFChars(env, primitive, 0); if (cstr == NULL) { throwMagickException(env, "Unable to retrieve Java string chars"); return; } info->primitive = (char *) AcquireString(cstr); (*env)->ReleaseStringUTFChars(env, primitive, cstr); if (info->primitive == NULL) { throwMagickException(env, "Unable to allocate memory"); } if (info->encoding != NULL) { RelinquishMagickMemory(info->encoding); } info->encoding = (char *) AcquireString("UTF-8"); if (info->encoding == NULL) { throwMagickException(env, "Unable to allocate memory"); } } } /* * Class: magick_DrawInfo * Method: getPrimitive * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_DrawInfo_getPrimitive, primitive, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setGeometry * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_DrawInfo_setGeometry, geometry, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getGeometry * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_DrawInfo_getGeometry, geometry, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setText * Signature: (Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_magick_DrawInfo_setText (JNIEnv *env, jobject self, jstring text) { DrawInfo *info = NULL; const char *cstr = NULL; const jchar *jstr = NULL; int i, len, is8bits; info = (DrawInfo *) getHandle(env, self, "drawInfoHandle", NULL); if (info == NULL) { throwMagickException(env, "Unable to retrieve handle"); return; } if (info->text != NULL) { RelinquishMagickMemory(info->text); } jstr = (*env)->GetStringChars(env, text, 0); len = (*env)->GetStringLength(env, text); is8bits = JNI_TRUE; for (i = 0; i < len; i++) { if (jstr[i] > 255) { is8bits = JNI_FALSE; break; } } if (is8bits) { char *str = (char *) AcquireMagickMemory(len+1); if (str == NULL) { throwMagickException(env, "Unable to allocate memory"); (*env)->ReleaseStringChars(env, text, jstr); return; } for (i = 0; i < len; i++) { str[i] = (char) jstr[i]; } str[len] = '\0'; info->text = str; #ifdef DIAGNOSTIC fprintf(stderr,"String: %s\n", str); #endif if (info->encoding != NULL) { RelinquishMagickMemory(info->encoding); } } (*env)->ReleaseStringChars(env, text, jstr); if (!is8bits) { cstr = (*env)->GetStringUTFChars(env, text, 0); if (cstr == NULL) { throwMagickException(env, "Unable to retrieve Java string chars"); return; } info->text = (char *) AcquireString(cstr); (*env)->ReleaseStringUTFChars(env, text, cstr); if (info->text == NULL) { throwMagickException(env, "Unable to allocate memory"); } if (info->encoding != NULL) { RelinquishMagickMemory(info->encoding); } info->encoding = AcquireString("UTF-8"); if (info->encoding == NULL) { throwMagickException(env, "Unable to allocate memory"); } } } /* * Class: magick_DrawInfo * Method: getText * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_DrawInfo_getText, text, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setFont * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_DrawInfo_setFont, font, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getFont * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_DrawInfo_getFont, font, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setStrokeAntialias * Signature: (Z)V */ setBoolMethod(Java_magick_DrawInfo_setStrokeAntialias, stroke_antialias, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getStrokeAntialias * Signature: ()Z */ getBoolMethod(Java_magick_DrawInfo_getStrokeAntialias, stroke_antialias, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setTextAntialias * Signature: (Z)V */ setBoolMethod(Java_magick_DrawInfo_setTextAntialias, text_antialias, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getTextAntialias * Signature: ()Z */ getBoolMethod(Java_magick_DrawInfo_getTextAntialias, text_antialias, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setGravity * Signature: (I)V */ setIntMethod(Java_magick_DrawInfo_setGravity, gravity, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getGravity * Signature: ()I */ getIntMethod(Java_magick_DrawInfo_getGravity, gravity, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setOpacity * Signature: (I)V */ setIntMethod(Java_magick_DrawInfo_setOpacity, #if MagickLibVersion < 0x700 opacity, #else alpha, #endif "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getOpacity * Signature: ()I */ getIntMethod(Java_magick_DrawInfo_getOpacity, #if MagickLibVersion < 0x700 opacity, #else alpha, #endif "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setDecorate * Signature: (I)V */ setIntMethod(Java_magick_DrawInfo_setDecorate, decorate, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getDecorate * Signature: ()I */ getIntMethod(Java_magick_DrawInfo_getDecorate, decorate, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setKerning * Signature: (Ljava/lang/String;)V */ setDoubleMethod(Java_magick_DrawInfo_setKerning, kerning, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getKerning * Signature: ()Ljava/lang/String; */ getDoubleMethod(Java_magick_DrawInfo_getKerning, kerning, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setInterwordSpacing * Signature: (Ljava/lang/String;)V */ setDoubleMethod(Java_magick_DrawInfo_setInterwordSpacing, interword_spacing, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getInterwordSpacing * Signature: ()Ljava/lang/String; */ getDoubleMethod(Java_magick_DrawInfo_getInterwordSpacing, interword_spacing, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setInterwordSpacing * Signature: (Ljava/lang/String;)V */ setDoubleMethod(Java_magick_DrawInfo_setInterlineSpacing, interline_spacing, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getInterwordSpacing * Signature: ()Ljava/lang/String; */ getDoubleMethod(Java_magick_DrawInfo_getInterlineSpacing, interline_spacing, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setStrokeWidth * Signature: (D)V */ setDoubleMethod(Java_magick_DrawInfo_setStrokeWidth, stroke_width, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getStrokeWidth * Signature: ()D */ getDoubleMethod(Java_magick_DrawInfo_getStrokeWidth, stroke_width, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setPointsize * Signature: (D)V */ setDoubleMethod(Java_magick_DrawInfo_setPointsize, pointsize, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getPointsize * Signature: ()D */ getDoubleMethod(Java_magick_DrawInfo_getPointsize, pointsize, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setFill * Signature: (Lmagick/PixelPacket;)V */ setPixelPacketMethod(Java_magick_DrawInfo_setFill, fill, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getFill * Signature: ()Lmagick/PixelPacket; */ getPixelPacketMethod(Java_magick_DrawInfo_getFill, fill, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setStroke * Signature: (Lmagick/PixelPacket;)V */ setPixelPacketMethod(Java_magick_DrawInfo_setStroke, stroke, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getStroke * Signature: ()Lmagick/PixelPacket; */ getPixelPacketMethod(Java_magick_DrawInfo_getStroke, stroke, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setUnderColor * Signature: (Lmagick/PixelPacket;)V */ setPixelPacketMethod(Java_magick_DrawInfo_setUnderColor, undercolor, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getUnderColor * Signature: ()Lmagick/PixelPacket; */ getPixelPacketMethod(Java_magick_DrawInfo_getUnderColor, undercolor, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setBorderColor * Signature: (Lmagick/PixelPacket;)V */ setPixelPacketMethod(Java_magick_DrawInfo_setBorderColor, border_color, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: getBorderColor * Signature: ()Lmagick/PixelPacket; */ getPixelPacketMethod(Java_magick_DrawInfo_getBorderColor, border_color, "drawInfoHandle", DrawInfo) /* * Class: magick_DrawInfo * Method: setTile * Signature: (Lmagick/MagickImage;)V */ JNIEXPORT void JNICALL Java_magick_DrawInfo_setTile (JNIEnv *env, jobject self, jobject tileImage) { #if MagickLibVersion < 0x700 DrawInfo *drawInfo; Image *image, *imgCopy; ExceptionInfo *exception; drawInfo = (DrawInfo*) getHandle(env, self, "drawInfoHandle", NULL); if (drawInfo == NULL) { throwMagickException(env, "Unable to obtain DrawInfo handle"); return; } image = (Image*) getHandle(env, tileImage, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to obtain MagickImage handle"); return; } exception = AcquireExceptionInfo(); imgCopy = CloneImage(image, 0, 0, 1, exception); if (imgCopy == NULL) { throwMagickApiException(env, "Unable to clone MagickImage", exception); DestroyExceptionInfo(exception); return; } DestroyExceptionInfo(exception); if (drawInfo->tile != NULL) { DestroyImages(drawInfo->tile); } drawInfo->tile = imgCopy; #endif } /* * Class: magick_DrawInfo * Method: getTile * Signature: ()Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_DrawInfo_getTile (JNIEnv *env, jobject self) { #if MagickLibVersion < 0x700 DrawInfo *drawInfo; Image *image; ExceptionInfo *exception; jobject imgObj; drawInfo = (DrawInfo*) getHandle(env, self, "drawInfoHandle", NULL); if (drawInfo == NULL) { throwMagickException(env, "Unable to obtain DrawInfo handle"); return NULL; } exception = AcquireExceptionInfo(); image = CloneImage(drawInfo->tile, 0, 0, 1, exception); if (image == NULL) { throwMagickApiException(env, "Unable to clone image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); imgObj = newImageObject(env, image); if (imgObj == NULL) { DestroyImages(image); throwMagickException(env, "Unable to create image object from handle"); return NULL; } return imgObj; #else return NULL; #endif } techblue-jmagick-b4412af/src/magick/magick_ImageInfo.c000066400000000000000000000426711452765401600227000ustar00rootroot00000000000000#include #include #include #include #include #include #if defined (IMAGEMAGICK_HEADER_STYLE_7) # include #else # include #endif #include "magick_ImageInfo.h" #include "jmagick.h" /* * Class: magick_ImageInfo * Method: init * Signature: ()V */ JNIEXPORT void JNICALL Java_magick_ImageInfo_init (JNIEnv *env, jobject obj) { ImageInfo *imageInfo = NULL; jfieldID fid = 0; imageInfo = (ImageInfo*) getHandle(env, obj, "imageInfoHandle", &fid); if (imageInfo == NULL) { imageInfo = AcquireImageInfo(); if (imageInfo == NULL) { throwMagickException(env, "Unable to allocate memory for handle"); return; } } GetImageInfo(imageInfo); setHandle(env, obj, "imageInfoHandle", (void*) imageInfo, &fid); } /* * Class: magick_ImageInfo * Method: setImageOption * Signature: (Ljava/lang/String;Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_magick_ImageInfo_setImageOption (JNIEnv *env, jobject self, jstring option, jstring value) { ImageInfo *info = NULL; const char *cstr1 = NULL; const char *cstr2 = NULL; info = (ImageInfo *) getHandle(env, self, "imageInfoHandle", NULL); if (info == NULL) { throwMagickException(env, "Unable to retrieve handle"); return; } cstr1 = (*env)->GetStringUTFChars(env, option, 0); if (cstr1 == NULL) { throwMagickException(env, "Unable to retrieve Java string chars"); return; } cstr2 = (*env)->GetStringUTFChars(env, value, 0); if (cstr2 == NULL) { throwMagickException(env, "Unable to retrieve Java string chars"); return; } SetImageOption(info, cstr1, cstr2); (*env)->ReleaseStringUTFChars(env, option, cstr1); (*env)->ReleaseStringUTFChars(env, value, cstr2); } /* * Class: magick_ImageInfo * Method: setFileName * Signature: (Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_magick_ImageInfo_setFileName (JNIEnv *env, jobject obj, jstring fileName) { ImageInfo *imageInfo = NULL; jfieldID handleFid = 0; const char *cstr = NULL; imageInfo = (ImageInfo*) getHandle(env, obj, "imageInfoHandle", &handleFid); if (imageInfo == NULL) { imageInfo = AcquireImageInfo(); if (imageInfo == NULL) { throwMagickException(env, "Unable to allow memory for handle"); return; } GetImageInfo(imageInfo); setHandle(env, obj, "imageInfoHandle", (void*) imageInfo, &handleFid); } cstr = (*env)->GetStringUTFChars(env, fileName, 0); strcpy(imageInfo->filename, cstr); (*env)->ReleaseStringUTFChars(env, fileName, cstr); #ifdef DIAGNOSTIC fprintf(stderr, "Set the file name in ImageInfo to %s\n", imageInfo->filename); #endif } /* * Class: magick_ImageInfo * Method: getFileName * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_magick_ImageInfo_getFileName (JNIEnv *env, jobject obj) { ImageInfo *imageInfo = NULL; imageInfo = (ImageInfo*) getHandle(env, obj, "imageInfoHandle", NULL); if (imageInfo == NULL) { throwMagickException(env, "Unable to retrieve ImageInfo handle"); return NULL; } return (*env)->NewStringUTF(env, imageInfo->filename); } /* * Class: magick_ImageInfo * Method: setSubimage * Signature: (I)V */ #if MagickLibVersion < 0x700 setIntMethod(Java_magick_ImageInfo_setSubimage, subimage, "imageInfoHandle", ImageInfo) #else setDeprecatedMethod(Java_magick_ImageInfo_setSubimage, subimage, "imageInfoHandle", ImageInfo, jint) #endif /* * Class: magick_ImageInfo * Method: getSubimage * Signature: ()I */ #if MagickLibVersion < 0x700 getIntMethod(Java_magick_ImageInfo_getSubimage, subimage, "imageInfoHandle", ImageInfo) #else getDeprecatedMethod(Java_magick_ImageInfo_getSubimage, subimage, "imageInfoHandle", ImageInfo, jint) #endif /* * Class: magick_ImageInfo * Method: setSubrange * Signature: (I)V */ #if MagickLibVersion < 0x700 setIntMethod(Java_magick_ImageInfo_setSubrange, subrange, "imageInfoHandle", ImageInfo) #else setDeprecatedMethod(Java_magick_ImageInfo_setSubrange, subrange, "imageInfoHandle", ImageInfo, jint) #endif /* * Class: magick_ImageInfo * Method: getSubrange * Signature: ()I */ #if MagickLibVersion < 0x700 getIntMethod(Java_magick_ImageInfo_getSubrange, subrange, "imageInfoHandle", ImageInfo) #else getDeprecatedMethod(Java_magick_ImageInfo_getSubrange, subrange, "imageInfoHandle", ImageInfo, jint) #endif /* * Class: magick_ImageInfo * Method: setServerName * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_ImageInfo_setServerName, server_name, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getServerName * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_ImageInfo_getServerName, server_name, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setFont * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_ImageInfo_setFont, font, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getFont * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_ImageInfo_getFont, font, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setSize * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_ImageInfo_setSize, size, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getSize * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_ImageInfo_getSize, size, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setTile * Signature: (Ljava/lang/String;)V */ #if MagickLibVersion < 0x700 setStringMethod(Java_magick_ImageInfo_setTile, tile, "imageInfoHandle", ImageInfo) #else setDeprecatedMethod(Java_magick_ImageInfo_setTile, tile, "imageInfoHandle", ImageInfo, jstring) #endif /* * Class: magick_ImageInfo * Method: getTile * Signature: ()Ljava/lang/String; */ #if MagickLibVersion < 0x700 getStringMethod(Java_magick_ImageInfo_getTile, tile, "imageInfoHandle", ImageInfo) #else getStringDeprecatedMethod(Java_magick_ImageInfo_getTile, tile, "imageInfoHandle", ImageInfo) #endif /* * Class: magick_ImageInfo * Method: setDensity * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_ImageInfo_setDensity, density, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getDensity * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_ImageInfo_getDensity, density, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setPage * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_ImageInfo_setPage, page, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getPage * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_ImageInfo_getPage, page, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setTexture * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_ImageInfo_setTexture, texture, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getTexture * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_ImageInfo_getTexture, texture, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setView * Signature: (Ljava/lang/String;)V */ #if MagickLibVersion < 0x700 setStringMethod(Java_magick_ImageInfo_setView, view, "imageInfoHandle", ImageInfo) #else setDeprecatedMethod(Java_magick_ImageInfo_setView, view, "imageInfoHandle", ImageInfo, jstring) #endif /* * Class: magick_ImageInfo * Method: getView * Signature: ()Ljava/lang/String; */ #if MagickLibVersion < 0x700 getStringMethod(Java_magick_ImageInfo_getView, view, "imageInfoHandle", ImageInfo) #else getStringDeprecatedMethod(Java_magick_ImageInfo_getView, view, "imageInfoHandle", ImageInfo) #endif /* * Class: magick_ImageInfo * Method: setAdjoin * Signature: (I)V */ setIntMethod(Java_magick_ImageInfo_setAdjoin, adjoin, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getAdjoin * Signature: ()I */ getIntMethod(Java_magick_ImageInfo_getAdjoin, adjoin, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setColorspace * Signature: (I)V */ setIntMethod(Java_magick_ImageInfo_setColorspace, colorspace, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getColorspace * Signature: ()I */ getIntMethod(Java_magick_ImageInfo_getColorspace, colorspace, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setCompression * Signature: (I)V */ setIntMethod(Java_magick_ImageInfo_setCompression, compression, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getCompression * Signature: ()I */ getIntMethod(Java_magick_ImageInfo_getCompression, compression, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setDither * Signature: (I)V */ setIntMethod(Java_magick_ImageInfo_setDither, dither, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getDither * Signature: ()I */ getIntMethod(Java_magick_ImageInfo_getDither, dither, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setAntialias * Signature: (I)V */ setIntMethod(Java_magick_ImageInfo_setAntialias, antialias, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getAntialias * Signature: ()I */ getIntMethod(Java_magick_ImageInfo_getAntialias, antialias, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setInterlace * Signature: (I)V */ setIntMethod(Java_magick_ImageInfo_setInterlace, interlace, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getInterlace * Signature: ()I */ getIntMethod(Java_magick_ImageInfo_getInterlace, interlace, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setMonochrome * Signature: (I)V */ setIntMethod(Java_magick_ImageInfo_setMonochrome, monochrome, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getMonochrome * Signature: ()I */ getIntMethod(Java_magick_ImageInfo_getMonochrome, monochrome, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setFuzz * Signature: (D)V */ setDoubleMethod(Java_magick_ImageInfo_setFuzz, fuzz, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getFuzz * Signature: ()D */ getDoubleMethod(Java_magick_ImageInfo_getFuzz, fuzz, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setPointSize * Signature: (I)V */ setIntMethod(Java_magick_ImageInfo_setPointSize, pointsize, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getPointSize * Signature: ()I */ getIntMethod(Java_magick_ImageInfo_getPointSize, pointsize, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setQuality * Signature: (I)V */ setIntMethod(Java_magick_ImageInfo_setQuality, quality, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getQuality * Signature: ()I */ getIntMethod(Java_magick_ImageInfo_getQuality, quality, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setVerbose * Signature: (I)V */ setIntMethod(Java_magick_ImageInfo_setVerbose, verbose, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getVerbose * Signature: ()I */ getIntMethod(Java_magick_ImageInfo_getVerbose, verbose, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setPreviewType * Signature: (I)V */ #if MagickLibVersion < 0x700 setIntMethod(Java_magick_ImageInfo_setPreviewType, preview_type, "imageInfoHandle", ImageInfo) #else setDeprecatedMethod(Java_magick_ImageInfo_setPreviewType, preview_type, "imageInfoHandle", ImageInfo, jint) #endif /* * Class: magick_ImageInfo * Method: getPreviewType * Signature: ()I */ #if MagickLibVersion < 0x700 getIntMethod(Java_magick_ImageInfo_getPreviewType, preview_type, "imageInfoHandle", ImageInfo) #else getDeprecatedMethod(Java_magick_ImageInfo_getPreviewType, preview_type, "imageInfoHandle", ImageInfo, jint) #endif /* * Class: magick_ImageInfo * Method: setPing * Signature: (Z)V */ setBoolMethod(Java_magick_ImageInfo_setPing, ping, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getPing * Signature: ()Z */ getBoolMethod(Java_magick_ImageInfo_getPing, ping, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: destroyImageInfo * Signature: ()V */ JNIEXPORT void JNICALL Java_magick_ImageInfo_destroyImageInfo (JNIEnv *env, jobject obj) { ImageInfo *imageInfo = NULL; jfieldID handleFid = 0; imageInfo = (ImageInfo*) getHandle(env, obj, "imageInfoHandle", &handleFid); if (imageInfo != NULL) { setHandle(env, obj, "imageInfoHandle", NULL, &handleFid); DestroyImageInfo(imageInfo); } } /* * Class: magick_ImageInfo * Method: setMagick * Signature: (Ljava/lang/String;)V * * Contributed by Abdulbaset Gaddah */ JNIEXPORT void JNICALL Java_magick_ImageInfo_setMagick (JNIEnv *env, jobject obj, jstring magick) { ImageInfo *imageInfo = NULL; jfieldID handleFid = 0; const char *cstr = NULL; imageInfo = (ImageInfo*) getHandle(env, obj, "imageInfoHandle", &handleFid); if (imageInfo == NULL) { imageInfo = AcquireImageInfo(); if (imageInfo == NULL) { throwMagickException(env, "Unable to allocate memory for handle"); return; } GetImageInfo(imageInfo); setHandle(env, obj, "imageInfoHandle", (void*) imageInfo, &handleFid); } cstr = (*env)->GetStringUTFChars(env, magick, 0); strcpy(imageInfo->magick, cstr); (*env)->ReleaseStringUTFChars(env, magick, cstr); #ifdef DIAGNOSTIC fprintf(stderr, "Set the magick member in ImageInfo to %s\n", imageInfo->magick); #endif } /* * Class: magick_ImageInfo * Method: getMagick * Signature: ()Ljava/lang/String; * * Contributed by Abdulbaset Gaddah */ JNIEXPORT jstring JNICALL Java_magick_ImageInfo_getMagick (JNIEnv *env, jobject obj) { ImageInfo *imageInfo = NULL; imageInfo = (ImageInfo*) getHandle(env, obj, "imageInfoHandle", NULL); if (imageInfo == NULL) { throwMagickException(env, "Unable to retrieve ImageInfo handle"); return NULL; } return (*env)->NewStringUTF(env, imageInfo->magick); } /* * Class: magick_ImageInfo * Method: setUnits * Signature: (I)V */ setIntMethod(Java_magick_ImageInfo_setUnits, units, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getUnits * Signature: ()I */ getIntMethod(Java_magick_ImageInfo_getUnits, units, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setBorderColor * Signature: (Lmagick/PixelPacket;)V */ setPixelPacketMethod(Java_magick_ImageInfo_setBorderColor, border_color, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getBorderColor * Signature: ()Lmagick/PixelPacket; */ getPixelPacketMethod(Java_magick_ImageInfo_getBorderColor, border_color, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: getDepth * Signature: ()I */ getIntMethod(Java_magick_ImageInfo_getDepth, depth, "imageInfoHandle", ImageInfo) /* * Class: magick_ImageInfo * Method: setDepth * Signature: (I)V */ setIntMethod(Java_magick_ImageInfo_setDepth, depth, "imageInfoHandle", ImageInfo) techblue-jmagick-b4412af/src/magick/magick_Magick.c000066400000000000000000000051171452765401600222270ustar00rootroot00000000000000#include #include #include #include #include #if defined (IMAGEMAGICK_HEADER_STYLE_7) # include #else # include #endif #include "jmagick.h" #include "magick_Magick.h" /* * Class: magick_Magick * Method: parseImageGeometry * Signature: (Ljava/lang/String;Ljava/awt/Rectangle;)I */ JNIEXPORT void JNICALL Java_magick_Magick_init (JNIEnv *env, jclass magickClass) { MagickCoreGenesis(NULL, MagickFalse); } /* * Class: magick_Magick * Method: parseImageGeometry * Signature: (Ljava/lang/String;Ljava/awt/Rectangle;)I */ JNIEXPORT jint JNICALL Java_magick_Magick_parseImageGeometry (JNIEnv *env, jclass magickClass, jstring geometry, jobject rect) { unsigned long x, y, width, height; jint flags; const char *cstr; if (!getIntFieldValue(env, rect, "width", NULL, (jint *) &width) || !getIntFieldValue(env, rect, "height", NULL, (jint *) &height) || !getIntFieldValue(env, rect, "x", NULL, (jint *) &x) || !getIntFieldValue(env, rect, "y", NULL, (jint *) &y)) { throwMagickException(env, "Unable to obtain Rectangle values"); return 0; } cstr = (const char *) (*env)->GetStringUTFChars(env, geometry, 0); #if MagickLibVersion < 0x700 flags = ParseImageGeometry(cstr, &x, &y, &width, &height); #else flags = ParseMetaGeometry(cstr, (size_t *) &x, (size_t *) &y, (size_t *) &width, (size_t *) &height); #endif (*env)->ReleaseStringUTFChars(env, geometry, cstr); if (!setIntFieldValue(env, rect, "width", NULL, width) || !setIntFieldValue(env, rect, "height", NULL, height) || !setIntFieldValue(env, rect, "x", NULL, x) || !setIntFieldValue(env, rect, "y", NULL, y)) { throwMagickException(env, "Unable to set Rectangle values"); return 0; } return flags; } /* * Class: magick_Magick * Method: queryFonts * Signature: (Ljava/lang/String;)[Ljava/lang/String; */ JNIEXPORT jobjectArray JNICALL Java_magick_Magick_queryFonts (JNIEnv *env, jclass magickClass, jstring pattern) { char **fonts; size_t number_fonts; int i; ExceptionInfo *exception; jobjectArray fontArray; exception = AcquireExceptionInfo(); fonts = GetTypeList((*env)->GetStringUTFChars(env, pattern, 0), &number_fonts, exception); DestroyExceptionInfo(exception); fontArray = (*env)->NewObjectArray(env, number_fonts, (*env)->FindClass(env, "java/lang/String"), (*env)->NewStringUTF(env, "")); for(i = 0; i < number_fonts; i++) { (*env)->SetObjectArrayElement(env, fontArray, i, (*env)->NewStringUTF(env, fonts[i])); } return fontArray; } techblue-jmagick-b4412af/src/magick/magick_MagickImage.c000066400000000000000000004753741452765401600232120ustar00rootroot00000000000000#include #include #include #include #include #include #if defined (IMAGEMAGICK_HEADER_STYLE_7) # include #else # include #endif #include "magick_MagickImage.h" #include "jmagick.h" /* * Class: magick_MagickImage * Method: initMultiImage * Signature: ([Lmagick/MagickImage;)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_initMultiImage (JNIEnv *env, jobject self, jobjectArray images) { Image *image, *newImage, *lastImage, *p; jsize arrayLen; jobject obj; jfieldID fieldID = 0; ExceptionInfo *exception; int i; arrayLen = (*env)->GetArrayLength(env, images); if (arrayLen < 1) { throwMagickException(env, "No images specified"); return; } /* Get the first element in the array and clone it. */ obj = (*env)->GetObjectArrayElement(env, images, 0); if (obj == NULL) { throwMagickException(env, "First image in array null"); return; } image = (Image*) getHandle(env, obj, "magickImageHandle", &fieldID); if (image == NULL) { throwMagickException(env, "Unable to obtain image handle"); return; } exception=AcquireExceptionInfo(); newImage = CloneImage(image, 0, 0, 0, exception); if (newImage == NULL) { throwMagickApiException(env, "Unable to clone image", exception); DestroyExceptionInfo(exception); return; } DestroyExceptionInfo(exception); /* Move the lastImage pointer to the last image of the list. */ for (lastImage = newImage; lastImage->next != NULL; lastImage = lastImage->next) ; /* Move the newImage pointer to the head of the list. */ for (; newImage->previous != NULL; newImage = newImage->previous) ; /* Clone the other images in the array and append to list */ for (i = 1; i < arrayLen; i++) { /* Get the next image in the array */ obj = (*env)->GetObjectArrayElement(env, images, i); if (obj == NULL) { throwMagickException(env, "Image in array index null"); return; } image = (Image*) getHandle(env, obj, "magickImageHandle", &fieldID); if (image == NULL) { throwMagickException(env, "Unable to obtain image handle"); return; } /* Clone the image */ exception=AcquireExceptionInfo(); image = CloneImage(image, 0, 0, 0, exception); if (image == NULL) { throwMagickApiException(env, "Unable to clone image", exception); DestroyExceptionInfo(exception); #if MagickLibVersion < 0x700 DestroyImages(newImage); #else DestroyImageList(newImage); #endif return; } DestroyExceptionInfo(exception); /* Find the head of the list */ for (p = image; p->previous != NULL; p = p->previous) ; /* Link it up */ lastImage->next = p; p->previous = lastImage; /* Move lastImage to the end of the list */ for (lastImage = image; lastImage->next != NULL; lastImage = lastImage->next) ; } /* Set the image handle */ image = (Image*) getHandle(env, self, "magickImageHandle", &fieldID); if (image != NULL) { #if MagickLibVersion < 0x700 DestroyImages(image); #else DestroyImageList(image); #endif } setHandle(env, self, "magickImageHandle", (void*) newImage, &fieldID); } /* * Class: magick_MagickImage * Method: allocateImage * Signature: (Lmagick/ImageInfo;)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_allocateImage (JNIEnv *env, jobject self, jobject imageInfoObj) { ImageInfo *imageInfo = NULL; Image *image = NULL, *oldImage = NULL; jfieldID fieldID = 0; /* Obtain the ImageInfo pointer */ imageInfo = (ImageInfo*) getHandle(env, imageInfoObj, "imageInfoHandle", NULL); if (imageInfo == NULL) { throwMagickException(env, "Cannot obtain ImageInfo object"); return; } /* Allocate the image object. */ #if MagickLibVersion < 0x700 image = AllocateImage(imageInfo); #else ExceptionInfo *exception = AcquireExceptionInfo(); image = AcquireImage(imageInfo, exception); DestroyExceptionInfo(exception); #endif /* Get the old image handle and deallocate it (if required). */ oldImage = (Image*) getHandle(env, self, "magickImageHandle", &fieldID); if (oldImage != NULL) { #if MagickLibVersion < 0x700 DestroyImages(oldImage); #else DestroyImageList(oldImage); #endif } /* Store the image into the handle. */ setHandle(env, self, "magickImageHandle", (void*) image, &fieldID); } /* * Class: magick_MagickImage * Method: readImage * Signature: (Lmagick/ImageInfo;)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_readImage (JNIEnv *env, jobject self, jobject imageInfoObj) { ImageInfo *imageInfo = NULL; Image *image = NULL, *oldImage = NULL; jfieldID fieldID = 0; ExceptionInfo *exception; /* Obtain the ImageInfo pointer */ imageInfo = (ImageInfo*) getHandle(env, imageInfoObj, "imageInfoHandle", NULL); if (imageInfo == NULL) { throwMagickException(env, "Cannot obtain ImageInfo object"); return; } /* Read the image. */ #ifdef DIAGNOSTIC fprintf(stderr, "Attempting to read from file %s\n", imageInfo->filename); #endif exception=AcquireExceptionInfo(); image = ReadImage(imageInfo, exception); if (image == NULL) { throwMagickApiException(env, "Unable to read image", exception); DestroyExceptionInfo(exception); return; } DestroyExceptionInfo(exception); #ifdef DIAGNOSTIC fprintf(stderr, "ReadImage completed\n"); #endif /* Get the old image handle and deallocate it (if required). */ oldImage = (Image*) getHandle(env, self, "magickImageHandle", &fieldID); if (oldImage != NULL) { #if MagickLibVersion < 0x700 DestroyImages(oldImage); #else DestroyImageList(oldImage); #endif } /* Store the image into the handle. */ setHandle(env, self, "magickImageHandle", (void*) image, &fieldID); } /* * Class: magick_MagickImage * Method: pingImage * Signature: (Lmagick/ImageInfo;)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_pingImage (JNIEnv *env, jobject self, jobject imageInfoObj) { ImageInfo *imageInfo = NULL; Image *image = NULL, *oldImage = NULL; jfieldID fieldID = 0; ExceptionInfo *exception; // Obtain the ImageInfo pointer imageInfo = (ImageInfo*) getHandle(env, imageInfoObj, "imageInfoHandle", NULL); if (imageInfo == NULL) { throwMagickException(env, "Cannot obtain ImageInfo object"); return; } // Read the image. #ifdef DIAGNOSTIC fprintf(stderr, "Attempting to read from file %s\n", imageInfo->filename); #endif exception=AcquireExceptionInfo(); image = PingImage(imageInfo, exception); if (image == NULL) { throwMagickApiException(env, "Unable to ping image", exception); DestroyExceptionInfo(exception); return; } DestroyExceptionInfo(exception); #ifdef DIAGNOSTIC fprintf(stderr, "PingImage completed\n"); #endif // Get the old image handle and deallocate it (if required). oldImage = (Image*) getHandle(env, self, "magickImageHandle", &fieldID); if (oldImage != NULL) { #if MagickLibVersion < 0x700 DestroyImages(oldImage); #else DestroyImageList(oldImage); #endif } // Store the image into the handle. setHandle(env, self, "magickImageHandle", (void*) image, &fieldID); } /* * Class: magick_MagickImage * Method: writeImage * Signature: (Lmagick/ImageInfo;)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_writeImage (JNIEnv *env, jobject self, jobject imageInfoObj) { ImageInfo *imageInfo = NULL; Image *image = NULL; int status; /* Obtain the ImageInfo pointer. */ imageInfo = (ImageInfo*) getHandle(env, imageInfoObj, "imageInfoHandle", NULL); if (imageInfo == NULL) { throwMagickException(env, "Cannot obtain ImageInfo object"); return JNI_FALSE; } image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to write"); return JNI_FALSE; } /* Write the image. */ #if MagickLibVersion < 0x700 status = WriteImage(imageInfo, image); #else ExceptionInfo *exception = AcquireExceptionInfo(); status = WriteImage(imageInfo, image, exception); DestroyExceptionInfo(exception); #endif return (status) ? (JNI_TRUE) : (JNI_FALSE); } /* * Class: magick_MagickImage * Method: getFileName * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_magick_MagickImage_getFileName (JNIEnv *env, jobject self) { Image *image = NULL; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to get file name"); return NULL; } return (*env)->NewStringUTF(env, image->filename); } /* * Class: magick_MagickImage * Method: setFileName * Signature: (Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_setFileName (JNIEnv *env, jobject self, jstring fileName) { Image *image = NULL; const char *cstr; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to set file name"); return; } cstr = (*env)->GetStringUTFChars(env, fileName, 0); strcpy(image->filename, cstr); (*env)->ReleaseStringUTFChars(env, fileName, cstr); } /* * Class: magick_MagickImage * Method: setFilter * Signature: (I)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_setFilter (JNIEnv *env, jobject self, jint filter) { Image *image = NULL; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to set file name"); return; } image->filter = filter; } /* * Class: magick_MagickImage * Method: getFilter * Signature: ()I */ JNIEXPORT jint JNICALL Java_magick_MagickImage_getFilter (JNIEnv *env, jobject self) { Image *image = NULL; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to retrieve handle"); return -1; } return image->filter; } /* * Class: magick_MagickImage * Method: getDimension * Signature: ()Ljava/awt/Dimension; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_getDimension (JNIEnv *env, jobject self) { Image *image = NULL; jclass dimensionClass; jmethodID consMethodID; jobject dimension; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to retrieve handle"); return NULL; } dimensionClass = (*env)->FindClass(env, "java/awt/Dimension"); if (dimensionClass == 0) { throwMagickException(env, "Unable to locate class java.awt.Dimension"); return NULL; } consMethodID = (*env)->GetMethodID(env, dimensionClass, "", "(II)V"); if (consMethodID == 0) { throwMagickException(env, "Unable to construct java.awt.Dimension"); return NULL; } dimension = (*env)->NewObject(env, dimensionClass, consMethodID, image->columns, image->rows); if (dimension == NULL) { throwMagickException(env, "Unable to construct java.awt.Dimension"); return NULL; } return dimension; } /* * Class: magick_MagickImage * Method: addNoiseImage * Signature: (I)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_addNoiseImage__I (JNIEnv *env, jobject self, jint noiseType) { NoiseType noiseEnum; jobject newImage; Image *noisyImage; ExceptionInfo *exception; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } switch (noiseType) { case 0: noiseEnum = UndefinedNoise; break; case 1: noiseEnum = UniformNoise; break; case 2: noiseEnum = GaussianNoise; break; case 3: noiseEnum = MultiplicativeGaussianNoise; break; case 4: noiseEnum = ImpulseNoise; break; case 5: noiseEnum = LaplacianNoise; break; case 6: noiseEnum = PoissonNoise; break; case 7: noiseEnum = RandomNoise; break; default: noiseEnum = UndefinedNoise; break; } exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 noisyImage = AddNoiseImage(image, noiseEnum, exception); #else // From the 6.x branch of ImageMagick double attenuate=1.0; const char *option=GetImageArtifact(image,"attenuate"); if (option != (char *) NULL) attenuate = InterpretLocaleValue(option,(char **) NULL); noisyImage = AddNoiseImage(image, noiseEnum, attenuate, exception); #endif if (noisyImage == NULL) { throwMagickApiException(env, "Unable to add noise", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newImage = newImageObject(env, noisyImage); if (newImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(noisyImage); #else DestroyImageList(noisyImage); #endif throwMagickException(env, "Cannot create new MagickImage object"); return NULL; } return newImage; } /* * Class: magick_MagickImage * Method: addNoiseImage * Signature: (ID)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_addNoiseImage__ID (JNIEnv *env, jobject self, jint noiseType, jdouble attenuate) { NoiseType noiseEnum; jobject newImage; Image *noisyImage; ExceptionInfo *exception; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } switch (noiseType) { case 0: noiseEnum = UndefinedNoise; break; case 1: noiseEnum = UniformNoise; break; case 2: noiseEnum = GaussianNoise; break; case 3: noiseEnum = MultiplicativeGaussianNoise; break; case 4: noiseEnum = ImpulseNoise; break; case 5: noiseEnum = LaplacianNoise; break; case 6: noiseEnum = PoissonNoise; break; case 7: noiseEnum = RandomNoise; break; default: noiseEnum = UndefinedNoise; break; } exception = AcquireExceptionInfo(); #if MagickLibVersion < 0x700 // Pass the parameter through the artifact, then restore the old artifact const char *oldOption=GetImageArtifact(image,"attenuate"); char newOption[23] = ""; dtoa(newOption, attenuate); SetImageArtifact(image, "attenuate", newOption); noisyImage = AddNoiseImage(image, noiseEnum, exception); SetImageArtifact(image, "attenuate", oldOption); #else noisyImage = AddNoiseImage(image, noiseEnum, attenuate, exception); #endif if (noisyImage == NULL) { throwMagickApiException(env, "Unable to add noise", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newImage = newImageObject(env, noisyImage); if (newImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(noisyImage); #else DestroyImageList(noisyImage); #endif throwMagickException(env, "Cannot create new MagickImage object"); return NULL; } return newImage; } /* * Class: magick_MagickImage * Method: getDepth * Signature: ()I */ getIntMethod(Java_magick_MagickImage_getDepth, depth, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: setDepth * Signature: (I)V */ setIntMethod(Java_magick_MagickImage_setDepth, depth, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: blurImage * Signature: (DD)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_blurImage (JNIEnv *env, jobject self, jdouble radius, jdouble sigma) { Image *image = NULL, *blurredImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); blurredImage = BlurImage(image, radius, sigma, exception); if (blurredImage == NULL) { throwMagickApiException(env, "Cannot blur image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, blurredImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(blurredImage); #else DestroyImageList(blurredImage); #endif throwMagickException(env, "Unable to create new blurred image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: getStorageClass * Signature: ()I */ JNIEXPORT jint JNICALL Java_magick_MagickImage_getStorageClass (JNIEnv *env, jobject self) { Image *image = NULL; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to obtain image handle"); return -1; } return image->storage_class; } /* * Class: magick_MagickImage * Method: annotateImage * Signature: (Lmagick/AnnotateInfo;)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_annotateImage (JNIEnv *env, jobject self, jobject drawInfo) { Image *image; DrawInfo *dInfo; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); dInfo = (DrawInfo*) getHandle(env, drawInfo, "drawInfoHandle", NULL); #if MagickLibVersion < 0x700 AnnotateImage(image, dInfo); #else ExceptionInfo *exception = AcquireExceptionInfo(); AnnotateImage(image, dInfo, exception); DestroyExceptionInfo(exception); #endif } /* * Class: magick_MagickImage * Method: charcoalImage * Signature: (DD)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_charcoalImage (JNIEnv *env, jobject self, jdouble radius, jdouble sigma) { Image *image = NULL, *charcoalImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); charcoalImage = CharcoalImage(image, radius, sigma, exception); if (charcoalImage == NULL) { throwMagickApiException(env, "Cannot charcoal image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, charcoalImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(charcoalImage); #else DestroyImageList(charcoalImage); #endif throwMagickException(env, "Unable to create new charcoal image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: borderImage * Signature: (Ljava/awt/Rectangle;)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_borderImage__Ljava_awt_Rectangle_2 (JNIEnv *env, jobject self, jobject jRect) { RectangleInfo iRect; Image *image = NULL, *borderedImage = NULL; jobject newObj; ExceptionInfo *exception; if (!getRectangle(env, jRect, &iRect)) { throwMagickException(env, "Cannot retrieve rectangle information"); return NULL; } image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception = AcquireExceptionInfo(); #if MagickLibVersion < 0x700 borderedImage = BorderImage(image, &iRect, exception); #else borderedImage = BorderImage(image, &iRect, image->compose, exception); #endif if (borderedImage == NULL) { throwMagickApiException(env, "Cannot border image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, borderedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(borderedImage); #else DestroyImageList(borderedImage); #endif throwMagickException(env, "Unable to create border image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: borderImage * Signature: (Ljava/awt/Rectangle;I)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_borderImage__Ljava_awt_Rectangle_2I (JNIEnv *env, jobject self, jobject jRect, jint compositeOperator) { RectangleInfo iRect; Image *image = NULL, *borderedImage = NULL; jobject newObj; ExceptionInfo *exception; if (!getRectangle(env, jRect, &iRect)) { throwMagickException(env, "Cannot retrieve rectangle information"); return NULL; } image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception = AcquireExceptionInfo(); #if MagickLibVersion < 0x700 int oldCompositeOperator = image->compose; image->compose = compositeOperator; borderedImage = BorderImage(image, &iRect, exception); image->compose = oldCompositeOperator; #else borderedImage = BorderImage(image, &iRect, compositeOperator, exception); #endif if (borderedImage == NULL) { throwMagickApiException(env, "Cannot border image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, borderedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(borderedImage); #else DestroyImageList(borderedImage); #endif throwMagickException(env, "Unable to create border image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: raiseImage * Signature: (Ljava/awt/Rectangle;Z)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_raiseImage (JNIEnv *env, jobject self, jobject jRect, jboolean raise) { RectangleInfo iRect; Image *image = NULL; if (!getRectangle(env, jRect, &iRect)) { throwMagickException(env, "Cannot retrieve rectangle information"); return JNI_FALSE; } image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 return RaiseImage(image, &iRect, raise); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = RaiseImage(image, &iRect, raise, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: chopImage * Signature: (Ljava/awt/Rectangle;)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_chopImage (JNIEnv *env, jobject self, jobject jRect) { RectangleInfo iRect; Image *image = NULL, *choppedImage = NULL; jobject newObj; ExceptionInfo *exception; if (!getRectangle(env, jRect, &iRect)) { throwMagickException(env, "Cannot retrieve rectangle information"); return NULL; } image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); choppedImage = ChopImage(image, &iRect, exception); if (choppedImage == NULL) { throwMagickApiException(env, "Cannot chop image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, choppedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(choppedImage); #else DestroyImageList(choppedImage); #endif throwMagickException(env, "Unable to chop image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: colorizeImage * Signature: (Ljava/lang/String;Lmagick/PixelPacket;)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_colorizeImage (JNIEnv *env, jobject self, jstring opacity, jobject target) { Image *image = NULL; Image *newImage = NULL; const char *cstrOpacity = NULL; ExceptionInfo *exception; #if MagickLibVersion < 0x700 PixelPacket pixel; #else PixelInfo pixel; #endif jobject newObj; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to obtain image handle"); return NULL; } if (!getPixelPacket(env, target, &pixel)) { throwMagickException(env, "Unable to get pixel values"); return NULL; } cstrOpacity = (*env)->GetStringUTFChars(env, opacity, 0); if (cstrOpacity == NULL) { throwMagickException(env, "Unable to get opacity value"); return NULL; } exception=AcquireExceptionInfo(); newImage = ColorizeImage(image, cstrOpacity, &pixel, exception); (*env)->ReleaseStringUTFChars(env, opacity, cstrOpacity); if (newImage == NULL) { throwMagickApiException(env, "Unable to colorize image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, newImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(newImage); #else DestroyImageList(newImage); #endif throwMagickException(env, "Unable to create colorized image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: compositeImage * Signature: (ILmagick/MagickImage;ZII)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_compositeImage__ILmagick_MagickImage_2ZII (JNIEnv *env, jobject self, jint compOp, jobject compImage, jboolean clipToSelf, jint xOffset, jint yOffset) { Image *image = NULL, *comp = NULL; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to retrieve image handle"); return JNI_FALSE; } comp = (Image*) getHandle(env, compImage, "magickImageHandle", NULL); if (comp == NULL) { throwMagickException(env, "Unable to retrieve composite image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 return CompositeImage(image, compOp, comp, xOffset, yOffset); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = CompositeImage(image, comp, compOp, clipToSelf, xOffset, yOffset, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: compositeImage * Signature: (ILmagick/MagickImage;II)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_compositeImage__ILmagick_MagickImage_2II (JNIEnv *env, jobject self, jint compOp, jobject compImage, jint xOffset, jint yOffset) { return Java_magick_MagickImage_compositeImage__ILmagick_MagickImage_2ZII(env, self, compOp, compImage, JNI_TRUE, xOffset, yOffset); } /* * Class: magick_MagickImage * Method: contrastImage * Signature: (Z)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_contrastImage (JNIEnv *env, jobject self, jboolean sharpen) { Image *image = NULL; image = getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to obtain image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 return ContrastImage(image, sharpen); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = ContrastImage(image, sharpen, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: cloneImage * Signature: (IIZ)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_cloneImage (JNIEnv *env, jobject self, jint columns, jint rows, jboolean clonePixels) { Image *image = NULL, *clone = NULL; jfieldID handleFid = 0; jobject clonedImage; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", &handleFid); if (image == NULL) { throwMagickException(env, "Unable to retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); clone = CloneImage(image, columns, rows, clonePixels, exception); if (clone == NULL) { throwMagickApiException(env, "Unable to clone image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); clonedImage = newImageObject(env, clone); if (clonedImage == NULL) { throwMagickException(env, "Unable to create clone image instance"); return NULL; } return clonedImage; } /* * Class: magick_MagickImage * Method: constituteImage * Signature: (IILjava/lang/String;[B)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_constituteImage__IILjava_lang_String_2_3B (JNIEnv *env, jobject self, jint width, jint height, jstring map, jbyteArray pixels) { Image *image = NULL, *oldImage = NULL; jfieldID fieldID = 0; jint arraySize; jbyte *pixelArray; const char *mapStr; ExceptionInfo *exception; /* Check that we really have the pixels. */ if (pixels == NULL) { throwMagickException(env, "Pixels not allocated"); return; } /* Check the array size. */ mapStr = (*env)->GetStringUTFChars(env, map, 0); arraySize = width * height * strlen(mapStr); if ((*env)->GetArrayLength(env, pixels) < arraySize) { throwMagickException(env, "Pixels size too small"); (*env)->ReleaseStringUTFChars(env, map, mapStr); return; } pixelArray = (*env)->GetByteArrayElements(env, pixels, 0); #ifdef DIAGNOSTIC fprintf(stderr, "Image width is %d, height is %d\n", width, height); #endif /* Create that image. */ exception=AcquireExceptionInfo(); image = ConstituteImage(width, height, mapStr, CharPixel, pixelArray, exception); if (image == NULL) { throwMagickApiException(env, "Unable to create image", exception); (*env)->ReleaseStringUTFChars(env, map, mapStr); (*env)->ReleaseByteArrayElements(env, pixels, pixelArray, 0); DestroyExceptionInfo(exception); return; } DestroyExceptionInfo(exception); /* Get the old image handle and deallocate it (if required). */ oldImage = (Image*) getHandle(env, self, "magickImageHandle", &fieldID); if (oldImage != NULL) { #if MagickLibVersion < 0x700 DestroyImages(oldImage); #else DestroyImageList(oldImage); #endif } /* Store the image into the handle. */ setHandle(env, self, "magickImageHandle", (void*) image, &fieldID); (*env)->ReleaseStringUTFChars(env, map, mapStr); (*env)->ReleaseByteArrayElements(env, pixels, pixelArray, 0); } /* * Class: magick_MagickImage * Method: constituteImage * Signature: (IILjava/lang/String;[I)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_constituteImage__IILjava_lang_String_2_3I (JNIEnv *env, jobject self, jint width, jint height, jstring map, jintArray pixels) { Image *image = NULL, *oldImage = NULL; jfieldID fieldID = 0; jint arraySize; #if MagickLibVersion < 0x700 jint *pixelArray; #else jlong *pixelArray; #endif const char *mapStr; ExceptionInfo *exception; /* Check that we really have the pixels. */ if (pixels == NULL) { throwMagickException(env, "Pixels not allocated"); return; } /* Check the array size. */ mapStr = (*env)->GetStringUTFChars(env, map, 0); arraySize = width * height * strlen(mapStr); if ((*env)->GetArrayLength(env, pixels) < arraySize) { throwMagickException(env, "Pixels size too small"); (*env)->ReleaseStringUTFChars(env, map, mapStr); return; } #if MagickLibVersion < 0x700 pixelArray = (*env)->GetIntArrayElements(env, pixels, 0); #else pixelArray = (*env)->GetLongArrayElements(env, pixels, 0); #endif /* Create that image. */ exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 image = ConstituteImage(width, height, mapStr, IntegerPixel, #else image = ConstituteImage(width, height, mapStr, LongPixel, #endif pixelArray, exception); if (image == NULL) { throwMagickApiException(env, "Unable to create image", exception); (*env)->ReleaseStringUTFChars(env, map, mapStr); #if MagickLibVersion < 0x700 (*env)->ReleaseIntArrayElements(env, pixels, pixelArray, 0); #else (*env)->ReleaseLongArrayElements(env, pixels, pixelArray, 0); #endif DestroyExceptionInfo(exception); return; } DestroyExceptionInfo(exception); /* Get the old image handle and deallocate it (if required). */ oldImage = (Image*) getHandle(env, self, "magickImageHandle", &fieldID); if (oldImage != NULL) { #if MagickLibVersion < 0x700 DestroyImages(oldImage); #else DestroyImageList(oldImage); #endif } /* Store the image into the handle. */ setHandle(env, self, "magickImageHandle", (void*) image, &fieldID); (*env)->ReleaseStringUTFChars(env, map, mapStr); #if MagickLibVersion < 0x700 (*env)->ReleaseIntArrayElements(env, pixels, pixelArray, 0); #else (*env)->ReleaseLongArrayElements(env, pixels, pixelArray, 0); #endif } /* * Class: magick_MagickImage * Method: constituteImage * Signature: (IILjava/lang/String;[F)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_constituteImage__IILjava_lang_String_2_3F (JNIEnv *env, jobject self, jint width, jint height, jstring map, jfloatArray pixels) { Image *image = NULL, *oldImage = NULL; jfieldID fieldID = 0; jint arraySize; jfloat *pixelArray; const char *mapStr; ExceptionInfo *exception; /* Check that we really have the pixels. */ if (pixels == NULL) { throwMagickException(env, "Pixels not allocated"); return; } /* Check the array size. */ mapStr = (*env)->GetStringUTFChars(env, map, 0); arraySize = width * height * strlen(mapStr); if ((*env)->GetArrayLength(env, pixels) < arraySize) { throwMagickException(env, "Pixels size too small"); (*env)->ReleaseStringUTFChars(env, map, mapStr); return; } pixelArray = (*env)->GetFloatArrayElements(env, pixels, 0); /* Create that image. */ exception=AcquireExceptionInfo(); image = ConstituteImage(width, height, mapStr, FloatPixel, pixelArray, exception); if (image == NULL) { throwMagickApiException(env, "Unable to create image", exception); (*env)->ReleaseStringUTFChars(env, map, mapStr); (*env)->ReleaseFloatArrayElements(env, pixels, pixelArray, 0); DestroyExceptionInfo(exception); return; } DestroyExceptionInfo(exception); /* Get the old image handle and deallocate it (if required). */ oldImage = (Image*) getHandle(env, self, "magickImageHandle", &fieldID); if (oldImage != NULL) { #if MagickLibVersion < 0x700 DestroyImages(oldImage); #else DestroyImageList(oldImage); #endif } /* Store the image into the handle. */ setHandle(env, self, "magickImageHandle", (void*) image, &fieldID); (*env)->ReleaseStringUTFChars(env, map, mapStr); (*env)->ReleaseFloatArrayElements(env, pixels, pixelArray, 0); } /* * Class: magick_MagickImage * Method: cropImage * Signature: (Ljava/awt/Rectangle;)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_cropImage (JNIEnv *env, jobject self, jobject jRect) { RectangleInfo iRect; Image *image = NULL, *croppedImage = NULL; jobject newObj; ExceptionInfo *exception; if (!getRectangle(env, jRect, &iRect)) { throwMagickException(env, "Cannot retrieve rectangle information"); return NULL; } image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); croppedImage = CropImage(image, &iRect, exception); if (croppedImage == NULL) { throwMagickApiException(env, "Cannot crop image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, croppedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(croppedImage); #else DestroyImageList(croppedImage); #endif throwMagickException(env, "Unable to crop image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: cycleColormapImage * Signature: ()V */ JNIEXPORT void JNICALL Java_magick_MagickImage_cycleColormapImage (JNIEnv *env, jobject self, jint amount) { Image *image = NULL; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve handle"); return; } #if MagickLibVersion < 0x700 CycleColormapImage(image, amount); #else ExceptionInfo *exception = AcquireExceptionInfo(); CycleColormapImage(image, amount, exception); DestroyExceptionInfo(exception); #endif } /* * Class: magick_MagickImage * Method: edgeImage * Signature: (D)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_edgeImage (JNIEnv *env, jobject self, jdouble radius) { Image *image = NULL, *edgedImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); edgedImage = EdgeImage(image, radius, exception); if (edgedImage == NULL) { throwMagickApiException(env, "Cannot edge image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, edgedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(edgedImage); #else DestroyImageList(edgedImage); #endif throwMagickException(env, "Unable to create new edged image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: embossImage * Signature: (DD)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_embossImage (JNIEnv *env, jobject self, jdouble radius, jdouble sigma) { Image *image = NULL, *embossedImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); embossedImage = EmbossImage(image, radius, sigma, exception); if (embossedImage == NULL) { throwMagickApiException(env, "Cannot emboss image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, embossedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(embossedImage); #else DestroyImageList(embossedImage); #endif throwMagickException(env, "Unable to create new embossed image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: enhanceImage * Signature: ()Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_enhanceImage (JNIEnv *env, jobject self) { jobject newImage; Image *image, *enhancedImage; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } exception=AcquireExceptionInfo(); enhancedImage = EnhanceImage(image, exception); if (enhancedImage == NULL) { throwMagickApiException(env, "Cannot enhance image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newImage = newImageObject(env, enhancedImage); if (newImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(enhancedImage); #else DestroyImageList(enhancedImage); #endif throwMagickException(env, "Cannot create new MagickImage object"); return NULL; } return newImage; } /* * Class: magick_MagickImage * Method: destroyImages * Signature: ()V */ JNIEXPORT void JNICALL Java_magick_MagickImage_destroyImages (JNIEnv *env, jobject self) { jfieldID handleFid = 0; Image *image = NULL; image = (Image*) getHandle(env, self, "magickImageHandle", &handleFid); if (image != NULL) { #if MagickLibVersion < 0x700 DestroyImages(image); #else DestroyImageList(image); #endif } setHandle(env, self, "magickImageHandle", NULL, &handleFid); } /* * Class: magick_MagickImage * Method: drawImage * Signature: (Lmagick/DrawInfo;)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_drawImage (JNIEnv *env, jobject self, jobject drawInfoObj) { DrawInfo *drawInfo; Image *image; drawInfo = (DrawInfo*) getHandle(env, drawInfoObj, "drawInfoHandle", NULL); if (drawInfo == NULL) { throwMagickException(env, "Cannot obtain DrawInfo handle"); return JNI_FALSE; } image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } #ifdef DIAGNOSTIC printf("Primitive: %s\n", drawInfo->primitive); printf("Font: %s\n", drawInfo->font); printf("encoding: %s\n", drawInfo->encoding); #endif #if MagickLibVersion < 0x700 return DrawImage(image, drawInfo); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = DrawImage(image, drawInfo, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: getTypeMetric * Signature: (Lmagick/DrawInfo;)Lmagick/TypeMetric; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_getTypeMetrics (JNIEnv *env, jobject self, jobject drawInfoObj) { TypeMetric typeMetric; jclass typeMetricClass; jmethodID consMethodID; jobject typeMetricObject; DrawInfo *drawInfo; Image *image; drawInfo = (DrawInfo*) getHandle(env, drawInfoObj, "drawInfoHandle", NULL); if (drawInfo == NULL) { throwMagickException(env, "Cannot obtain DrawInfo handle"); return JNI_FALSE; } image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 MagickBooleanType ret = GetTypeMetrics(image, drawInfo, &typeMetric); #else ExceptionInfo *exception = AcquireExceptionInfo(); MagickBooleanType ret = GetTypeMetrics(image, drawInfo, &typeMetric, exception); DestroyExceptionInfo(exception); #endif #ifdef DIAGNOSTIC fprintf(stderr, "Metrics: text: %s; " "width: %g; height: %g; ascent: %g; descent: %g; max advance: %g; " "bounds: %g,%g %g,%g; origin: %g,%g; pixels per em: %g,%g; " "underline position: %g; underline thickness: %g\n",drawInfo->text, typeMetric.width,typeMetric.height,typeMetric.ascent,typeMetric.descent, typeMetric.max_advance,typeMetric.bounds.x1,typeMetric.bounds.y1, typeMetric.bounds.x2,typeMetric.bounds.y2,typeMetric.origin.x,typeMetric.origin.y, typeMetric.pixels_per_em.x,typeMetric.pixels_per_em.y, typeMetric.underline_position,typeMetric.underline_thickness); #endif typeMetricClass = (*env)->FindClass(env, "magick/TypeMetric"); if (typeMetricClass == 0) { throwMagickException(env, "Unable to locate class magick/TypeMetric"); return NULL; } consMethodID = (*env)->GetMethodID(env, typeMetricClass, "", "(DD" "DDDDDDD" "DDDD" "DD)V"); if (consMethodID == 0) { throwMagickException(env, "Unable to construct magick/TypeMetric"); return NULL; } typeMetricObject = (*env)->NewObject(env, typeMetricClass, consMethodID, typeMetric.pixels_per_em.x, typeMetric.pixels_per_em.y, typeMetric.ascent, typeMetric.descent, typeMetric.width, typeMetric.height, typeMetric.max_advance, typeMetric.underline_position, typeMetric.underline_thickness, typeMetric.bounds.x1, typeMetric.bounds.y1, typeMetric.bounds.x2, typeMetric.bounds.y2, typeMetric.origin.x, typeMetric.origin.y); if (typeMetricObject == NULL) { throwMagickException(env, "Unable to construct magick/TypeMetric"); return NULL; } return typeMetricObject; } /* * Class: magick_MagickImage * Method: equalizeImage * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_equalizeImage (JNIEnv *env, jobject self) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 return EqualizeImage(image); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = EqualizeImage(image, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: flipImage * Signature: ()Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_flipImage (JNIEnv *env, jobject self) { jobject newImage; Image *image, *flippedImage; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } exception=AcquireExceptionInfo(); flippedImage = FlipImage(image, exception); if (flippedImage == NULL) { throwMagickApiException(env, "Cannot flip image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newImage = newImageObject(env, flippedImage); if (newImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(flippedImage); #else DestroyImageList(flippedImage); #endif throwMagickException(env, "Cannot create new MagickImage object"); return NULL; } return newImage; } /* * Class: magick_MagickImage * Method: flopImage * Signature: ()Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_flopImage (JNIEnv *env, jobject self) { jobject newImage; Image *image, *floppedImage; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } exception=AcquireExceptionInfo(); floppedImage = FlopImage(image, exception); if (floppedImage == NULL) { throwMagickApiException(env, "Cannot flop image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newImage = newImageObject(env, floppedImage); if (newImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(floppedImage); #else DestroyImageList(floppedImage); #endif throwMagickException(env, "Cannot create new MagickImage object"); return NULL; } return newImage; } /* * Class: magick_MagickImage * Method: gaussianBlurImage * Signature: (DD)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_gaussianBlurImage (JNIEnv *env, jobject self, jdouble radius, jdouble sigma) { Image *image = NULL, *blurredImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); blurredImage = GaussianBlurImage(image, radius, sigma, exception); if (blurredImage == NULL) { throwMagickApiException(env, "Cannot blur image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, blurredImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(blurredImage); #else DestroyImageList(blurredImage); #endif throwMagickException(env, "Unable to create Gaussian blurred image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: implodeImage * Signature: (D)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_implodeImage__D (JNIEnv *env, jobject self, jdouble amount) { return Java_magick_MagickImage_implodeImage__DI(env, self, amount, UndefinedInterpolatePixel); } /* * Class: magick_MagickImage * Method: implodeImage * Signature: (DI)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_implodeImage__DI (JNIEnv *env, jobject self, jdouble amount, jint pixelInterpolateMethod) { Image *image = NULL, *implodedImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 implodedImage = ImplodeImage(image, amount, exception); #else implodedImage = ImplodeImage(image, amount, pixelInterpolateMethod, exception); #endif if (implodedImage == NULL) { throwMagickApiException(env, "Cannot implode image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, implodedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(implodedImage); #else DestroyImageList(implodedImage); #endif throwMagickException(env, "Unable to create imploded image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: gammaImage * Signature: (Ljava/lang/String;)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_gammaImage (JNIEnv *env, jobject self, jstring gamma) { const char *cstr; unsigned int result; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } cstr = (*env)->GetStringUTFChars(env, gamma, 0); #if MagickLibVersion < 0x700 result = GammaImage(image, (char*) cstr); #else ExceptionInfo *exception = AcquireExceptionInfo(); GeometryInfo geometryInfo; MagickStatusType flags = ParseGeometry(cstr, &geometryInfo); GammaImage(image, (double) geometryInfo.rho, exception); DestroyExceptionInfo(exception); #endif (*env)->ReleaseStringUTFChars(env, gamma, cstr); return result; } /* * Class: magick_MagickImage * Method: isGrayImage * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_isGrayImage (JNIEnv *env, jobject self) { int result; ExceptionInfo *exception; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 exception=AcquireExceptionInfo(); result = IsGrayImage(image, exception); DestroyExceptionInfo(exception); #else result = IsImageGray(image); #endif return result; } /* * Class: magick_MagickImage * Method: isMonochromeImage * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_isMonochromeImage (JNIEnv *env, jobject self) { ExceptionInfo *exception; int result; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } /* Problem here is that although we have an error, how */ /* do we know that an error has occur? */ #if MagickLibVersion < 0x700 exception=AcquireExceptionInfo(); result = IsMonochromeImage(image, exception); DestroyExceptionInfo(exception); #else result = IsImageMonochrome(image); #endif return result; } /* * Class: magick_MagickImage * Method: magnifyImage * Signature: ()Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_magnifyImage (JNIEnv *env, jobject self) { jobject newImage; Image *magnifiedImage; ExceptionInfo *exception; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } exception=AcquireExceptionInfo(); magnifiedImage = MagnifyImage(image, exception); if (magnifiedImage == NULL) { throwMagickApiException(env, "Unable to magnify image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newImage = newImageObject(env, magnifiedImage); if (newImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(magnifiedImage); #else DestroyImageList(magnifiedImage); #endif throwMagickException(env, "Cannot create new MagickImage object"); return NULL; } return newImage; } /* * Class: magick_MagickImage * Method: matteFloodfillImage * Signature: (Lmagick/RunlengthPacket;IIII)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_matteFloodfillImage (JNIEnv *env, jobject self, jobject target, jint matte, jint x, jint y, jint method) { #if MagickLibVersion < 0x700 PixelPacket pixPack; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return -1; } if (!getPixelPacket(env, target, &pixPack)) { throwMagickException(env, "Unable get target PixelPacket"); return -1; } return MatteFloodfillImage(image, pixPack, matte, x, y, method); #else return JNI_TRUE; #endif } /* * Class: magick_MagickImage * Method: medianFilterImage * Signature: (D)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_medianFilterImage (JNIEnv *env, jobject self, jdouble radius) { #if MagickLibVersion < 0x700 Image *image = NULL, *filteredImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); filteredImage = MedianFilterImage(image, radius, exception); if (filteredImage == NULL) { throwMagickApiException(env, "Cannot median-filter image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, filteredImage); if (newObj == NULL) { DestroyImages(filteredImage); throwMagickException(env, "Unable to create median-filtered image"); return NULL; } return newObj; #else return self; #endif } /* * Class: magick_MagickImage * Method: colorFloodfillImage * Signature: (Lmagick/DrawInfo;Lmagick/PixelPacket;III)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_colorFloodfillImage (JNIEnv *env, jobject self, jobject drawInfo, jobject target, jint x, jint y, jint paintMethod) { #if MagickLibVersion < 0x700 PixelPacket pix; #else PixelInfo pix; #endif Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); DrawInfo *dInfo; if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return -1; } dInfo = (DrawInfo*) getHandle(env, drawInfo, "drawInfoHandle", NULL); if (dInfo == NULL) { throwMagickException(env, "Cannot obtain DrawInfo handle"); return -1; } if (!getPixelPacket(env, target, &pix)) { throwMagickException(env, "Unable get target pixel"); return -1; } #if MagickLibVersion < 0x700 return ColorFloodfillImage(image, dInfo, pix, x, y, paintMethod); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = FloodfillPaintImage(image, dInfo, &pix, x, y, paintMethod == FillToBorderMethod, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: minifyImage * Signature: ()Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_minifyImage (JNIEnv *env, jobject self) { jobject newImage; Image *minifiedImage; ExceptionInfo *exception; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } exception=AcquireExceptionInfo(); minifiedImage = MinifyImage(image, exception); if (minifiedImage == NULL) { throwMagickApiException(env, "Unable to minify image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newImage = newImageObject(env, minifiedImage); if (newImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(minifiedImage); #else DestroyImageList(minifiedImage); #endif throwMagickException(env, "Cannot create new MagickImage object"); return NULL; } return newImage; } /* * Class: magick_MagickImage * Method: modulateImage * Signature: (Ljava/lang/String;)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_modulateImage (JNIEnv *env, jobject self, jstring modulate) { const char *cstr; int result; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } cstr = (*env)->GetStringUTFChars(env, modulate, 0); #if MagickLibVersion < 0x700 result = ModulateImage(image, (char*) cstr); #else ExceptionInfo *exception = AcquireExceptionInfo(); result = ModulateImage(image, (char*) cstr, exception); DestroyExceptionInfo(exception); #endif (*env)->ReleaseStringUTFChars(env, modulate, cstr); return result; } /* * Class: magick_MagickImage * Method: oilPaintImage * Signature: (D)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_oilPaintImage__D (JNIEnv *env, jobject self, jdouble radius) { return Java_magick_MagickImage_oilPaintImage__DD(env, self, radius, 0.5); } /* * Class: magick_MagickImage * Method: oilPaintImage * Signature: (DD)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_oilPaintImage__DD (JNIEnv *env, jobject self, jdouble radius, jdouble sigma) { Image *image = NULL, *paintedImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 paintedImage = OilPaintImage(image, radius, exception); #else paintedImage = OilPaintImage(image, radius, sigma, exception); #endif if (paintedImage == NULL) { throwMagickApiException(env, "Cannot oil-paint image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, paintedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(paintedImage); #else DestroyImageList(paintedImage); #endif throwMagickException(env, "Unable to create oil-paint image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: negateImage * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_negateImage (JNIEnv *env, jobject self, jint grayscale) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 return NegateImage(image, grayscale); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = NegateImage(image, grayscale, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: reduceNoiseImage * Signature: (D)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_reduceNoiseImage (JNIEnv *env, jobject self, jdouble radius) { Image *image = NULL, *filteredImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 filteredImage = ReduceNoiseImage(image, radius, exception); #else filteredImage = StatisticImage(image, NonpeakStatistic, (size_t) radius, (size_t) radius, exception); #endif if (filteredImage == NULL) { throwMagickApiException(env, "Cannot peak-filter image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, filteredImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(filteredImage); #else DestroyImageList(filteredImage); #endif throwMagickException(env, "Unable to create peak-filtered image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: normalizeImage * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_normalizeImage (JNIEnv *env, jobject self) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 return NormalizeImage(image); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = NormalizeImage(image, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: opaqueImage * Signature: (Lmagick/PixelPacket;Lmagick/PixelPacket;)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_opaqueImage (JNIEnv *env, jobject self, jobject target, jobject penColor) { #if MagickLibVersion < 0x700 PixelPacket ppTarget, ppPenColor; #else PixelInfo ppTarget, ppPenColor; #endif Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } if (!getPixelPacket(env, target, &ppTarget) || !getPixelPacket(env, penColor, &ppPenColor)) { throwMagickException(env, "Unable to obtain pixel values"); return JNI_FALSE; } #if MagickLibVersion < 0x700 return OpaqueImage(image, ppTarget, ppPenColor); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = OpaquePaintImage(image, &ppTarget, &ppPenColor, MagickFalse, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: rgbTransformImage * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_rgbTransformImage (JNIEnv *env, jobject self, jint colorspace) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 return RGBTransformImage(image, colorspace); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = TransformImageColorspace(image, colorspace, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: rollImage * Signature: (II)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_rollImage (JNIEnv *env, jobject self, jint xOffset, jint yOffset) { jobject newImage; Image *rolledImage; ExceptionInfo *exception; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } exception=AcquireExceptionInfo(); rolledImage = RollImage(image, xOffset, yOffset, exception); if (rolledImage == NULL) { throwMagickApiException(env, "Unable to roll image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newImage = newImageObject(env, rolledImage); if (newImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(rolledImage); #else DestroyImageList(rolledImage); #endif throwMagickException(env, "Cannot create new MagickImage object"); return NULL; } return newImage; } /* * Class: magick_MagickImage * Method: sampleImage * Signature: (II)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_sampleImage (JNIEnv *env, jobject self, jint cols, jint rows) { jobject newImage; Image *sampledImage; ExceptionInfo *exception; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } exception=AcquireExceptionInfo(); sampledImage = SampleImage(image, cols, rows, exception); if (sampledImage == NULL) { throwMagickApiException(env, "Unable to sample image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newImage = newImageObject(env, sampledImage); if (newImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(sampledImage); #else DestroyImageList(sampledImage); #endif throwMagickException(env, "Cannot create new MagickImage object"); return NULL; } return newImage; } /* * Class: magick_MagickImage * Method: segmentImage * Signature: (IDD)I */ JNIEXPORT jint JNICALL Java_magick_MagickImage_segmentImage (JNIEnv *env, jobject self, jint colorspace, jdouble cluster_threshold, jdouble smoothing_threshold) { ColorspaceType colorspaceEnum; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } switch (colorspace) { case 0: colorspaceEnum = UndefinedColorspace; break; case 1: colorspaceEnum = CMYColorspace; break; case 2: colorspaceEnum = CMYKColorspace; break; case 3: colorspaceEnum = GRAYColorspace; break; case 4: colorspaceEnum = HCLColorspace; break; case 5: colorspaceEnum = HCLpColorspace; break; case 6: colorspaceEnum = HSBColorspace; break; case 7: colorspaceEnum = HSIColorspace; break; case 8: colorspaceEnum = HSLColorspace; break; case 9: colorspaceEnum = HSVColorspace; break; case 10: colorspaceEnum = HWBColorspace; break; case 11: colorspaceEnum = LabColorspace; break; case 12: colorspaceEnum = LCHColorspace; break; case 13: colorspaceEnum = LCHabColorspace; break; case 14: colorspaceEnum = LCHuvColorspace; break; case 15: colorspaceEnum = LogColorspace; break; case 16: colorspaceEnum = LMSColorspace; break; case 17: colorspaceEnum = LuvColorspace; break; case 18: colorspaceEnum = OHTAColorspace; break; case 19: colorspaceEnum = Rec601YCbCrColorspace; break; case 20: colorspaceEnum = Rec709YCbCrColorspace; break; case 21: colorspaceEnum = RGBColorspace; break; case 22: colorspaceEnum = scRGBColorspace; break; case 23: colorspaceEnum = sRGBColorspace; break; case 24: colorspaceEnum = TransparentColorspace; break; case 25: colorspaceEnum = xyYColorspace; break; case 26: colorspaceEnum = XYZColorspace; break; case 27: colorspaceEnum = YCbCrColorspace; break; case 28: colorspaceEnum = YCCColorspace; break; case 29: colorspaceEnum = YDbDrColorspace; break; case 30: colorspaceEnum = YIQColorspace; break; case 31: colorspaceEnum = YPbPrColorspace; break; case 32: colorspaceEnum = YUVColorspace; break; default: colorspaceEnum = RGBColorspace; break; } #if MagickLibVersion < 0x700 return SegmentImage(image, colorspaceEnum, 0, cluster_threshold, smoothing_threshold); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = SegmentImage(image, colorspaceEnum, 0, cluster_threshold, smoothing_threshold, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: solarizeImage * Signature: (D)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_solarizeImage (JNIEnv *env, jobject self, jdouble threshold) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return; } #if MagickLibVersion < 0x700 SolarizeImage(image, threshold); #else ExceptionInfo *exception = AcquireExceptionInfo(); SolarizeImage(image, threshold, exception); DestroyExceptionInfo(exception); #endif } /* * Class: magick_MagickImage * Method: setColorFuzz * Signature: (D)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_setColorFuzz (JNIEnv *env, jobject self, jdouble fuzz) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return; } image->fuzz= QuantumRange * fuzz; } /* * Class: magick_MagickImage * Method: getBoundingBox * Signature: ()Ljava/awt/Rectangle; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_getBoundingBox (JNIEnv *env, jobject self) { ExceptionInfo *exception; Image *image = NULL; jclass rectangleClass; jmethodID consMethodID; jobject rectangle; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to retrieve handle"); return NULL; } rectangleClass = (*env)->FindClass(env, "java/awt/Rectangle"); if (rectangleClass == 0) { throwMagickException(env, "Unable to locate class java.awt.Rectangle"); return NULL; } consMethodID = (*env)->GetMethodID(env, rectangleClass, "", "(IIII)V"); if (consMethodID == 0) { throwMagickException(env, "Unable to construct java.awt.Rectangle"); return NULL; } exception=AcquireExceptionInfo(); RectangleInfo info = GetImageBoundingBox(image, exception); rectangle = (*env)->NewObject(env, rectangleClass, consMethodID, info.x, info.y, info.width, info.height); if (rectangle == NULL) { throwMagickException(env, "Unable to construct java.awt.Rectangle"); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); return rectangle; } /* * Class: magick_MagickImage * Method: scaleImage * Signature: (II)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_scaleImage (JNIEnv *env, jobject self, jint cols, jint rows) { Image *image = NULL; Image *scaledImage = NULL; jobject returnedImage; jfieldID magickImageHandleFid = NULL; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", &magickImageHandleFid); if (image == NULL) { throwMagickException(env, "No image to scale"); return NULL; } exception=AcquireExceptionInfo(); scaledImage = ScaleImage(image, (unsigned int) cols, (unsigned int) rows, exception); if (scaledImage == NULL) { throwMagickApiException(env, "Unable to scale image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); returnedImage = newImageObject(env, scaledImage); if (returnedImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(scaledImage); #else DestroyImageList(scaledImage); #endif throwMagickException(env, "Unable to construct magick.MagickImage"); return NULL; } setHandle(env, returnedImage, "magickImageHandle", (void*) scaledImage, &magickImageHandleFid); return returnedImage; } /* * Class: magick_MagickImage * Method: resizeImage * Signature: (IID)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_resizeImage__IID (JNIEnv *env, jobject self, jint cols, jint rows, jdouble blur) { Image *image = NULL; Image *resizedImage = NULL; jobject returnedImage; jfieldID magickImageHandleFid = NULL; ExceptionInfo *exception; int i, numImages; image = (Image*) getHandle(env, self, "magickImageHandle", &magickImageHandleFid); if (image == NULL) { throwMagickException(env, "No image to resize"); return NULL; } exception=AcquireExceptionInfo(); resizedImage = ResizeImage(image, (unsigned int) cols, (unsigned int) rows, image->filter, #if MagickLibVersion < 0x700 (double) blur, #endif exception); if (resizedImage == NULL) { throwMagickApiException(env, "Unable to resize image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); returnedImage = newImageObject(env, resizedImage); if (returnedImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(resizedImage); #else DestroyImageList(resizedImage); #endif throwMagickException(env, "Unable to construct magick.MagickImage"); return NULL; } setHandle(env, returnedImage, "magickImageHandle", (void*) resizedImage, &magickImageHandleFid); return returnedImage; } /* * Class: magick_MagickImage * Method: extentImage * Signature: (III)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_extentImage (JNIEnv *env, jobject self, jint cols, jint rows, jint gravity) { Image *image = NULL; Image *extendedImage = NULL; jobject returnedImage; jfieldID magickImageHandleFid = NULL; ExceptionInfo *exception; int i, numImages; image = (Image*) getHandle(env, self, "magickImageHandle", &magickImageHandleFid); if (image == NULL) { throwMagickException(env, "No image to extent"); return NULL; } RectangleInfo geometry; SetGeometry(image,&geometry); geometry.width=cols; geometry.height=rows; GravityAdjustGeometry(image->columns,image->rows,gravity,&geometry); exception=AcquireExceptionInfo(); extendedImage = ExtentImage(image, &geometry, exception); if (extendedImage == NULL) { throwMagickApiException(env, "Unable to extent image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); returnedImage = newImageObject(env, extendedImage); if (returnedImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(extendedImage); #else DestroyImageList(extendedImage); #endif throwMagickException(env, "Unable to construct magick.MagickImage"); return NULL; } setHandle(env, returnedImage, "magickImageHandle", (void*) extendedImage, &magickImageHandleFid); return returnedImage; } /* * Class: magick_MagickImage * Method: spreadImage * Signature: (I)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_spreadImage__I (JNIEnv *env, jobject self, jint radius) { return Java_magick_MagickImage_spreadImage__II(env, self, radius, UndefinedInterpolatePixel); } /* * Class: magick_MagickImage * Method: spreadImage * Signature: (II)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_spreadImage__II (JNIEnv *env, jobject self, jint radius, jint pixelInterpolateMethod) { Image *image = NULL, *randomizedImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 randomizedImage = SpreadImage(image, radius, exception); #else randomizedImage = SpreadImage(image, radius, pixelInterpolateMethod, exception); #endif if (randomizedImage == NULL) { throwMagickApiException(env, "Cannot spread image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, randomizedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(randomizedImage); #else DestroyImageList(randomizedImage); #endif throwMagickException(env, "Unable to create spread image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: swirlImage * Signature: (D)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_swirlImage__D (JNIEnv *env, jobject self, jdouble degrees) { return Java_magick_MagickImage_swirlImage__DI(env, self, degrees, UndefinedInterpolatePixel); } /* * Class: magick_MagickImage * Method: swirlImage * Signature: (DI)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_swirlImage__DI (JNIEnv *env, jobject self, jdouble degrees, jint pixelInterpolateMethod) { Image *image = NULL, *swirledImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 swirledImage = SwirlImage(image, degrees, exception); #else swirledImage = SwirlImage(image, degrees, pixelInterpolateMethod, exception); #endif if (swirledImage == NULL) { throwMagickApiException(env, "Cannot swirl image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, swirledImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(swirledImage); #else DestroyImageList(swirledImage); #endif throwMagickException(env, "Unable to create swirled image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: sortColormapByIntensity * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_sortColormapByIntensity (JNIEnv *env, jobject self) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 return SortColormapByIntensity(image); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = SortColormapByIntensity(image, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: syncImage * Signature: ()V */ JNIEXPORT void JNICALL Java_magick_MagickImage_syncImage (JNIEnv *env, jobject self) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return; } #if MagickLibVersion < 0x700 SyncImage(image); #else ExceptionInfo *exception = AcquireExceptionInfo(); SyncImage(image, exception); DestroyExceptionInfo(exception); #endif } /* * Class: magick_MagickImage * Method: textureImage * Signature: (Lmagick/MagickImage;)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_textureImage (JNIEnv *env, jobject self, jobject texture) { Image *textureImage; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return; } textureImage = (Image*) getHandle(env, texture, "magickImageHandle", NULL); if (textureImage == NULL) { throwMagickException(env, "Cannot obtain texture image handle"); return; } #if MagickLibVersion < 0x700 TextureImage(image, textureImage); #else ExceptionInfo *exception = AcquireExceptionInfo(); TextureImage(image, textureImage, exception); DestroyExceptionInfo(exception); #endif } /* * Class: magick_MagickImage * Method: thresholdImage * Signature: (D)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_thresholdImage (JNIEnv *env, jobject self, jdouble threshold) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } #if MagickLibVersion <= 0x557 return ThresholdImage(image, threshold); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = BilevelImage(image, threshold, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: transformImage * Signature: (Ljava/lang/String;Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_transformImage (JNIEnv *env, jobject self, jstring cropGeometry, jstring imageGeometry) { const char *cropStr, *imageStr; jfieldID fieldID = 0; Image *image = (Image*) getHandle(env, self, "magickImageHandle", &fieldID); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return; } if (cropGeometry == NULL) { cropStr = NULL; } else { cropStr = (*env)->GetStringUTFChars(env, cropGeometry, 0); } if (imageGeometry == NULL) { imageStr = NULL; } else { imageStr = (*env)->GetStringUTFChars(env, imageGeometry, 0); } #if MagickLibVersion < 0x700 TransformImage(&image, cropStr, imageStr); #else ExceptionInfo *exception = AcquireExceptionInfo(); Image *transformImage = image; if (cropStr != (const char *) NULL) { Image *cropImage; /* Crop image to a user specified size. */ cropImage=CropImageToTiles(image,cropStr,exception); if (cropImage != (Image *) NULL) { transformImage=DestroyImage(transformImage); transformImage=cropImage; image=transformImage; } } if (imageStr != (const char *) NULL) { Image *resizeImage; /* Scale image to a user specified size. */ RectangleInfo geometry; MagickStatusType flags=ParseRegionGeometry(transformImage,imageStr,&geometry,exception); (void) flags; if ((transformImage->columns != geometry.width) || (transformImage->rows != geometry.height)) { resizeImage=ResizeImage(transformImage,geometry.width,geometry.height,transformImage->filter,exception); if (resizeImage != (Image *) NULL) { transformImage=DestroyImage(transformImage); transformImage=resizeImage; image=transformImage; } } } DestroyExceptionInfo(exception); #endif if (imageGeometry != NULL) { (*env)->ReleaseStringUTFChars(env, imageGeometry, imageStr); } if (cropGeometry != NULL) { (*env)->ReleaseStringUTFChars(env, cropGeometry, cropStr); } setHandle(env, self, "magickImageHandle", (void*) image, &fieldID); } /* * Class: magick_MagickImage * Method: unsharpMaskImage * Signature: (DDDD)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_unsharpMaskImage (JNIEnv *env, jobject self, jdouble radius, jdouble sigma, jdouble amount, jdouble threshold) { Image *image = NULL, *unsharpedImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); #ifdef DIAGNOSTIC fprintf(stderr, "Kalder UnsharpMaskImage() !!\n"); #endif unsharpedImage = UnsharpMaskImage(image, radius, sigma, amount, threshold, exception); #ifdef DIAGNOSTIC fprintf(stderr, "Kalder UnsharpMaskImage() færdig!!\n"); #endif if (unsharpedImage == NULL) { throwMagickApiException(env, "Cannot unsharp image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, unsharpedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(unsharpedImage); #else DestroyImageList(unsharpedImage); #endif throwMagickException(env, "Unable to create unsharped image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: waveImage * Signature: (DD)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_waveImage__DD (JNIEnv *env, jobject self, jdouble amplitude, jdouble wavelength) { return Java_magick_MagickImage_waveImage__DDI(env, self, amplitude, wavelength, UndefinedInterpolatePixel); } /* * Class: magick_MagickImage * Method: waveImage * Signature: (DDI)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_waveImage__DDI (JNIEnv *env, jobject self, jdouble amplitude, jdouble wavelength, jint pixelInterpolateMethod) { Image *image = NULL, *wavedImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 wavedImage = WaveImage(image, amplitude, wavelength, exception); #else wavedImage = WaveImage(image, amplitude, wavelength, pixelInterpolateMethod, exception); #endif if (wavedImage == NULL) { throwMagickApiException(env, "Cannot wave image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, wavedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(wavedImage); #else DestroyImageList(wavedImage); #endif throwMagickException(env, "Unable to create waved image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: transformRgbImage * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_transformRgbImage (JNIEnv *env, jobject self, jint colorspace) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 return TransformRGBImage(image, colorspace); #else ExceptionInfo* exception = AcquireExceptionInfo(); jboolean result = TransformImageColorspace(image, RGBColorspace, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: transparentImage * Signature: (Lmagick/PixelPacket;I)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_transparentImage (JNIEnv *env, jobject self, jobject color, jint opacity) { #if MagickLibVersion < 0x700 PixelPacket pixel; #else PixelInfo pixel; #endif Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } getPixelPacket(env, color, &pixel); #if MagickLibVersion < 0x700 return TransparentImage(image, pixel, (unsigned int) opacity); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = TransparentPaintImage(image, &pixel, (Quantum) opacity, MagickFalse, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: uniqueImageColors * Signature: ()Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_uniqueImageColors (JNIEnv *env, jobject self) { jobject newObj; Image *newImage; ExceptionInfo *exception; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if(image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } exception=AcquireExceptionInfo(); newImage = UniqueImageColors(image, exception); if (newImage == NULL) { throwMagickApiException(env, "Unable to generate unique image colors image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, newImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(newImage); #else DestroyImageList(newImage); #endif throwMagickException(env, "Unable to create a new MagickImage object"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: zoomImage * Signature: (II)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_zoomImage (JNIEnv *env, jobject self, jint cols, jint rows) { jobject newObj; Image *newImage; ExceptionInfo *exception; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 newImage = ZoomImage(image, cols, rows, exception); #else newImage = ResizeImage(image, cols, rows, image->filter, exception); #endif if (newImage == NULL) { throwMagickApiException(env, "Unable to zoom image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, newImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(newImage); #else DestroyImageList(newImage); #endif throwMagickException(env, "Unable to create a new MagickImage object"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: dispatchImage * Signature: (IIIILjava/lang/String;[B)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_dispatchImage__IIIILjava_lang_String_2_3B (JNIEnv *env, jobject self, jint x, jint y, jint width, jint height, jstring map, jbyteArray pixels) { Image *image = NULL; jint arraySize; const char *mapStr; jbyte *pixelArray; int result; ExceptionInfo *exception; /* Obtain the minimum pixel array size required and check correctness. */ mapStr = (*env)->GetStringUTFChars(env, map, 0); if (mapStr == NULL) { throwMagickException(env, "Unable to get component map"); return JNI_FALSE; } arraySize = width * height * strlen(mapStr); if ((*env)->GetArrayLength(env, pixels) < arraySize) { throwMagickException(env, "Pixels size too small"); (*env)->ReleaseStringUTFChars(env, map, mapStr); return JNI_FALSE; } /* Get the image object. */ image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); (*env)->ReleaseStringUTFChars(env, map, mapStr); return JNI_FALSE; } /* Get the pixel storage array and store the pixels. */ pixelArray = (*env)->GetByteArrayElements(env, pixels, 0); exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 result = DispatchImage(image, x, y, width, height, #else result = ExportImagePixels(image, x, y, width, height, #endif mapStr, CharPixel, pixelArray, exception); /* Cleanup. */ (*env)->ReleaseStringUTFChars(env, map, mapStr); (*env)->ReleaseByteArrayElements(env, pixels, pixelArray, 0); if (result == JNI_FALSE) { throwMagickApiException(env, "Error dispatching image", exception); } DestroyExceptionInfo(exception); return result; } /* * Class: magick_MagickImage * Method: dispatchImage * Signature: (IIIILjava/lang/String;[I)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_dispatchImage__IIIILjava_lang_String_2_3I (JNIEnv *env, jobject self, jint x, jint y, jint width, jint height, jstring map, jintArray pixels) { Image *image = NULL; jint arraySize; const char *mapStr; #if MagickLibVersion < 0x700 jint *pixelArray; #else jlong *pixelArray; #endif int result; ExceptionInfo *exception; /* Obtain the minimum pixel array size required and check correctness. */ mapStr = (*env)->GetStringUTFChars(env, map, 0); if (mapStr == NULL) { throwMagickException(env, "Unable to get component map"); return JNI_FALSE; } arraySize = width * height * strlen(mapStr); if ((*env)->GetArrayLength(env, pixels) < arraySize) { throwMagickException(env, "Pixels size too small"); (*env)->ReleaseStringUTFChars(env, map, mapStr); return JNI_FALSE; } /* Get the image object. */ image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); (*env)->ReleaseStringUTFChars(env, map, mapStr); return JNI_FALSE; } /* Get the pixel storage array and store the pixels. */ #if MagickLibVersion < 0x700 pixelArray = (*env)->GetIntArrayElements(env, pixels, 0); #else pixelArray = (*env)->GetLongArrayElements(env, pixels, 0); #endif exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 result = DispatchImage(image, x, y, width, height, mapStr, IntegerPixel, pixelArray, exception); #else result = ExportImagePixels(image, x, y, width, height, mapStr, LongPixel, pixelArray, exception); #endif /* Cleanup. */ (*env)->ReleaseStringUTFChars(env, map, mapStr); #if MagickLibVersion < 0x700 (*env)->ReleaseIntArrayElements(env, pixels, pixelArray, 0); #else (*env)->ReleaseLongArrayElements(env, pixels, pixelArray, 0); #endif if (result == JNI_FALSE) { throwMagickApiException(env, "Error dispatching image", exception); } DestroyExceptionInfo(exception); return result; } /* * Class: magick_MagickImage * Method: dispatchImage * Signature: (IIIILjava/lang/String;[F)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_dispatchImage__IIIILjava_lang_String_2_3F (JNIEnv *env, jobject self, jint x, jint y, jint width, jint height, jstring map, jfloatArray pixels) { Image *image = NULL; jint arraySize; const char *mapStr; jfloat *pixelArray; int result; ExceptionInfo *exception; /* Obtain the minimum pixel array size required and check correctness. */ mapStr = (*env)->GetStringUTFChars(env, map, 0); if (mapStr == NULL) { throwMagickException(env, "Unable to get component map"); return JNI_FALSE; } arraySize = width * height * strlen(mapStr); if ((*env)->GetArrayLength(env, pixels) < arraySize) { throwMagickException(env, "Pixels size too small"); (*env)->ReleaseStringUTFChars(env, map, mapStr); return JNI_FALSE; } /* Get the image object. */ image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); (*env)->ReleaseStringUTFChars(env, map, mapStr); return JNI_FALSE; } /* Get the pixel storage array and store the pixels. */ pixelArray = (*env)->GetFloatArrayElements(env, pixels, 0); exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 result = DispatchImage(image, x, y, width, height, mapStr, FloatPixel, pixelArray, exception); #else result = ExportImagePixels(image, x, y, width, height, mapStr, FloatPixel, pixelArray, exception); #endif /* Cleanup. */ (*env)->ReleaseStringUTFChars(env, map, mapStr); (*env)->ReleaseFloatArrayElements(env, pixels, pixelArray, 0); if (result == JNI_FALSE) { throwMagickApiException(env, "Error dispatching image", exception); } DestroyExceptionInfo(exception); return result; } /* * Class: magick_MagickImage * Method: getMagick * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_magick_MagickImage_getMagick (JNIEnv *env, jobject self) { Image *image = NULL; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to get image format"); return NULL; } return (*env)->NewStringUTF(env, image->magick); } /* * Class: magick_MagickImage * Method: setMagick * Signature: (Ljava/lang/String;)V * * Contributed by Abdulbaset Gaddah */ JNIEXPORT void JNICALL Java_magick_MagickImage_setMagick (JNIEnv *env, jobject self, jstring imageFormat) { Image *image = NULL; const char *cstr; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to set image Format"); return; } cstr = (*env)->GetStringUTFChars(env, imageFormat, 0); strcpy(image->magick, cstr); (*env)->ReleaseStringUTFChars(env, imageFormat, cstr); } /* * Class: magick_MagickImage * Method: getNumberColors * Signature: ()Ljava/lang/int; * * Contributed by Abdulbaset Gaddah */ JNIEXPORT jint JNICALL Java_magick_MagickImage_getNumberColors (JNIEnv *env, jobject self) { Image *image = NULL; jint numberColors=0; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to get the number of unique colors"); return -1; } exception=AcquireExceptionInfo(); numberColors=GetNumberColors(image, (FILE *) NULL, exception); if (numberColors == 0) { throwMagickApiException(env, "Error in GetNumberColors", exception); } DestroyExceptionInfo(exception); return numberColors; } /* * Class: magick_MagickImage * Method: setNumberColors * Signature: (()Ljava/lang/int)V; * * Contributed by Abdulbaset Gaddah */ JNIEXPORT void JNICALL Java_magick_MagickImage_setNumberColors (JNIEnv *env, jobject self, jint numberColors) { Image *image = NULL; QuantizeInfo quantize_info; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to set the number of unique colors"); return; } GetQuantizeInfo(&quantize_info); quantize_info.number_colors=numberColors; #if MagickLibVersion < 0x700 (void) QuantizeImage(&quantize_info,image); #else ExceptionInfo *exception = AcquireExceptionInfo(); (void) QuantizeImage(&quantize_info,image,exception); DestroyExceptionInfo(exception); #endif } /* * Class: magick_MagickImage * Method: isAnimatedImage * Signature: ()Z * * Contributed by Abdulbaset Gaddah */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_isAnimatedImage (JNIEnv *env, jobject self) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } return (image->next != (Image *) NULL) ? (JNI_TRUE) : (JNI_FALSE); } /* * Class: magick_MagickImage * Method: rotateImage * Signature: (D)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_rotateImage (JNIEnv *env, jobject self, jdouble degrees) { jobject newObj; Image *newImage; ExceptionInfo *exception; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } exception=AcquireExceptionInfo(); newImage = RotateImage(image, degrees, exception); if (newImage == NULL) { throwMagickApiException(env, "Unable to rotate image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, newImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(newImage); #else DestroyImageList(newImage); #endif throwMagickException(env, "Unable to create a new MagickImage object"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: shearImage * Signature: (DD)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_shearImage (JNIEnv *env, jobject self, jdouble x_shear, jdouble y_shear) { jobject newObj; Image *newImage; ExceptionInfo *exception; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } exception=AcquireExceptionInfo(); newImage = ShearImage(image, x_shear, y_shear, exception); if (newImage == NULL) { throwMagickApiException(env, "Unable to shear image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, newImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(newImage); #else DestroyImageList(newImage); #endif throwMagickException(env, "Unable to create a new MagickImage object"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: quantizeImage * Signature: (Lmagick/QuantizeInfo;)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_quantizeImage (JNIEnv *env, jobject self, jobject quantizeInfo) { QuantizeInfo *qInfo; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } qInfo = (QuantizeInfo*) getHandle(env, quantizeInfo, "quantizeInfoHandle", NULL); if (qInfo == NULL) { throwMagickException(env, "Cannot obtain QuantizeInfo handle"); return JNI_FALSE; } #ifdef DIAGNOSTIC fprintf(stderr, "qInfo.number_colors = %u\n", qInfo->number_colors); fprintf(stderr, "qInfo.tree_depth = %u\n", qInfo->tree_depth); fprintf(stderr, "qInfo.dither = %u\n", qInfo->dither); fprintf(stderr, "qInfo.colorspace = %u\n", qInfo->colorspace); fprintf(stderr, "qInfo.measure_error = %u\n", qInfo->measure_error); #endif #if MagickLibVersion < 0x700 return QuantizeImage(qInfo, image); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = QuantizeImage(qInfo, image, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: getColorspace * Signature: ()I */ getIntMethod(Java_magick_MagickImage_getColorspace, colorspace, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: sharpenImage * Signature: (DD)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_sharpenImage (JNIEnv *env, jobject self, jdouble radius, jdouble sigma) { Image *image = NULL, *sharpenedImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); sharpenedImage = SharpenImage(image, radius, sigma, exception); if (sharpenedImage == NULL) { throwMagickApiException(env, "Cannot sharpen image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, sharpenedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(sharpenedImage); #else DestroyImageList(sharpenedImage); #endif throwMagickException(env, "Unable to create sharpened image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: despeckleImage * Signature: ()Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_despeckleImage (JNIEnv *env, jobject self) { Image *image = NULL, *despeckledImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); despeckledImage = DespeckleImage(image, exception); if (despeckledImage == NULL) { throwMagickApiException(env, "Cannot despeckle image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, despeckledImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(despeckledImage); #else DestroyImageList(despeckledImage); #endif throwMagickException(env, "Unable to create despeckle image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: convolveImage * Signature: (I[D)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_convolveImage (JNIEnv *env, jobject self, jint order, jdoubleArray kernel) { Image *image = NULL, *convolvedImage = NULL; jobject newObj; ExceptionInfo *exception; double *karray; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } karray = (*env)->GetDoubleArrayElements(env, kernel, NULL); exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 convolvedImage = ConvolveImage(image, order, karray, exception); #else KernelInfo *kernelInfo; kernelInfo=AcquireKernelInfo(NULL, exception); if (kernelInfo == (KernelInfo *) NULL) { throwMagickApiException(env, "Cannot retrieve kernel info", exception); DestroyExceptionInfo(exception); return NULL; } int i; kernelInfo->values = (MagickRealType *) AcquireAlignedMemory(order, order*sizeof(MagickRealType)); for (i = 0; i < order*order; i++) { kernelInfo->values[i] = karray[i]; } convolvedImage = ConvolveImage(image, kernelInfo, exception); RelinquishAlignedMemory(kernelInfo->values); kernelInfo->values = (MagickRealType *) NULL; DestroyKernelInfo(kernelInfo); #endif (*env)->ReleaseDoubleArrayElements(env, kernel, karray, JNI_ABORT); if (convolvedImage == NULL) { throwMagickApiException(env, "Cannot convolve image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, convolvedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(convolvedImage); #else DestroyImageList(convolvedImage); #endif throwMagickException(env, "Unable to create convolved image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: getImageAttribute * Signature: (Ljava/lang/String;)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_magick_MagickImage_getImageAttribute (JNIEnv *env, jobject self, jstring key) { #if MagickLibVersion < 0x700 Image *image; const char *iKey; const ImageAttribute *attrib; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } iKey = (*env)->GetStringUTFChars(env, key, 0); attrib = GetImageAttribute(image, iKey); (*env)->ReleaseStringUTFChars(env, key, iKey); if (attrib == NULL || attrib->value == NULL) { return NULL; } return (*env)->NewStringUTF(env, attrib->value); #else return NULL; #endif } /* * Class: magick_MagickImage * Method: setImageAttribute * Signature: (Ljava/lang/String;Ljava/lang/String;)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_setImageAttribute (JNIEnv *env, jobject self, jstring key, jstring value) { #if MagickLibVersion < 0x700 Image *image; const char *iKey, *iValue; jboolean result; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return JNI_FALSE; } if (key == NULL) { throwMagickException(env, "Image attribute key is null"); return JNI_FALSE; } iKey = (*env)->GetStringUTFChars(env, key, 0); iValue = (value == NULL) ? NULL : (*env)->GetStringUTFChars(env, value, 0); result = SetImageAttribute(image, iKey, iValue); if (iValue != NULL) { (*env)->ReleaseStringUTFChars(env, value, iValue); } (*env)->ReleaseStringUTFChars(env, key, iKey); return result; #else return JNI_TRUE; #endif } /* * Class: magick_MagickImage * Method: blobToImage * Signature: (Lmagick/ImageInfo;[B)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_blobToImage (JNIEnv *env, jobject self, jobject imageInfoObj, jbyteArray blob) { size_t blobSiz; jbyte *blobMem; ExceptionInfo *exception; Image *image, *oldImage; jfieldID fieldID = 0; ImageInfo *imageInfo; /* Obtain the ImageInfo pointer */ imageInfo = (ImageInfo*) getHandle(env, imageInfoObj, "imageInfoHandle", NULL); if (imageInfo == NULL) { throwMagickException(env, "Cannot obtain ImageInfo object"); return; } /* Check that we do have a blob */ if (blob == NULL) { throwMagickException(env, "Blob is null"); return; } /* Get the array size and array elements */ blobSiz = (*env)->GetArrayLength(env, blob); blobMem = (*env)->GetByteArrayElements(env, blob, 0); /* Create that image. */ exception=AcquireExceptionInfo(); image = BlobToImage(imageInfo, blobMem, blobSiz, exception); (*env)->ReleaseByteArrayElements(env, blob, blobMem, 0); if (image == NULL) { throwMagickApiException(env, "Unable to convert blob to image", exception); DestroyExceptionInfo(exception); return; } DestroyExceptionInfo(exception); /* Get the old image handle and deallocate it (if required). */ oldImage = (Image*) getHandle(env, self, "magickImageHandle", &fieldID); if (oldImage != NULL) { #if MagickLibVersion < 0x700 DestroyImages(oldImage); #else DestroyImageList(oldImage); #endif } /* Store the image into the handle. */ setHandle(env, self, "magickImageHandle", (void*) image, &fieldID); } /* * Class: magick_MagickImage * Method: imageToBlob * Signature: (Lmagick/ImageInfo;)[B */ JNIEXPORT jbyteArray JNICALL Java_magick_MagickImage_imageToBlob (JNIEnv *env, jobject self, jobject imageInfoObj) { ImageInfo *imageInfo; Image *image; size_t blobSiz = 0; ExceptionInfo *exception; void *blobMem = NULL; jbyteArray blob; /* Obtain the ImageInfo pointer */ if (imageInfoObj != NULL) { imageInfo = (ImageInfo*) getHandle(env, imageInfoObj, "imageInfoHandle", NULL); if (imageInfo == NULL) { throwMagickException(env, "Cannot obtain ImageInfo object"); return NULL; } } else { imageInfo = NULL; } /* Get the Image pointer */ image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to get file name"); return NULL; } /* Do the conversion */ exception=AcquireExceptionInfo(); blobMem = ImageToBlob(imageInfo, image, &blobSiz, exception); if (blobMem == NULL) { throwMagickApiException(env, "Unable to convert image to blob", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); /* Create a new Java array. */ blob = (*env)->NewByteArray(env, blobSiz); if (blob == NULL) { throwMagickException(env, "Unable to allocate array"); return NULL; } (*env)->SetByteArrayRegion(env, blob, 0, blobSiz, blobMem); RelinquishMagickMemory(blobMem); return blob; } /* * Class: magick_MagickImage * Method: imagesToBlob * Signature: (Lmagick/ImageInfo;)[B */ JNIEXPORT jbyteArray JNICALL Java_magick_MagickImage_imagesToBlob (JNIEnv *env, jobject self, jobject imageInfoObj) { ImageInfo *imageInfo; Image *image; size_t blobSiz = 0; ExceptionInfo *exception; void *blobMem = NULL; jbyteArray blob; /* Obtain the ImageInfo pointer */ if (imageInfoObj != NULL) { imageInfo = (ImageInfo*) getHandle(env, imageInfoObj, "imageInfoHandle", NULL); if (imageInfo == NULL) { throwMagickException(env, "Cannot obtain ImageInfo object"); return NULL; } } else { imageInfo = NULL; } /* Get the Image pointer */ image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to get file name"); return NULL; } /* Do the conversion */ exception=AcquireExceptionInfo(); blobMem = ImagesToBlob(imageInfo, image, &blobSiz, exception); if (blobMem == NULL) { throwMagickApiException(env, "Unable to convert image to blob", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); /* Create a new Java array. */ blob = (*env)->NewByteArray(env, blobSiz); if (blob == NULL) { throwMagickException(env, "Unable to allocate array"); return NULL; } (*env)->SetByteArrayRegion(env, blob, 0, blobSiz, blobMem); RelinquishMagickMemory(blobMem); return blob; } /* * Class: magick_MagickImage * Method: coalesceImages * Signature: (II)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_coalesceImages (JNIEnv *env, jobject self) { Image *image = NULL; Image *coalescedImage = NULL; jobject returnedImage; jfieldID magickImageHandleFid = NULL; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", &magickImageHandleFid); if (image == NULL) { throwMagickException(env, "No image to coalesce"); return NULL; } exception=AcquireExceptionInfo(); coalescedImage = CoalesceImages(image, exception); if (coalescedImage == NULL) { throwMagickApiException(env, "Unable to coalesce image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); returnedImage = newImageObject(env, coalescedImage); if (returnedImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(coalescedImage); #else DestroyImageList(coalescedImage); #endif throwMagickException(env, "Unable to construct magick.MagickImage"); return NULL; } setHandle(env, returnedImage, "magickImageHandle", (void*) coalescedImage, &magickImageHandleFid); return returnedImage; } /* * Class: magick_MagickImage * Method: disposeImages * Signature: (II)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_disposeImages (JNIEnv *env, jobject self) { Image *image = NULL; Image *disposedImage = NULL; jobject returnedImage; jfieldID magickImageHandleFid = NULL; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", &magickImageHandleFid); if (image == NULL) { throwMagickException(env, "No image to dispose"); return NULL; } exception=AcquireExceptionInfo(); disposedImage = DisposeImages(image, exception); if (disposedImage == NULL) { throwMagickApiException(env, "Unable to dispose image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); returnedImage = newImageObject(env, disposedImage); if (returnedImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(disposedImage); #else DestroyImageList(disposedImage); #endif throwMagickException(env, "Unable to construct magick.MagickImage"); return NULL; } setHandle(env, returnedImage, "magickImageHandle", (void*) disposedImage, &magickImageHandleFid); return returnedImage; } JNIEXPORT jobject JNICALL Java_magick_MagickImage_nextImage (JNIEnv *env, jobject self) { jobject newObj; Image *nextImage; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } if (image->next == NULL) { return NULL; } nextImage = image->next; /* unlink image from sequence */ image->next = NULL; nextImage->previous = NULL; newObj = newImageObject(env, nextImage); if (newObj == NULL) { throwMagickException(env, "Unable to create a new MagickImage object"); return NULL; } return newObj; } JNIEXPORT jboolean JNICALL Java_magick_MagickImage_hasFrames (JNIEnv *env, jobject self) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } if (image->next == NULL) { return JNI_FALSE; } else { return JNI_TRUE; } } JNIEXPORT jint JNICALL Java_magick_MagickImage_getNumFrames (JNIEnv *env, jobject self) { int count = 0; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return 0; } while (image != NULL) { count++; image = image->next; } return count; } /* * Class: magick_MagickImage * Method: setUnits * Signature: (I)V */ setIntMethod(Java_magick_MagickImage_setUnits, units, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: getUnits * Signature: ()I */ getIntMethod(Java_magick_MagickImage_getUnits, units, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: setXResolution * Signature: (D)V */ #if MagickLibVersion < 0x700 setDoubleMethod(Java_magick_MagickImage_setXResolution, x_resolution, "magickImageHandle", Image) #else setDoubleMethod(Java_magick_MagickImage_setXResolution, resolution.x, "magickImageHandle", Image) #endif /* * Class: magick_MagickImage * Method: setYResolution * Signature: (D)V */ #if MagickLibVersion < 0x700 setDoubleMethod(Java_magick_MagickImage_setYResolution, y_resolution, "magickImageHandle", Image) #else setDoubleMethod(Java_magick_MagickImage_setYResolution, resolution.y, "magickImageHandle", Image) #endif /* * Class: magick_MagickImage * Method: getXResolution * Signature: ()D */ #if MagickLibVersion < 0x700 getDoubleMethod(Java_magick_MagickImage_getXResolution, x_resolution, "magickImageHandle", Image) #else getDoubleMethod(Java_magick_MagickImage_getXResolution, resolution.x, "magickImageHandle", Image) #endif /* * Class: magick_MagickImage * Method: getYResolution * Signature: ()D */ #if MagickLibVersion < 0x700 getDoubleMethod(Java_magick_MagickImage_getYResolution, y_resolution, "magickImageHandle", Image) #else getDoubleMethod(Java_magick_MagickImage_getYResolution, resolution.y, "magickImageHandle", Image) #endif /* * Class: magick_MagickImage * Method: setColorProfile * Signature: (Lmagick/ProfileInfo;)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_setColorProfile (JNIEnv *env, jobject self, jobject profileObj) { unsigned char *info; int infoSize = 0; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "setColorProfile: Cannot obtain image handle"); return; } // setProfileInfo() is broken, dont use //setProfileInfo(env, &image->color_profile, profileObj); if (profileObj == NULL) { throwMagickException(env, "setColorProfile: ProfileInfo cannot be null"); return; } info = getByteArrayFieldValue(env, profileObj, "info", NULL, &infoSize); #ifdef DIAGNOSTIC fprintf(stderr, "setColorProfile infoSize = %d info = %p\n\n", infoSize, info); #endif if (info==NULL) { RemoveImageProfile(image,"icc"); } else { StringInfo* profile_info; profile_info = AcquireStringInfo(infoSize); SetStringInfoDatum(profile_info, info); #if MagickLibVersion < 0x700 SetImageProfile(image,"icc",profile_info); #else ExceptionInfo *exception = AcquireExceptionInfo(); SetImageProfile(image,"icc",profile_info,exception); DestroyExceptionInfo(exception); #endif profile_info=DestroyStringInfo(profile_info); } } /* * Class: magick_MagickImage * Method: getColorProfile * Signature: ()Lmagick/ProfileInfo; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_getColorProfile (JNIEnv *env, jobject self) { #if MagickLibVersion < 0x700 Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } return getProfileInfo(env, &image->color_profile); #else return NULL; #endif } /* * Class: magick_MagickImage * Method: setIptcProfile * Signature: (Lmagick/ProfileInfo;)V */ JNIEXPORT void JNICALL Java_magick_MagickImage_setIptcProfile (JNIEnv *env, jobject self, jobject profileObj) { #if MagickLibVersion < 0x700 unsigned char *info; int infoSize = 0; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return; } // setProfileInfo() is broken, dont use //setProfileInfo(env, &image->iptc_profile, profileObj); if (profileObj == NULL) { throwMagickException(env, "ProfileInfo cannot be null"); return; } //name = getStringFieldValue(env, profileObj, "name", NULL); info = getByteArrayFieldValue(env, profileObj, "info", NULL, &infoSize); #ifdef DIAGNOSTIC fprintf(stderr, "setIptcProfile 8BIM infoSize = %d info = %p\n\n", infoSize, info); #endif if (info==NULL) { // RemoveImageProfile(image,"iptc"); RemoveImageProfile(image,"8bim"); } else { StringInfo* profile_info; profile_info = AcquireStringInfo(infoSize); SetStringInfoDatum(profile_info, info); // SetImageProfile(image,"iptc",profile_info); SetImageProfile(image,"8bim",profile_info); profile_info=DestroyStringInfo(profile_info); } #endif } /* * Class: magick_MagickImage * Method: getGenericProfileCount * Signature: ()I */ JNIEXPORT jint JNICALL Java_magick_MagickImage_getGenericProfileCount (JNIEnv *env, jobject self) { #if MagickLibVersion < 0x700 Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return -1; } return image->generic_profiles; #else return 0; #endif } /* * Class: magick_MagickImage * Method: getGenericProfile * Signature: (I)Lmagick/ProfileInfo; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_getGenericProfile (JNIEnv *env, jobject self, jint index) { #if MagickLibVersion < 0x700 Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } if (image->generic_profiles >= index) { return NULL; } return getProfileInfo(env, &image->generic_profile[index]); #else return NULL; #endif } /* * Class: magick_MagickImage * Method: getIptcProfile * Signature: ()Lmagick/ProfileInfo; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_getIptcProfile (JNIEnv *env, jobject self) { #if MagickLibVersion < 0x700 Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return NULL; } return getProfileInfo(env, &image->iptc_profile); #else return NULL; #endif } /* * Class: magick_MagickImage * Method: profileImage * Signature: (Ljava/lang/String;[B)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_profileImage (JNIEnv *env, jobject self, jstring profileName, jbyteArray profileData) { Image *image = NULL; const char *cstrProfileName; unsigned char *cProfileData; size_t cProfileSize; unsigned int retVal; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to set file name"); return JNI_FALSE; } if (profileName == NULL) { cstrProfileName = NULL; } else { cstrProfileName = (*env)->GetStringUTFChars(env, profileName, 0); } if (profileData == NULL) { cProfileData = NULL; cProfileSize = 0; } else { cProfileSize = (*env)->GetArrayLength(env, profileData); cProfileData = (*env)->GetByteArrayElements(env, profileData, 0); } #if MagickLibVersion < 0x700 /* Note that the clone parameter in ProfileImage is always true * for JMagick because once the byte array is released, the memory * is recovered by the JVM. */ retVal = ProfileImage(image, cstrProfileName, cProfileData, cProfileSize, 1); #else ExceptionInfo *exception = AcquireExceptionInfo(); retVal= ProfileImage(image, cstrProfileName, cProfileData, cProfileSize, exception); DestroyExceptionInfo(exception); #endif if (profileData != NULL) { (*env)->ReleaseByteArrayElements(env, profileData, cProfileData, 0); } if (profileName != NULL) { (*env)->ReleaseStringUTFChars(env, profileName, cstrProfileName); } return (retVal ? JNI_TRUE : JNI_FALSE); } /* * Class: magick_MagickImage * Method: setImageProfile */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_setImageProfile (JNIEnv *env, jobject self, jstring profileName, jbyteArray profileData) { Image *image = NULL; const char *cstrProfileName; unsigned char *cProfileData; size_t cProfileSize; unsigned int retVal; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to set file name"); return JNI_FALSE; } if (profileName == NULL) { cstrProfileName = NULL; } else { cstrProfileName = (*env)->GetStringUTFChars(env, profileName, 0); } if (profileData == NULL) { cProfileData = NULL; cProfileSize = 0; } else { cProfileSize = (*env)->GetArrayLength(env, profileData); cProfileData = (*env)->GetByteArrayElements(env, profileData, 0); } if (cProfileData == NULL) { retVal = DeleteImageProfile(image,cstrProfileName); } else { StringInfo * profile_info = NULL; profile_info = AcquireStringInfo(cProfileSize); SetStringInfoDatum(profile_info, cProfileData); #if MagickLibVersion < 0x700 retVal = SetImageProfile(image, cstrProfileName, profile_info); #else ExceptionInfo *exception = AcquireExceptionInfo(); retVal = SetImageProfile(image, cstrProfileName, profile_info, exception); DestroyExceptionInfo(exception); #endif profile_info = DestroyStringInfo(profile_info); } if (profileData != NULL) { (*env)->ReleaseByteArrayElements(env, profileData, cProfileData, 0); } if (profileName != NULL) { (*env)->ReleaseStringUTFChars(env, profileName, cstrProfileName); } return (retVal ? JNI_TRUE : JNI_FALSE); } /* * Class: magick_MagickImage * Method: getImageProfile */ JNIEXPORT jbyteArray JNICALL Java_magick_MagickImage_getImageProfile (JNIEnv *env, jobject self, jstring profileName) { Image *image = NULL; const char * cstrProfileName; jbyteArray byteArray; const StringInfo* profileInfo; unsigned char* byteElements; image = (Image * ) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to set file name"); return JNI_FALSE; } if (profileName == NULL) { cstrProfileName = NULL; } else { cstrProfileName = (*env)->GetStringUTFChars(env, profileName, 0); } profileInfo = GetImageProfile(image, cstrProfileName); if (profileInfo != (const StringInfo*) NULL && profileInfo->length > 0) { /* Construct the byte array */ byteArray = (*env)->NewByteArray(env, profileInfo -> length); if (byteArray == NULL) { throwMagickException(env, "Unable to allocate byte array " "for profile info"); return NULL; } byteElements = (*env)->GetByteArrayElements(env, byteArray, JNI_FALSE); if (byteElements == NULL) { throwMagickException(env, "Unable to obtain byte array elements " "for profile info"); return NULL; } memcpy(byteElements, GetStringInfoDatum(profileInfo), GetStringInfoLength(profileInfo)); (*env) -> ReleaseByteArrayElements(env, byteArray, byteElements, 0); } else { byteArray = NULL; } if (profileName != NULL) { ( * env) -> ReleaseStringUTFChars(env, profileName, cstrProfileName); } return byteArray; } /* * Class: magick_MagickImage * Method: getNextImageProfile */ JNIEXPORT jstring JNICALL Java_magick_MagickImage_getNextImageProfile (JNIEnv *env, jobject self) { Image *image = NULL; const char *profileName; image = (Image *) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to set file name"); return JNI_FALSE; } profileName = GetNextImageProfile(image); if (profileName == (char *) NULL) { return NULL; } return (*env)->NewStringUTF(env, profileName); } /* * Class: magick_MagickImage * Method: resetImageProfileIterator */ JNIEXPORT void JNICALL Java_magick_MagickImage_resetImageProfileIterator (JNIEnv *env, jobject self) { Image *image = NULL; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to set reset page"); return; } ResetImageProfileIterator(image); } /* * Class: magick_MagickImage * Method: montageImages * Signature: (Lmagick/MontageInfo;)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_montageImages (JNIEnv *env, jobject self, jobject montageInfo) { Image *image, *montage; MontageInfo *info; ExceptionInfo *exception; jobject newObj; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } info = (MontageInfo*) getHandle(env, montageInfo, "montageInfoHandle", NULL); if (info == NULL) { throwMagickException(env, "Unable to retrieve MontageInfo handle"); return NULL; } exception=AcquireExceptionInfo(); montage = MontageImages(image, info, exception); if (montage == NULL) { throwMagickApiException(env, "Failed to create montage", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, montage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(montage); #else DestroyImageList(montage); #endif throwMagickException(env, "Unable to create montage"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: autoOrientImage * Signature: ()Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_autoOrientImage (JNIEnv *env, jobject self) { Image *image, *orient_image; ExceptionInfo *exception; jobject newObj; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); orient_image=NewImageList(); switch (image->orientation) { case TopRightOrientation: { orient_image=FlopImage(image,exception); break; } case BottomRightOrientation: { orient_image=RotateImage(image,180.0,exception); break; } case BottomLeftOrientation: { orient_image=FlipImage(image,exception); break; } case LeftTopOrientation: { orient_image=TransposeImage(image,exception); break; } case RightTopOrientation: { orient_image=RotateImage(image,90.0,exception); break; } case RightBottomOrientation: { orient_image=TransverseImage(image,exception); break; } case LeftBottomOrientation: { orient_image=RotateImage(image,270.0,exception); break; } default: orient_image=CloneImage(image,0,0,MagickTrue,exception); image=orient_image; break; } if (orient_image == (Image *) NULL) { throwMagickApiException(env, "Failed to auto-orient image", exception); DestroyExceptionInfo(exception); return NULL; } if ( orient_image != image ) { orient_image->orientation=TopLeftOrientation; image=orient_image; } DestroyExceptionInfo(exception); newObj = newImageObject(env, image); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(image); #else DestroyImageList(image); #endif throwMagickException(env, "Unable to auto-orient image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: averageImages * Signature: ()Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_averageImages (JNIEnv *env, jobject self) { Image *image, *average; ExceptionInfo *exception; jobject newObj; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 average = AverageImages(image, exception); #else average = EvaluateImages(image, MeanEvaluateOperator, exception); #endif if (average == NULL) { throwMagickApiException(env, "Failed to create average image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, average); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(average); #else DestroyImageList(average); #endif throwMagickException(env, "Unable to create average image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: levelImage * Signature: (Ljava/lang/String;)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_levelImage (JNIEnv *env, jobject self, jstring levels) { Image *image = NULL; const char *cstr; jboolean retVal; /* Obtain the Image handle */ image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain Image handle"); return JNI_FALSE; } cstr = (*env)->GetStringUTFChars(env, levels, 0); #if MagickLibVersion < 0x700 retVal = LevelImage(image, cstr); #else retVal = LevelImageShim(image, cstr); #endif (*env)->ReleaseStringUTFChars(env, levels, cstr); return retVal; } /* * Class: magick_MagickImage * Method: sizeBlob * Signature: ()I */ JNIEXPORT jint JNICALL Java_magick_MagickImage_sizeBlob (JNIEnv *env, jobject self) { Image *image = NULL; /* Obtain the Image handle */ image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain Image handle"); return -1; } #if MagickLibVersion < 0x700 return SizeBlob(image); #else return GetBlobSize(image); #endif } /* * Class: magick_MagickImage * Method: setCompression * Signature: (I)V */ setIntMethod(Java_magick_MagickImage_setCompression, compression, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: getCompression * Signature: ()I */ getIntMethod(Java_magick_MagickImage_getCompression, compression, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: getImageType * Signature: ()I */ JNIEXPORT jint JNICALL Java_magick_MagickImage_getImageType (JNIEnv *env, jobject self) { jint imageType; Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return -1; } #if MagickLibVersion < 0x700 ExceptionInfo *exception = AcquireExceptionInfo(); imageType = GetImageType( image, exception); DestroyExceptionInfo(exception); #else imageType = GetImageType( image ); #endif return imageType; } /* * Class: magick_MagickImage * Method: getOnePixel * Signature: (II)Lmagick/PixelPacket; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_getOnePixel (JNIEnv *env, jobject self, jint xPos, jint yPos) { Image *image = NULL; jobject jPixelPacket = NULL; #if MagickLibVersion < 0x700 PixelPacket pixel; #else PixelInfo pixel; #endif jclass pixelPacketClass; jmethodID consMethodID; image = (Image *) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to retrieve image"); return NULL; } #if MagickLibVersion < 0x700 pixel = GetOnePixel(image, xPos, yPos); if (&pixel == NULL) { throwMagickException(env, "Unable to retrieve pixel"); } #else ExceptionInfo *exception = AcquireExceptionInfo(); if (!GetOneAuthenticPixel(image, xPos, yPos, (Quantum*) &pixel, exception) || &pixel == NULL) { throwMagickApiException(env, "Unable to retrieve pixel", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); #endif pixelPacketClass = (*env)->FindClass(env, "magick/PixelPacket"); if (pixelPacketClass == 0) { throwMagickException(env, "Unable to locate class magick.PixelPacket"); return NULL; } consMethodID = (*env)->GetMethodID(env, pixelPacketClass, "", "(IIII)V"); if (consMethodID == 0) { throwMagickException(env, "Unable to construct magick.PixelPacket"); return NULL; } jPixelPacket = (*env)->NewObject(env, pixelPacketClass, consMethodID, (jint) pixel.red, (jint) pixel.green, (jint) pixel.blue, #if MagickLibVersion < 0x700 (jint) pixel.opacity); #else (jint) pixel.alpha); #endif if (jPixelPacket == NULL) { throwMagickException(env, "Unable to construct magick.PixelPacket"); return NULL; } return jPixelPacket; } /* * Class: magick_MagickImage * Method: setBorderColor * Signature: (Lmagick/PixelPacket;)V */ setPixelPacketMethod(Java_magick_MagickImage_setBorderColor, border_color, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: getBorderColor * Signature: ()Lmagick/PixelPacket; */ getPixelPacketMethod(Java_magick_MagickImage_getBorderColor, border_color, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: setBackgroundColor * Signature: (Lmagick/PixelPacket;)V */ setPixelPacketMethod(Java_magick_MagickImage_setBackgroundColor, background_color, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: getBackgroundColor * Signature: ()Lmagick/PixelPacket; */ getPixelPacketMethod(Java_magick_MagickImage_getBackgroundColor, background_color, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: setDelay * Signature: (I)V */ setIntMethod(Java_magick_MagickImage_setDelay, delay, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: getDelay * Signature: ()I */ getIntMethod(Java_magick_MagickImage_getDelay, delay, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: setDispose * Signature: (I)V */ setIntMethod(Java_magick_MagickImage_setDispose, dispose, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: getDispose * Signature: ()I */ getIntMethod(Java_magick_MagickImage_getDispose, dispose, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: setIterations * Signature: (I)V */ setIntMethod(Java_magick_MagickImage_setIterations, iterations, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: getIterations * Signature: ()I */ getIntMethod(Java_magick_MagickImage_getIterations, iterations, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: setColors * Signature: (I)V */ setIntMethod(Java_magick_MagickImage_setColors, colors, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: getColors * Signature: ()I */ getIntMethod(Java_magick_MagickImage_getColors, colors, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: getTotalColors * Signature: ()I */ getIntMethod(Java_magick_MagickImage_getTotalColors, total_colors, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: getColormap * Signature: (I)Lmagick/PixelPacket; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_getColormap__I (JNIEnv *env, jobject self, jint index) { Image *image; jobject jPixelPacket = NULL; jclass pixelPacketClass; jmethodID consMethodID; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to obtain image handle"); return NULL; } if (index >= image->colors) { throwMagickException(env, "Index out of range"); return NULL; } pixelPacketClass = (*env)->FindClass(env, "magick/PixelPacket"); if (pixelPacketClass == 0) { throwMagickException(env, "Unable to locate class magick.PixelPacket"); return NULL; } consMethodID = (*env)->GetMethodID(env, pixelPacketClass, "", "(IIII)V"); if (consMethodID == 0) { throwMagickException(env, "Unable to construct magick.PixelPacket"); return NULL; } jPixelPacket = (*env)->NewObject(env, pixelPacketClass, consMethodID, (jint) image->colormap[index].red, (jint) image->colormap[index].green, (jint) image->colormap[index].blue, #if MagickLibVersion < 0x700 (jint) image->colormap[index].opacity); #else (jint) image->colormap[index].alpha); #endif if (jPixelPacket == NULL) { throwMagickException(env, "Unable to construct magick.PixelPacket"); return NULL; } return jPixelPacket; } /* * Class: magick_MagickImage * Method: getColormap * Signature: ()[Lmagick/PixelPacket; */ JNIEXPORT jobjectArray JNICALL Java_magick_MagickImage_getColormap__ (JNIEnv *env, jobject self) { Image *image; jobject jPixelPacket = NULL; jclass pixelPacketClass; jmethodID consMethodID; jobjectArray jPPArray; int i; /* Get the image handle */ image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to obtain image handle"); return NULL; } /* Sanity check */ if (image->colors <= 0 || image->colormap == NULL) { throwMagickException(env, "Image does not have a colourmap"); return NULL; } /* Get the PixelPacket object class */ pixelPacketClass = (*env)->FindClass(env, "magick/PixelPacket"); if (pixelPacketClass == 0) { throwMagickException(env, "Unable to locate class magick.PixelPacket"); return NULL; } /* Get the constructor ID for PixelPacket */ consMethodID = (*env)->GetMethodID(env, pixelPacketClass, "", "(IIII)V"); if (consMethodID == 0) { throwMagickException(env, "Unable to construct magick.PixelPacket"); return NULL; } /* Create the PixelPacket array */ jPPArray = (*env)->NewObjectArray(env, image->colors, pixelPacketClass, NULL); if (jPPArray == NULL) { throwMagickException(env, "Unable to construct PixelPacket[]"); return NULL; } /* Construct a PixelPacket for each item in the colourmap */ for (i = 0; i < image->colors; i++) { /* Create the PixelPacket */ jPixelPacket = (*env)->NewObject(env, pixelPacketClass, consMethodID, (jint) image->colormap[i].red, (jint) image->colormap[i].green, (jint) image->colormap[i].blue, #if MagickLibVersion < 0x700 (jint) image->colormap[i].opacity); #else (jint) image->colormap[i].alpha); #endif if (jPixelPacket == NULL) { throwMagickException(env, "Unable to construct magick.PixelPacket"); return NULL; } /* Set the PixelPacket in the array */ (*env)->SetObjectArrayElement(env, jPPArray, i, jPixelPacket); } return jPPArray; } /* * Class: magick_MagickImage * Method: trimImage * Signature: ()Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_trimImage (JNIEnv *env, jobject self) { Image *image = NULL, *trimmedImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); trimmedImage = TrimImage(image, exception); if (trimmedImage == NULL) { throwMagickApiException(env, "Cannot trim image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, trimmedImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(trimmedImage); #else DestroyImageList(trimmedImage); #endif throwMagickException(env, "Unable to create trimmed image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: resetImagePage * Signature: ()I */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_resetImagePage (JNIEnv *env, jobject self, jstring page) { Image *image = NULL; const char *cpage; jboolean retVal; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "No image to set reset page"); return JNI_FALSE; } cpage = (*env)->GetStringUTFChars(env, page, 0); retVal = ResetImagePage(image, cpage); (*env)->ReleaseStringUTFChars(env, page, cpage); return retVal; } /* * Class: magick_MagickImage * Method: blurImageChannel * Signature: (DD)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_blurImageChannel (JNIEnv *env, jobject self, jint channelType, jdouble radius, jdouble sigma) { Image *image = NULL, *blurredImage = NULL; jobject newObj; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 blurredImage = BlurImageChannel(image, channelType, radius, sigma, exception); #else blurredImage = BlurImage(image, radius, sigma, exception); #endif if (blurredImage == NULL) { throwMagickApiException(env, "Cannot blur image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, blurredImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(blurredImage); #else DestroyImageList(blurredImage); #endif throwMagickException(env, "Unable to create new blurred image"); return NULL; } return newObj; } /* * Class: magick_MagickImage * Method: signatureImage * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_signatureImage (JNIEnv *env, jobject self) { Image *image = NULL; jboolean retVal; /* Obtain the Image handle */ image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain Image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 retVal = SignatureImage(image); #else ExceptionInfo *exception = AcquireExceptionInfo(); retVal = SignatureImage(image, exception); DestroyExceptionInfo(exception); #endif return(retVal); } /* * Class: magick_MagickImage * Method: getQuality * Signature: ()I */ getIntMethod(Java_magick_MagickImage_getQuality, quality, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: setQuality * Signature: ()I */ setIntMethod(Java_magick_MagickImage_setQuality, quality, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: setRenderingIntent * Signature: (I)V */ setIntMethod(Java_magick_MagickImage_setRenderingIntent, rendering_intent, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: getRenderingIntent * Signature: ()I */ getIntMethod(Java_magick_MagickImage_getRenderingIntent, rendering_intent, "magickImageHandle", Image) /* * Class: magick_MagickImage * Method: setMatte * Signature: (Z)V */ #if MagickLibVersion < 0x700 setBoolMethod(Java_magick_MagickImage_setMatte, matte, "magickImageHandle", Image) #else setDeprecatedMethod(Java_magick_MagickImage_setMatte, matte, "magickImageHandle", Image, jboolean) #endif /* * Class: magick_MagickImage * Method: getMatte * Signature: ()Z */ #if MagickLibVersion < 0x700 getBoolMethod(Java_magick_MagickImage_getMatte, matte, "magickImageHandle", Image) #else getDeprecatedMethod(Java_magick_MagickImage_getMatte, matte, "magickImageHandle", Image, jboolean) #endif /* * Class: magick_MagickImage * Method: getNumberImages * Signature: ()I */ JNIEXPORT jint JNICALL Java_magick_MagickImage_getNumberImages (JNIEnv *env, jobject self) { Image *image = NULL; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to retrieve image handle"); return -1; } return GetImageListLength(image); } /* * Class: magick_MagickImage * Method: strip * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_strip (JNIEnv *env, jobject self) { Image *image = NULL; jboolean retVal; image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Unable to retrieve image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 retVal = StripImage(image); #else ExceptionInfo *exception = AcquireExceptionInfo(); retVal = StripImage(image, exception); DestroyExceptionInfo(exception); #endif return(retVal); } /* * Class: magick_MagickImage * Method: setImageColorspace * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_setImageColorspace (JNIEnv *env, jobject self, jint colorspace) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 return SetImageColorspace(image, colorspace); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = SetImageColorspace(image, colorspace, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: resizeImage * Signature: (IIID)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_resizeImage__IIID (JNIEnv *env, jobject self, jint cols, jint rows, jint filter, jdouble blur) { Image *image = NULL; Image *resizedImage = NULL; jobject returnedImage; jfieldID magickImageHandleFid = NULL; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", &magickImageHandleFid); if (image == NULL) { throwMagickException(env, "No image to scale"); return NULL; } exception = AcquireExceptionInfo(); resizedImage = ResizeImage(image, (unsigned int) cols, (unsigned int) rows, (unsigned int) filter, #if MagickLibVersion < 0x700 (double) blur, #endif exception); if (resizedImage == NULL) { throwMagickApiException(env, "Unable to resize image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); returnedImage = newImageObject(env, resizedImage); if (returnedImage == NULL) { #if MagickLibVersion < 0x700 DestroyImages(resizedImage); #else DestroyImageList(resizedImage); #endif throwMagickException(env, "Unable to construct magick.MagickImage"); return NULL; } setHandle(env, returnedImage, "magickImageHandle", (void*) resizedImage, &magickImageHandleFid); return returnedImage; } /* * Class: magick_MagickImage * Method: transformImageColorspace * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_magick_MagickImage_transformImageColorspace (JNIEnv *env, jobject self, jint colorspace) { Image *image = (Image*) getHandle(env, self, "magickImageHandle", NULL); if (image == NULL) { throwMagickException(env, "Cannot obtain image handle"); return JNI_FALSE; } #if MagickLibVersion < 0x700 return TransformImageColorspace(image, colorspace); #else ExceptionInfo *exception = AcquireExceptionInfo(); jboolean result = TransformImageColorspace(image, colorspace, exception); DestroyExceptionInfo(exception); return result; #endif } /* * Class: magick_MagickImage * Method: optimizeLayer * Signature: (Lmagick/ImageInfo;)Lmagick/MagickImage */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_optimizeLayer (JNIEnv *env, jobject self, jobject imageInfoObj) { ImageInfo *image_info = NULL, *clone_info = NULL; Image *image = NULL, *layers = NULL, *temp = NULL; QuantizeInfo *quantize_info = NULL; jobject newObj; jfieldID magickImageHandleFid = NULL; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", &magickImageHandleFid); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } /* Obtain the ImageInfo pointer */ if (imageInfoObj != NULL) { image_info = (ImageInfo*) getHandle(env, imageInfoObj, "imageInfoHandle", NULL); if (image_info == NULL) { throwMagickException(env, "Cannot obtain ImageInfo object"); return NULL; } } exception = AcquireExceptionInfo(); layers = CoalesceImages(image, exception); if (layers == NULL) { throwMagickApiException(env, "Cannot coalesce image", exception); DestroyExceptionInfo(exception); return NULL; } //image = DestroyImageList(image); temp = layers; layers = OptimizePlusImageLayers(temp, exception); if (layers == NULL) { #if MagickLibVersion < 0x700 DestroyImages(temp); #else DestroyImageList(temp); #endif throwMagickApiException(env, "Cannot optimize image layers", exception); DestroyExceptionInfo(exception); return NULL; } temp = DestroyImageList(temp); OptimizeImageTransparency(layers, exception); clone_info = CloneImageInfo(image_info); quantize_info = AcquireQuantizeInfo(clone_info); RemapImages(quantize_info, layers, NULL, exception); DestroyExceptionInfo(exception); newObj = newImageObject(env, layers); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(layers); #else DestroyImageList(layers); #endif throwMagickException(env, "Unable to create optimized image"); return NULL; } setHandle(env, newObj, "magickImageHandle", (void*) layers, &magickImageHandleFid); return newObj; } /* * Class: magick_MagickImage * Method: deconstructImages * Signature: (DD)Lmagick/MagickImage; */ JNIEXPORT jobject JNICALL Java_magick_MagickImage_deconstructImages (JNIEnv *env, jobject self) { Image *image = NULL, *deconstructImage = NULL; jobject newObj; jfieldID magickImageHandleFid = NULL; ExceptionInfo *exception; image = (Image*) getHandle(env, self, "magickImageHandle", &magickImageHandleFid); if (image == NULL) { throwMagickException(env, "Cannot retrieve image handle"); return NULL; } exception = AcquireExceptionInfo(); #if MagickLibVersion < 0x700 deconstructImage = DeconstructImages(image, exception); #else deconstructImage = CompareImagesLayers(image, CompareAnyLayer, exception); #endif if (deconstructImage == NULL) { throwMagickApiException(env, "Cannot deconstruct image", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); newObj = newImageObject(env, deconstructImage); if (newObj == NULL) { #if MagickLibVersion < 0x700 DestroyImages(deconstructImage); #else DestroyImageList(deconstructImage); #endif throwMagickException(env, "Unable to create new deconstructed image"); return NULL; } setHandle(env, newObj, "magickImageHandle", (void*) deconstructImage, &magickImageHandleFid); return newObj; } techblue-jmagick-b4412af/src/magick/magick_MagickInfo.c000066400000000000000000000036341452765401600230450ustar00rootroot00000000000000#include #include #include #include #include #include #if defined (IMAGEMAGICK_HEADER_STYLE_7) # include #else # include #endif #include "magick_MagickInfo.h" #include "jmagick.h" /* * Class: magick_MagickInfo * Method: init * Signature: ()V */ JNIEXPORT void JNICALL Java_magick_MagickInfo_init (JNIEnv *env, jobject self, jstring modname) { MagickInfo *magickInfo = NULL; jfieldID fid = 0; ExceptionInfo *exception; const char *cstr = NULL; magickInfo = (MagickInfo*) getHandle(env, self, "magickInfoHandle", &fid); exception = AcquireExceptionInfo(); cstr = (*env)->GetStringUTFChars(env, modname, 0); if (cstr == NULL) return; // out of memory magickInfo = (MagickInfo*) GetMagickInfo(cstr, exception); // release the string (*env)->ReleaseStringUTFChars(env, modname, cstr); if (magickInfo == NULL) { throwMagickApiException(env, "Unable to read magick info", exception); DestroyExceptionInfo(exception); return; } DestroyExceptionInfo(exception); setHandle(env, self, "magickInfoHandle", (void*) magickInfo, &fid); } /* * Class: magick_MagickInfo * Method: destroyMagickInfo * Signature: ()V */ JNIEXPORT void JNICALL Java_magick_MagickInfo_destroyMagickInfo (JNIEnv *env, jobject self) { MagickInfo *magickInfo = NULL; jfieldID handleFid = 0; magickInfo = (MagickInfo*) getHandle(env, self, "magickInfoHandle", &handleFid); if (magickInfo != NULL) { setHandle(env, self, "magickInfoHandle", NULL, &handleFid); /* DestroyMagickInfo(); */ } } /* * Class: magick_MagickInfo * Method: getDescription * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_MagickInfo_getDescription, description, "magickInfoHandle", MagickInfo) techblue-jmagick-b4412af/src/magick/magick_MontageInfo.c000066400000000000000000000250711452765401600232430ustar00rootroot00000000000000#include #include #include #include #include #include #if defined (IMAGEMAGICK_HEADER_STYLE_7) # include #else # include #endif #include "jmagick.h" #include "magick_MontageInfo.h" /* * Class: magick_MontageInfo * Method: init * Signature: (Lmagick/ImageInfo;)V */ JNIEXPORT void JNICALL Java_magick_MontageInfo_init (JNIEnv *env, jobject self, jobject imageInfo) { ImageInfo *info; MontageInfo *montageInfo; /* Obtain the ImageInfo */ info = (ImageInfo*) getHandle(env, imageInfo, "imageInfoHandle", NULL); if (info == NULL) { throwMagickException(env, "Unable to obtain ImageInfo handle"); return; } /* Initialise the MontageInfo handle, allocating memory if required */ montageInfo = (MontageInfo*) getHandle(env, self, "montageInfoHandle", NULL); if (montageInfo == NULL) { #if MagickLibVersion < 0x700 montageInfo = (MontageInfo*) AcquireMemory(sizeof(MontageInfo)); #else AcquireMemoryHandler acquire_memory_handler; ResizeMemoryHandler resize_memory_handler; DestroyMemoryHandler destroy_memory_handler; GetMagickMemoryMethods(&acquire_memory_handler, &resize_memory_handler, &destroy_memory_handler); montageInfo = (MontageInfo *) acquire_memory_handler(sizeof(MontageInfo)); #endif if (montageInfo == NULL) { throwMagickException(env, "Unable to allocate " "memory for MontageInfo"); return; } } GetMontageInfo(info, montageInfo); setHandle(env, self, "montageInfoHandle", (void*) montageInfo, NULL); } /* * Class: magick_MontageInfo * Method: destroyMontageInfo * Signature: ()V */ JNIEXPORT void JNICALL Java_magick_MontageInfo_destroyMontageInfo (JNIEnv *env, jobject self) { MontageInfo *montageInfo = NULL; jfieldID handleFid = 0; montageInfo = (MontageInfo*) getHandle(env, self, "montageInfoHandle", &handleFid); if (montageInfo != NULL) { setHandle(env, self, "montageInfoHandle", NULL, &handleFid); DestroyMontageInfo(montageInfo); } } /* * Class: magick_MontageInfo * Method: setGeometry * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_MontageInfo_setGeometry, geometry, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getGeometry * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_MontageInfo_getGeometry, geometry, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setTile * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_MontageInfo_setTile, tile, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getTile * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_MontageInfo_getTile, tile, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setTitle * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_MontageInfo_setTitle, title, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getTitle * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_MontageInfo_getTitle, title, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setFrame * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_MontageInfo_setFrame, frame, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getFrame * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_MontageInfo_getFrame, frame, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setTexture * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_MontageInfo_setTexture, texture, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getTexture * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_MontageInfo_getTexture, texture, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setFont * Signature: (Ljava/lang/String;)V */ setStringMethod(Java_magick_MontageInfo_setFont, font, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getFont * Signature: ()Ljava/lang/String; */ getStringMethod(Java_magick_MontageInfo_getFont, font, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setPointSize * Signature: (D)V */ setDoubleMethod(Java_magick_MontageInfo_setPointSize, pointsize, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getPointSize * Signature: ()D */ getDoubleMethod(Java_magick_MontageInfo_getPointSize, pointsize, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setBorderWidth * Signature: (I)V */ setIntMethod(Java_magick_MontageInfo_setBorderWidth, border_width, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getBorderWidth * Signature: ()I */ getIntMethod(Java_magick_MontageInfo_getBorderWidth, border_width, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setGravity * Signature: (I)V */ setIntMethod(Java_magick_MontageInfo_setGravity, gravity, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getGravity * Signature: ()I */ getIntMethod(Java_magick_MontageInfo_getGravity, gravity, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setShadow * Signature: (Z)V */ setBoolMethod(Java_magick_MontageInfo_setShadow, shadow, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getShadow * Signature: ()Z */ getBoolMethod(Java_magick_MontageInfo_getShadow, shadow, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setFill * Signature: (Lmagick/PixelPacket;)V */ setPixelPacketMethod(Java_magick_MontageInfo_setFill, fill, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getFill * Signature: ()Z */ getPixelPacketMethod(Java_magick_MontageInfo_getFill, fill, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setStroke * Signature: (Lmagick/PixelPacket;)V */ setPixelPacketMethod(Java_magick_MontageInfo_setStroke, stroke, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getStroke * Signature: ()Z */ getPixelPacketMethod(Java_magick_MontageInfo_getStroke, stroke, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setBackgroundColor * Signature: (Lmagick/PixelPacket;)V */ setPixelPacketMethod(Java_magick_MontageInfo_setBackgroundColor, background_color, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getBackgroundColor * Signature: ()Z */ getPixelPacketMethod(Java_magick_MontageInfo_getBackgroundColor, background_color, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setBorderColor * Signature: (Lmagick/PixelPacket;)V */ setPixelPacketMethod(Java_magick_MontageInfo_setBorderColor, border_color, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: getBorderColor * Signature: ()Z */ getPixelPacketMethod(Java_magick_MontageInfo_getBorderColor, border_color, "montageInfoHandle", MontageInfo) /* * Class: magick_MontageInfo * Method: setMatteColor * Signature: (Lmagick/PixelPacket;)V */ #if MagickLibVersion < 0x700 setPixelPacketMethod(Java_magick_MontageInfo_setMatteColor, matte_color, "montageInfoHandle", MontageInfo) #else setDeprecatedMethod(Java_magick_MontageInfo_setMatteColor, matte_color, "montageInfoHandle", MontageInfo, jobject) #endif /* * Class: magick_MontageInfo * Method: getMatteColor * Signature: ()Z */ #if MagickLibVersion < 0x700 getPixelPacketMethod(Java_magick_MontageInfo_getMatteColor, matte_color, "montageInfoHandle", MontageInfo) #else getDeprecatedMethod(Java_magick_MontageInfo_getMatteColor, matte_color, "montageInfoHandle", MontageInfo, jobject) #endif /* * Class: magick_MontageInfo * Method: setFileName * Signature: (Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_magick_MontageInfo_setFileName (JNIEnv *env, jobject self, jstring fileName) { MontageInfo *montageInfo = NULL; const char *cstr = NULL; montageInfo = (MontageInfo*) getHandle(env, self, "montageInfoHandle", NULL); if (montageInfo == NULL) { throwMagickException(env, "Unable to obtain MontageInfo handle"); return; } cstr = (*env)->GetStringUTFChars(env, fileName, 0); strcpy(montageInfo->filename, cstr); (*env)->ReleaseStringUTFChars(env, fileName, cstr); } /* * Class: magick_MontageInfo * Method: getFileName * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_magick_MontageInfo_getFileName (JNIEnv *env, jobject self) { MontageInfo *montageInfo = NULL; montageInfo = (MontageInfo*) getHandle(env, self, "montageInfoHandle", NULL); if (montageInfo == NULL) { throwMagickException(env, "Unable to retrieve MontageInfo handle"); return NULL; } return (*env)->NewStringUTF(env, montageInfo->filename); } techblue-jmagick-b4412af/src/magick/magick_PixelPacket.c000066400000000000000000000077151452765401600232530ustar00rootroot00000000000000#include #include #include #include #include #include #if defined (IMAGEMAGICK_HEADER_STYLE_7) # include # include #else # include # include #endif #include "jmagick.h" #include "magick_PixelPacket.h" /* * Class: magick_PixelPacket * Method: queryColorDatabase * Signature: (Ljava/lang/String;)Lmagick/PixelPacket; */ JNIEXPORT jobject JNICALL Java_magick_PixelPacket_queryColorDatabase (JNIEnv *env, jclass class, jstring target) { #if MagickLibVersion < 0x700 PixelPacket pixel; #else PixelInfo pixel; #endif const char *cstr; unsigned int result; jmethodID consMethodID; jobject jPixelPacket; ExceptionInfo *exception; cstr = (*env)->GetStringUTFChars(env, target, 0); exception=AcquireExceptionInfo(); #if MagickLibVersion < 0x700 result = QueryColorDatabase(cstr, &pixel, exception); #else result = QueryColorCompliance(cstr, AllCompliance, &pixel, exception); #endif (*env)->ReleaseStringUTFChars(env, target, cstr); if (!result) { throwMagickApiException(env, "Unable to locate color", exception); DestroyExceptionInfo(exception); return NULL; } DestroyExceptionInfo(exception); consMethodID = (*env)->GetMethodID(env, class, "", "(IIII)V"); if (consMethodID == 0) { throwMagickException(env, "Unable to construct magick.PixelPacket"); return NULL; } #ifdef DIAGNOSTIC fprintf(stderr, "Query colour %d, %d, %d, %d\n", pixel.red, pixel.green, pixel.blue, # if MagickLibVersion < 0x700 pixel.opacity); # else pixel.alpha); # endif #endif jPixelPacket = (*env)->NewObject(env, class, consMethodID, (jint) pixel.red, (jint) pixel.green, (jint) pixel.blue, #if MagickLibVersion < 0x700 (jint) pixel.opacity); #else (jint) pixel.alpha); #endif if (jPixelPacket == NULL) { throwMagickException(env, "Unable to construct magick.PixelPacket"); return NULL; } return jPixelPacket; } /* * Class: magick_PixelPacket * Method: getColor * Signature: (Ljava/lang/String;)Lmagick/PixelPacket; */ JNIEXPORT jobject JNICALL Java_magick_PixelPacket_getColor (JNIEnv *env, jclass class, jstring target) { #if MagickLibVersion < 0x700 PixelPacket pixel; #else PixelInfo pixel; #endif const char *cstr; jmethodID consMethodID; jobject jPixelPacket; cstr = (*env)->GetStringUTFChars(env, target, 0); PixelWand *pixelWand = NewPixelWand(); if (!pixelWand) { throwMagickException(env, "Failed to allocate PixelWand structure"); (*env)->ReleaseStringUTFChars(env, target, cstr); return NULL; } if (!PixelSetColor(pixelWand, cstr)) { throwMagickException(env, "Unrecognized color string"); (*env)->ReleaseStringUTFChars(env, target, cstr); return NULL; } (*env)->ReleaseStringUTFChars(env, target, cstr); #if MagickLibVersion < 0x700 PixelGetQuantumColor(pixelWand, &pixel); #else PixelGetQuantumPacket(pixelWand, &pixel); #endif consMethodID = (*env)->GetMethodID(env, class, "", "(IIII)V"); if (consMethodID == 0) { throwMagickException(env, "Unable to construct magick.PixelPacket"); return NULL; } #ifdef DIAGNOSTIC fprintf(stderr, "Colour %d, %d, %d, %d\n", pixel.red, pixel.green, pixel.blue, # if MagickLibVersion < 0x700 pixel.opacity); # else pixel.alpha); # endif #endif jPixelPacket = (*env)->NewObject(env, class, consMethodID, (jint) pixel.red, (jint) pixel.green, (jint) pixel.blue, #if MagickLibVersion < 0x700 (jint) pixel.opacity); #else (jint) pixel.alpha); #endif if (jPixelPacket == NULL) { throwMagickException(env, "Unable to construct magick.PixelPacket"); return NULL; } return jPixelPacket; } techblue-jmagick-b4412af/src/magick/magick_QuantizeInfo.c000066400000000000000000000101641452765401600234460ustar00rootroot00000000000000#include #include #include #include #include #if defined (IMAGEMAGICK_HEADER_STYLE_7) # include #else # include #endif #include "jmagick.h" #include "magick_ImageInfo.h" /* * Class: magick_QuantizeInfo * Method: init * Signature: ()V */ JNIEXPORT void JNICALL Java_magick_QuantizeInfo_init (JNIEnv *env, jobject self) { QuantizeInfo *quantizeInfo = NULL; jfieldID fid = 0; quantizeInfo = (QuantizeInfo*) getHandle(env, self, "quantizeInfoHandle", &fid); if (quantizeInfo == NULL) { #if MagickLibVersion < 0x700 quantizeInfo = (QuantizeInfo *) AcquireMemory(sizeof(QuantizeInfo)); #else AcquireMemoryHandler acquire_memory_handler; ResizeMemoryHandler resize_memory_handler; DestroyMemoryHandler destroy_memory_handler; GetMagickMemoryMethods(&acquire_memory_handler, &resize_memory_handler, &destroy_memory_handler); quantizeInfo = (QuantizeInfo *) acquire_memory_handler(sizeof(QuantizeInfo)); #endif if (quantizeInfo == NULL) { throwMagickException(env, "Unable to allow memory for handle"); return; } } GetQuantizeInfo(quantizeInfo); setHandle(env, self, "quantizeInfoHandle", (void*) quantizeInfo, &fid); } /* * Class: magick_QuantizeInfo * Method: destroyQuantizeInfo * Signature: ()V */ JNIEXPORT void JNICALL Java_magick_QuantizeInfo_destroyQuantizeInfo (JNIEnv *env, jobject self) { QuantizeInfo *quantizeInfo = NULL; jfieldID handleFid = 0; quantizeInfo = (QuantizeInfo*) getHandle(env, self, "quantizeInfoHandle", &handleFid); if (quantizeInfo != NULL) { setHandle(env, self, "quantizeInfoHandle", NULL, &handleFid); DestroyQuantizeInfo(quantizeInfo); } } /* * Class: magick_QuantizeInfo * Method: setNumberColors * Signature: (I)V */ setIntMethod(Java_magick_QuantizeInfo_setNumberColors, number_colors, "quantizeInfoHandle", QuantizeInfo) /* * Class: magick_QuantizeInfo * Method: getNumberColors * Signature: ()I */ getIntMethod(Java_magick_QuantizeInfo_getNumberColors, number_colors, "quantizeInfoHandle", QuantizeInfo) /* * Class: magick_QuantizeInfo * Method: setTreeDepth * Signature: (I)V */ setIntMethod(Java_magick_QuantizeInfo_setTreeDepth, tree_depth, "quantizeInfoHandle", QuantizeInfo) /* * Class: magick_QuantizeInfo * Method: getTreeDepth * Signature: ()I */ getIntMethod(Java_magick_QuantizeInfo_getTreeDepth, tree_depth, "quantizeInfoHandle", QuantizeInfo) /* * Class: magick_QuantizeInfo * Method: setDither * Signature: (I)V */ #if MagickLibVersion < 0x700 setIntMethod(Java_magick_QuantizeInfo_setDither, dither, "quantizeInfoHandle", QuantizeInfo) #else setDeprecatedMethod(Java_magick_QuantizeInfo_setDither, dither, "quantizeInfoHandle", QuantizeInfo, jint) #endif /* * Class: magick_QuantizeInfo * Method: getDither * Signature: ()I */ #if MagickLibVersion < 0x700 getIntMethod(Java_magick_QuantizeInfo_getDither, dither, "quantizeInfoHandle", QuantizeInfo) #else getDeprecatedMethod(Java_magick_QuantizeInfo_getDither, dither, "quantizeInfoHandle", QuantizeInfo, jint) #endif /* * Class: magick_QuantizeInfo * Method: setColorspace * Signature: (I)V */ setIntMethod(Java_magick_QuantizeInfo_setColorspace, colorspace, "quantizeInfoHandle", QuantizeInfo) /* * Class: magick_QuantizeInfo * Method: getColorspace * Signature: ()I */ getIntMethod(Java_magick_QuantizeInfo_getColorspace, colorspace, "quantizeInfoHandle", QuantizeInfo) /* * Class: magick_QuantizeInfo * Method: setMeasureError * Signature: (I)V */ setIntMethod(Java_magick_QuantizeInfo_setMeasureError, measure_error, "quantizeInfoHandle", QuantizeInfo) /* * Class: magick_QuantizeInfo * Method: getMeasureError * Signature: ()I */ getIntMethod(Java_magick_QuantizeInfo_getMeasureError, measure_error, "quantizeInfoHandle", QuantizeInfo) techblue-jmagick-b4412af/src/magick/util/000077500000000000000000000000001452765401600203265ustar00rootroot00000000000000techblue-jmagick-b4412af/src/magick/util/DisplayIPTCData.java000066400000000000000000000044001452765401600240460ustar00rootroot00000000000000package magick.util; import java.io.UnsupportedEncodingException; class DisplayIPTCData { public static final int TITLE_ID = 0x0205; public static final int KEYWORDS_ID = 0x0219; public static final int CREATOR_ID = 0x0250; public static final int CREATOR_JOB_TITLE_ID = 0x0255; public static final int HEADLINE_ID = 0x0269; public static final int DESCRIPTION_WRITE_ID = 0x027a; /** * Translates IPTC id to name. * * @param id IPTC id to translate * * @return IPTC name associated with given id
* null if id unrecognized */ public static String idToName( int id ) { switch ( id ) { case TITLE_ID: return "Title"; case KEYWORDS_ID: return "Keywords"; case CREATOR_ID: return "Creator"; case CREATOR_JOB_TITLE_ID: return "Creator's Job Title"; case HEADLINE_ID: return "Headline"; case DESCRIPTION_WRITE_ID: return "Description Writer"; default: return null; } } /** * Parses IPTC metadata. * I wrote a simple method to parse the data available from MagickImage.getIptcProfile() * @author Terence Bandoian * @param data IPTC metadata */ public void parse( byte[] data ) { int index; int length; int id; String name; String value; int valueLength; index = 0; length = data.length; while ( index < length ) { if (( length - index >= 1 ) && ( data[ index ] == 0x1c )) { index++; } else { break; } if ( length - index >= 2 ) { id = (int)data[ index++ ] * 256 + data[ index++ ]; } else { break; } name = idToName( id ); if ( length - index >= 2 ) { valueLength = (int)data[ index++ ] * 256 + data[ index++ ]; } else { break; } if ( length - index >= valueLength ) { try { value = new String( data, index, valueLength, "UTF-8" ); } catch ( UnsupportedEncodingException uee ) { value = "Always supported."; } index += valueLength; } else { break; } } } } techblue-jmagick-b4412af/src/magick/util/DisplayImageMetaData.java000066400000000000000000000160101452765401600251400ustar00rootroot00000000000000package magick.util; import java.lang.reflect.*; import magick.*; /** * A generic solution that can display information about a * MagickImage or ImageInfo object by using reflection. * It look at the xxxType-classes (ColorspaceType, GeometryFlags) and replaces * the numbers with the variable names given there. * License: You decide, I give it to the public domain. Use if for whatever you want. * @author Jacob Nordfalk */ public class DisplayImageMetaData { /** * Searches through class's public static final int fields * until it finds a field with a specific value. * Examples:

     * nameOfpublicstaticintField(ColorspaceType.class, 0) returns "UndefinedColorspace"
     * nameOfpublicstaticintField(ColorspaceType.class, 1) returns "RGBColorspace"
     * nameOfpublicstaticintField(ColorspaceType.class, 2) returns "GRAYColorspace"
     *
     * nameOfpublicstaticintField(GeometryFlags.class, 0) returns "NoValue"
     * nameOfpublicstaticintField(GeometryFlags.class, 1) returns "PsiValue"
     *
     * Given that these classes are declared as:

     public abstract interface ColorspaceType {
      public static final int UndefinedColorspace = 0;
      public static final int RGBColorspace = 1;
      public static final int GRAYColorspace = 2;
      ...

     and

     public abstract interface GeometryFlags {
      public static final int NoValue = 0;
      public static final int PsiValue = 1;
      public static final int XValue = 1;
      public static final int XiValue = 2;
     
* @param clazz Class to search in * @param value int value to search for * @return name of fiels */ public static String nameOfpublicstaticintField(Class clazz, int value) { Field[] f = clazz.getFields(); for (int i = 0; i < f.length; i++) { try { //System.out.println(""+f[i].toString()); if (f[i].getType() == Integer.TYPE && f[i].getInt(null) == value) { return f[i].getName(); } } catch (Exception ex) { ex.printStackTrace(); } } return value + "(unknown)"; } /** * As nameOfpublicstaticintField, but returns also the value (convenience method) * nameAndValueOfpublicstaticintField(ColorspaceType.class, 1) returns "1 (RGBColorspace)" * @param clazz Class to search in * @param value int value to search for * @return name of fiels */ private static String nameAndValueOfpublicstaticintField(Class clazz, int value) { return value + "(" + nameOfpublicstaticintField(clazz, value) + ")"; } /** * Returns the name of a public static final int field in class colorspaceType. * Example: colorspaceTypeAsString(3) returns "TransparentColorspace" * @param value field value * @return field name */ public static String colorspaceTypeAsString(int value) { return nameAndValueOfpublicstaticintField(magick.ColorspaceType.class, value); } public static String classTypeAsString(int value) { return nameAndValueOfpublicstaticintField(magick.ClassType.class, value); } public static String compositeOperatorAsString(int value) { return nameAndValueOfpublicstaticintField(magick.CompositeOperator.class, value); } public static String compressionTypeAsString(int value) { return nameAndValueOfpublicstaticintField(magick.CompressionType.class, value); } public static String decorationTypeAsString(int value) { return nameAndValueOfpublicstaticintField(magick.DecorationType.class, value); } public static String drawInfoAsString(int value) { return nameAndValueOfpublicstaticintField(magick.DrawInfo.class, value); } public static String exceptionTypeAsString(int value) { return nameAndValueOfpublicstaticintField(magick.ExceptionType.class, value); } public static String filterTypeAsString(int value) { return nameAndValueOfpublicstaticintField(magick.FilterType.class, value); } public static String geometryFlagsAsString(int value) { return nameAndValueOfpublicstaticintField(magick.GeometryFlags.class, value); } public static String gravityTypeAsString(int value) { return nameAndValueOfpublicstaticintField(magick.GravityType.class, value); } public static String imageTypeAsString(int value) { return nameAndValueOfpublicstaticintField(magick.ImageType.class, value); } public static String interlaceTypeAsString(int value) { return nameAndValueOfpublicstaticintField(magick.InterlaceType.class, value); } public static String noiseTypeAsString(int value) { return nameAndValueOfpublicstaticintField(magick.NoiseType.class, value); } public static String previewTypeAsString(int value) { return nameAndValueOfpublicstaticintField(magick.PreviewType.class, value); } public static String primitiveTypeAsString(int value) { return nameAndValueOfpublicstaticintField(magick.PrimitiveType.class, value); } public static void displayImageInfo(ImageInfo info) { try { //info.setVerbose(1); System.out.println("Info PreviewType is " + previewTypeAsString(info.getPreviewType())); System.out.println("Info Monochrome is " + info.getMonochrome()); System.out.println("Info Colorspace is " + colorspaceTypeAsString(info.getColorspace())); System.out.println("Info Resolution units is " + info.getUnits()); System.out.println("Info Compression is " + compressionTypeAsString(info.getCompression())); System.out.println("Info Density is " + info.getDensity()); System.out.println("Info magick is " + info.getMagick()); System.out.println("Info filename is " + info.getFileName()); } catch (Exception ex) { ex.printStackTrace(); } } public static void displayMagickImage(MagickImage image) { try { System.out.println("ImageName is " + image.getFileName()); System.out.println("ImageFormat is " + image.getImageFormat()); System.out.println("Imagetype is " + imageTypeAsString(image.getImageType())); System.out.println("Compression is " + compressionTypeAsString(image.getCompression())); System.out.println("Colorspace is " + colorspaceTypeAsString(image.getColorspace())); System.out.println("Resolution units is " + image.getUnits()); System.out.println("Depth is " + image.getDepth()); System.out.println("X resolution is " + image.getXResolution()); System.out.println("Y resolution is " + image.getYResolution()); System.out.println("Size blob is " + image.sizeBlob()); System.out.println("Colors " + image.getColors()); System.out.println("Total colors " + image.getTotalColors()); } catch (Exception ex) { ex.printStackTrace(); } } } techblue-jmagick-b4412af/src/magick/util/MagickCanvas.java000066400000000000000000000037141452765401600235250ustar00rootroot00000000000000package magick.util; import java.awt.Canvas; import java.awt.Image; import java.awt.Graphics; import java.awt.image.ImageObserver; import java.awt.Dimension; import magick.MagickImage; import magick.MagickProducer; /** * This class a specialisation of Canvas to display * MagickImage in AWT. * * @author Eric Yeo */ public class MagickCanvas extends Canvas { /** * The AWT version of the image. */ private Image image; /** * Width of the image. */ private int width; /** * Height of the image. */ private int height; /** * Implements the image observer to wait for the * image to be completely loaded. */ private class ImageNotification implements ImageObserver { /** * This method is called when the image is completely loaded. */ public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) { width = w; height = h; setSize(w, h); repaint(); return false; } } /** * Set the viewing image. * * @param magickImage the MagickImage to view */ public void setImage(MagickImage magickImage) { image = createImage(new MagickProducer(magickImage)); ImageNotification notify = new ImageNotification(); width = image.getWidth(notify); height = image.getHeight(notify); if (width > 0 && height > 0) { setSize(width, height); repaint(); } } /** * Method to draw the image onto the Canvas. * * @param g the Graphics object for drawing */ public void paint(Graphics g) { if (image != null) { g.drawImage(image, 0, 0, this); } else { super.paint(g); } } /** * Return the preferred size of the Canvas. */ public Dimension getPreferredSize() { return new Dimension(width, height); } /** * Constructor. */ public MagickCanvas() { image = null; width = 0; height = 0; } } techblue-jmagick-b4412af/src/magick/util/MagickViewer.java000066400000000000000000000012671452765401600235540ustar00rootroot00000000000000package magick.util; import java.awt.ScrollPane; import magick.MagickImage; /** * A display pane that provides a scrollable view port * for a MagickImage. * * @author Eric Yeo */ public class MagickViewer extends ScrollPane { /** * This is the component that actually displays the * MagickImage. */ MagickCanvas canvas; /** * Constructor. */ public MagickViewer() { super(SCROLLBARS_AS_NEEDED); canvas = new MagickCanvas(); add(canvas); } /** * Sets the display image. * * @param image the MagickImage to display. */ public void setImage(MagickImage image) { canvas.setImage(image); } }; techblue-jmagick-b4412af/src/magick/util/MagickWindow.java000066400000000000000000000023761452765401600235640ustar00rootroot00000000000000package magick.util; import java.awt.Dimension; import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import magick.MagickImage; /** * This class implements a window that displays a MagickImage. * * @author Eric Yeo */ public class MagickWindow extends Frame { /** * A listener that exits the application when we receive * the window closing event. */ private final class MyListener extends WindowAdapter { /** * This method is called when the window closes. */ public void windowClosing(WindowEvent event) { System.exit(0); } } /** * We want the window size to be this big. */ public Dimension getPreferredSize() { return new Dimension(250, 200); } /** * We want the window size to be at this minimum. */ public Dimension getMinimumSize() { return new Dimension(300, 200); } /** * Constructor. * * @param image the image to display in the window */ public MagickWindow(MagickImage image) { setResizable(true); addWindowListener(new MyListener()); MagickViewer imageViewer = new MagickViewer(); add(imageViewer, "Center"); setTitle("Magick Window"); pack(); imageViewer.setImage(image); } } techblue-jmagick-b4412af/src/magick/util/Makefile000066400000000000000000000002601452765401600217640ustar00rootroot00000000000000include ../../../Make.def JAVA_SRC_FILES = \ DisplayImageMetaData.java \ MagickCanvas.java \ MagickViewer.java \ MagickWindow.java include ../../../Make.rules techblue-jmagick-b4412af/test/000077500000000000000000000000001452765401600163065ustar00rootroot00000000000000techblue-jmagick-b4412af/test/correct_output/000077500000000000000000000000001452765401600213675ustar00rootroot00000000000000techblue-jmagick-b4412af/test/correct_output/average.jpg000066400000000000000000000106641452765401600235120ustar00rootroot00000000000000JFIFHHYCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222"7!1"AQaq2#BRCb3r!!1"A# ?cƈ B[=^潴ȴ J⢏WF}GgO`4ӈ4G-k2PҗE6ns[$ڙcE(ΠK1cڠgIYIXDsH?Dۢ@yzH Q1)LR1Luz*%(@!)T:ϸ] Jwf9biT]ޚO8Z1^$e\SiLY] h]4i =M DY"Nh;9dObhex:ȢV${ų6t b#9DQdhRђgOg96L}q{)Z&_/?6H#zn1[ƷT٭b2=b(o=b4N\}0AUD3 t:5bNޕ t&3G&:8DF> < g ,@4:6/g7V,ĒG'5s-oYS2R"J\1ZUhZUK"W a\c9Vڧ|7Օ&l10 L\ퟨ6 ]w[{bHc<`1QJ>!YB wh+g_~<i|7\R*7!<|J݆<4GY]6i5+@Pr;}s[fup92|?*Υ.5tG5DC% fK)Ws8;Q+K15/)R-^ɒWڅy wA>-}n6l܍jcJوiST0{y]$cRdz+/#GG2nu  㺖P:X6?M:mY:Nھc=NQ.=6ofC7s: to˨>utNec43E_6=3pB9v.kS6[ߤI UU 6b|6:͏΢@$ls&F ;N7BCmK˓)S; ihw@7xxsR[.*q %%e')nަU\8mcO8 #G[][Ie2E R1 EtҤ3k`A-Q:d2#jrv.uæ`SV]QeA/rx~u]ZU o~7ɐe2Fz4iU:HGMI hHmcYRsn]cJ QOO&<8|Kv_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MO>3k6Go 8|<"K5^0nX_aZ5ee[ƭjiZ<+Q>it5W'ٜe[ 5\K$kzJr%ѥNä́ *'oVUPzWo&iDPPdLz]}w^Lz]}wAjG~8U/`/90῞1[W_B *o^?^՟M;  K K-^C7g>&7+|(Z῞1[W_B\kټ}@AA3vqþ{A3vqþfSVgC4xo]E P7+|(Zyx?{7V}4((2&z.>w߻h&z.>w߻y # u{ƗOj+33[ч9vhg+C𶳺X]**zQEQ4Tob%= %E=MCaGr9"7]lQ7hҾ A]riiww[PfZ,^H3K._C .}1;^X>fx\uA]rcsj=wKSjx} .}44;?l{7yb A]riiwwYͨ~oY-OժA4; P޳ZUiwwY/f76cgt?V H3K._CnmCǾ3zj~W//ffx\uڇ|fZ,^H3K._C .}1;^X 8~H3K._Cډ-وZ~%f5,m+Dny2siԷ^lxԣ·j(ƭj*mbƷr*ys-vD51D~{OZ:ZǦjŪWES5LS M͕vWڣȯTG|PX~ޘj~׷wX~n' YVnQfg{nb9{߯Lfؽbjѹ=th^Ե/EvF7))XQ4q33OfUb'*8cϨn}g[Q!6.F5H21/Oχ"fRػ+znִ{۽f߹Gnh?<||2k]czƽU3:q3/fWr4UwS~檙8RWtechblue-jmagick-b4412af/test/correct_output/blob.gif000066400000000000000000000467651452765401600230160ustar00rootroot00000000000000GIF89a          $/(%4( % &##,,'44;7+"##)$3",!="4##,(%(6*(83)#$3#$;,+<()74,7759,28!F98J7,N"UG8PG2hR7q]6D#B$J)I%S!&E$*D#*L)*H4.D,2J87G&-S',W*2U+2[(3X68V3/V-5c-6i2:k58f4=s7=y)0l" JE;GE=VR>MDvXQJ/[U~m5{[ӭ=58v~'`H{bI%6J=rs9֘ceuRm&}יgƊi,d{GrF<ʶ0YG ր>.$ LzքYb@=b@ "Ibv%Z%)xb}f+J\;)蠂"yK&=Coņ#HǒaLa Eݘ!d%Bnz&h`JvҘ= /Fy+ L0h=3/Q蒮 qbjSNzNaRVXuJ{lkGʟ"`ȬIwP**)b#RV*`<'V (n8r.r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:t'Hze g pDNl!Wxvݭ{de; - uּ\)!wu0Xӭs`Gy9<<;So6-34{,XWxT?"G<h=_`FRPfKǵ]w MR6b%wA~ͱrl0;8sTJjwAn l@UB+h&qf}ϸ\,/R`r`$Epo,#*{/j@f &]8|FJ*6$3D B@2PO$00 po6`@ 6@Pz帐PHP -接f B^j B L\jMd Cۼ-20 1WNqƢJ ̌@^ M1 ? [QQ eѰo  Ԁ %  Ԁ " w f@L|@+~(qиPk8 RL`\ƫ. " NQoc0q>@ m 3TP !;2 8 | ;techblue-jmagick-b4412af/test/correct_output/blob.jpg000066400000000000000000000107011452765401600230060ustar00rootroot00000000000000JFIFHHYCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222"=!1"AQaq#2B%3CrSs'!"1QAaq2 ?"Dux%)Q":qm(?Nl ](D@lJTJijhYJ$@ +UjZ@ P+D2dR9ZaU0hh֌aT8@^iVZzڦ"D~!t*Tt@O`n.t:6t{Q;)QP)ڛX{DYZD[k+ 7N`SXK{4 sgʅ)F6oÌlaUS%csM)P+E2h@j$injZ$FG#vi]YjK-ThZ@̵S©aYVZUc UNڤ#ah]r6TiFj[(4 ARW!Y2AA9Z@*%(ERP1Jc'0eW5\޻#Gup!1POӚ]w6LdesOA& HhKFf{W8ZqTti5e2|dnq3|!9x I t'0#>Z0mQĒuR6qdqx_G VLCA`1϶ys-ıu`DvOaڻi3Had^հ80玜u:b}6ymf(bdQDț3ˑ.qXgi,Ѥ*rSn1I|wDЪ+Hf<ޕWԥ`ƥ.LFQK%%ǐ]ITUrcJXr9UX$ Q?H>Lpseҥ8*A>kFq$JB<DŽ&umZʰ,CXl[ob3\a eR6_\* e68Ue0?[5O{Rt.%K aL@Ǯ@ɫ!%:aˌ?TD  )lk}.m10n}N@[+qp*@|A3V,y5h2HKϐ iix77j<U30U t?.%\Ƕ5$G*MHͲUR̊KqNKHY`.;*Z҃FXDd@p*UYO)gv/?4Oe;;w*٢ n1Q8(r{-p.YI!8'nҫjOM1>Ϋ2#UL(Z5#r1=8b|eq<6њܴmkTn-X,j8 x5c#VZhKר6?T5uguT!*D&zǮ9Z5f Іzaqȩ͉epH7sJ?)dkN>{H\0X_#f[u4}~°h(+1l?[&4FFbvQ!w,3\B̷{&<nmщ+@1BvfٰI Wb)In7FKQRM?| WS_&9CIPnR2γʐp{U%й J-u&04zofBH *&K7QU=qNrv?Ě,}Hd{z2ޡKX |֕WJaH|CKKx2Nn?UEDPH\x&9qzP\ёzX%[cpf"T!J6ҥ]8[*T[>J0yҥ@ ya߬#l 1ԐH T}V:uPL@4Vxs6KqJ bJ!n4RjTU=|\E#iRc6{W-sԉ*ǩu/9ҕ*2*7Ơq4R?techblue-jmagick-b4412af/test/correct_output/border.jpg000066400000000000000000000127651452765401600233610ustar00rootroot00000000000000JFIFHHProcessed by JMagick$ICC_PROFILEC    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222"E !1A"Qaq2SBdr#CRbc%35$4D0Q!ASq"13a24rR ?!\ǂ!@!@!@!@!@!@)y&ɴ~n-"=7&Gi++_+N5&ԗb0B<Uv#Jn=ZR%1G1W5]ȗnO9jR%1}\/x>F^Es/UxY$wyPp)y3?W%%9(S(x~<\9{`(T:ߵRMiVjmM{/{M%߹Xr=V$MoH0ۏMpM&lp!Y 0-˱voQdBb` /VUm0`~b_.h>"K)";pJHֱDRr[KK"6J^E̝]J,\,H  i3Y`l))dKh, }Qլsl:q iN ԔXx -}lXu{*c{ʯʜ9;k\ \\&ҤRM] 0Mɗ[pRReJ69B+L?E=FԌyRr6Uk/N)#I@>ehfinzf9y╂9*"6(Y'm_8Rk㕯Fjn :AQ}VWF: t6z.u&4\_fbDC3`ݛ9,i8,;xN,؅}Ղ-n`'3lBU9,-yNsÜν]3%U> U[v5SF^s_OmlBZ 6V5kkg3Ѳi my^qFݜPS&̈;Ƥt#M<^P^Y89:^7&ں09G  K'&'U.^4kp X!ZZdQ\`O5d1#c^-!_7-wA OsAhsj-Q)]-U _P`|qd~ieHy&)i 7G^Ō^^Ė&؍-DzWI1HܧMܫUV/t ֨ RI@J561[K.*7[~ST8bU 7ةދۏRwӊչS;) uɸ@kPNMؼ)$.H)B2qB׬2?ͧ_-6˷@jpGuo1oZAId&RXd䈻mKFPܜޤMKǩJ /(+$_q5pq@ |1 _a70ɐ):fN. Qa{vLfxo(ħW IYnnЄ.`AefebS\w+ۿm -p4knW`ՒdEp 3cn[_nB_cu㖦`ƴR谩1BdzPtNkϖُ.*ZjZ?[)qq7Vxaܙ?X5mϱV`eRR,faEfkۊwA$LtmX_;M X mr2X]!$wꬺIkD ܠJ+}t8;z$M ܖ|e X:h;FWBVˇC+1ǡ\k1+Zy2Iw[ضP5ص׍K ^oԞ~hOE?5婣̨ԨvmڭxIG旛Qs*X<*vvnn^#G7Rz/Qs*X<*6v~n^#G7Rz/Qs*X<+i$S[ B876i L6ps-;\k$u/Sd-Idž*9J2X:+RkͯjOE?5m>#Opyj'2Rj"OC?4se'^oG̩`ԤvgЫl>#G6Qpyj/2R?jj?C?5k>#Iͨ9Z9ևT^Gh9Z5q.0@f=I<$'ep릊\Io;gHs:8<2L_!LO 77-#E0#u~E mkG5*/QzQ]Z,C B B B B B B Btechblue-jmagick-b4412af/test/correct_output/chopped.jpg000066400000000000000000000007631452765401600235210ustar00rootroot00000000000000JFIFHHYCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!222222222222222222222222222222222222222222222222220"#!1"3Qq!1 ?y zQr|Xi`kE>#sJCT+ARVuX[Ejdrtg%='jNA~7cj'(Igtechblue-jmagick-b4412af/test/correct_output/clone.jpg000066400000000000000000000106661452765401600232020ustar00rootroot00000000000000JFIFHHYCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0 C    $.' ",#(7),01444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Juc[Z[4Jg?#o4TB.io4Rۍ6J qJu[YM%nxDR>*1ڹkvpԉ*ǩu/9ҕ*2e N8} *T2techblue-jmagick-b4412af/test/correct_output/convolved.jpg000066400000000000000000000067451452765401600241040ustar00rootroot00000000000000JFIFHHYCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222"3!1a"AQq2B#3RSb&!"1QAaq ?*@w$W:*2Ojwp+n9k5F񄔍+8VV0$aX)F2Ȉ@dl&Zeu08b2eG #P_pt*G {v"Wns @ݿ!P)sXO$ica`:لIH,hvq SP`> h6yr$˧~ʔhaXQH]{M+ 7cJ62vP;,ڰ?eبD"a2YdL  "uVX<3¿1¿.E[rnܕ5 n&PXq%䌬?`8@#JBJ%)b9{iHi&q*Ge8˟d0^Soܺm9X$jJUjp?@jՌ#6{:*w'0`3l-j Lε]W/js,2~)$bp.?pGHv/FsږHPu6?Y1-p8(D$u(%'*uUZ S4̳= h{MC+kEAg*8ۓ9i*e(g]ǟ5f_eZp+-a(P)_ԍYDE2ԅŸr fS"3OWwȲm[7A}IrzgZUbm {v7S[rSq%g[GR ì+?c<"6"j0lǾ@%js"B]͝1),O$~}#Kd[OaV74Þ:ӓ+oZYƴ^LKO8ډh5Z'gMCʷ^!3l8ԟ%0-6?xAEqݎ@e6V%N$1$A\`7غ(v)Bzv&Բ'*A @[ZZzĪyxZ }'F,߳'&aByxZu>O+NLSsMN̐;Bs'.Lmԩ-Z{̵î#Mԟ}O?/鬚jȩO~ΔE6C}O2\IQE{u{0^tj.ŦfM70GK*UgM>c(#+Q]vԮkDu\a. Ŷ@|?:}j;I8"Dғ#]׿,qްj#fun*ᙼlо[UX`뙹-*2\e$y i"K =!1O9?& ט`` %ۛؗlt'~^DxXF Cβ\$<;gE} }&g%2V󹢣W5ћ~Zj*y~t*2ijeo٣Wxb=)]׳E)n{? qf  5=KQZ50N=~GgA$0?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8} *T2techblue-jmagick-b4412af/test/correct_output/cropped.jpg000066400000000000000000000073751452765401600235410ustar00rootroot00000000000000JFIFHHYCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222r"9!1AQa"q2#BrR%3Cb#!1Aa"Q2 ?vgʤ+EيZcpRSڥlE3Rh&4TnAq<Y;3Y[nSgQeh؆+#8ɮ}FJ*(_ĉ]$j,/`Ce:.5CvI™ssV3ڶ+&^ PƒP5;ӊr+,hqڌ\/VGҚЋTkmv(Uz෻1hc/gz>ZQ鲸d`VŸmqO dj}%(Fn4†VЊLDr)QJGF9KolVh!yǟs\rKmWPw+ }A~Fj@JS ќR@Ip3PFb)|gh:̤r3yY`Ty~6IX40a^7 0!>~ի&}' 1GA yY9RVXJJ>l%_ o7E9?5vtvn`w a_%E FFSES_GԞJa JKո{ZN-;MevU?)MQx@Ո{[SIquchd` G+d|0:p%Q!\TS+Kbrېs2*$tҭExsE%酸"6B5A'1a#o}+'SRdd][hS)*gcGajHGE呜s^oEH 1(P08՞[H5q#ɿq#!?*Z'iz{Bp`G1+io=$[ӯV;T ߷qVtibKA4M#a¾[9ëϾIucQatm/#2X Āí-5X&ze\m' hF诟WihC6 |AΘvvM{ɴSo&ns6ҥ`򩻙AivMg/' !QfZO[f5;T/z,}Ѹiɣ(.*UaB[3HJֆ[q'O+gr@0HѴKX<7&㊚cnT`"P~s\+-Nߗڐ,{k z3EP*||ķsMeg_Z##֖sFd•3g r|M$ʲUlg piU4&Y[ȂI Z,ͷS{:I9+(u E֏sp?6NɐpN0}5ƻ֌5:muK˸OcЖ( A)6QVOS7VZ"6sS'QKh…\zcu RH-DӚ1l_U&7"m<"Mw 9Қ7O3jR@~)ݩ?Z6.yڿL}ßΛ /Mr=d+C)'V_L [#/cnLeЁ޸KMSW7,Y>TPWHQHl@M܋3$K3[TgHB223+Gm hC{54M`NkD'՘Uo&PsQnl0 OJI{yRt)Shuu꿭K^#9h.(׮uWޗWގFLwYcuS6F9sZ K5׭?a'O*>џ_ԮP_sHZAP욲s˝LZR"SJƛA;cO($D{ Y[u"$U5֔sڣ=EDP~5w~ 60@2bM*UBiRJ#[M>"DRQ?T=>pҥM *TS9\4R\4RSiRc$fP6CJ*?techblue-jmagick-b4412af/test/correct_output/despeckled.jpg000066400000000000000000000100231452765401600241700ustar00rootroot00000000000000JFIFHHYCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222":!1"AQaq#2BCRr%b&!"1QAaq ?v ^a'#W ` ӏӄ8p]8 5Ț9OhIInOh!d JpbbY[,@ R+"!BJIhhb a(q3e؂)cS-J=j۴HW:vp\~{tWN7N ~ѹ=>m6H^*j |Tm)pz  v񸍖5H 5kޞc ^-­6gd31FtwVmR Wr6;zwOST1&seT *e!Q 5pwg)Еe^ % ++d0V)@RaOCIl+Z)8/S]iLW+;>&z3_ ZX֎f.@m{ COW%-U^ z|>sYBVu}%#q*l^){fi r u\;TqMA56cІ=oM Tjmq :tUщ"D/>#YW}jU,koƜ5&mSHzL9,N}7 Uul^\2razZ~3[j%RNJĜcRE! ST7rv?ϫRͰR&!Q7BuVֵsp6n\j=},r|L=~:9ryb=CkV]O.jPb7r9P du𠯖C{n} 5SVUt` L(nO n8e ?jRܿ[NA~ӧnٓYBFzj:=aT A?[54X(v\6 n{p8g$(6{Սũ'MZ;<_詫 3R<< ;n/x^m:}^O W}ѨMAo k4<60U泑J_|\lvpnAǰ'm% *2iuOxUw~$J-%#7 ;@iԥB[tR1WyF2=0TxݝO}jV6%Bo0S})A3TTWq5O{q^f(P<2~$ӣ}sYKaq^O@NA5|WYB >QM[Z 7?b-V3r}+z@gX1F>G ,cUµJhT1o(,o 1E,LꙖ-pl)̴V|* S[a {YaEQ$N|;}fZ %2u:^O (VVf4)$M8B&i˓iim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dx_bRH6ͅCZ4΂846@[KdʼnmC4Qd?`]`̭f٬J:(Rd "*މ[G^!M5H}F7^kVʜaK3.-**8F(RN[et}Hz"|;7&[s[uU_fuOJԉڰ]u&K QN fuIk\+o(O\<[A|aqbgxkLȥ{z;]^X[z;]^X7Cu兰@Cuz;]^X[z;]^X7Cu兰@Cuz;]^X[z;]^X7Cu兰@Cuz;]^X[z;]^X7Cu兰@ aMaZvD1}өąm{ERî,!: [!:Rî,-ERî,!: [!:Rî,-ERî,!: [!:Rî,-ERî,!: [!:Rî,-               ?techblue-jmagick-b4412af/test/correct_output/montage_w_text.jpg000066400000000000000000000270721452765401600251250ustar00rootroot00000000000000JFIFHHC       C "  d  !1A"Q 2Taq#5D4BFV$%37ERbdv&8GUWrCceftuw<!1AQс"BSq2Ra#%34C ?)JJRR()JC5|6V"@͈,8JJRRVRshq q%@.Rt\n$\:!LGN2AH "=]^~\6߈R7k=|fcE3l T t kmSto-ÆZV]X&S2Pge'RIƭ{\"E$ib2رںڢqmpX^e4іa,b6M-,C p*Imejo!L9I"?qvPuC˼|ggݟlP^zӝQi9{/Wwta9ovL$:]&.2ʜ.)'&>]}XjCX#ˆ/! C%ZsuN6+3Oj/MÆ+XYD[%ڐTq$Fg</X뮠7ޕK9ԫKy7ږGL ݀A=+ڃIiMXmTMٮ ݭ E9RYޓټpCiշc,;\z\ RJ:gƀխ;mZC,i;aeՋt6Gsl3}OĔZfFAN-X MFlY#\q:–mh^PWkQ -(uPGL|"MpvM;mTmWk{nW8&<ۭ48ή% g(v!=ez6j^}nSҥhN;DRI eod_ N7D@LxhyKJ1!xCkq+*HQc$[tn֚y#tbK˜Dt6LmRФ ޸CmHF~;Le^df: #%h% J7h$'ҩjdFP՘w+쥸/{WBB H I7o/91ӌ qct6jyғd`CQNFGrFz[L;{Hie!6؍ŎNN)Bg}TuvF[Z\EE+UԂ#uSNPJ&ƒ݇R}fovd)[QҲ:x_5-#Ϫe7}-wcsch:KδT-E'rӄ '5W-Q 10C=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 >6qˤJ.,q?N<1̵}/," o&,)4RS8P2+Q!oFZ_0 jQ$ˤ/AA321JgmE,3YU֩E֢(3 `R)?j7_%a8v Cuc$&?s0NT^y~{/A>Loh-{+f뉂9ԩ9ڸI4[U|^#z;!Z:6C47 ?]U[q]q߳_ :fUlېf$& ,}Y2:Q) r, `x0ilW c{GYqȫQKR[1O84Ryچ =8t C  <|mC50,qZƏM?W5<"JH9}?` ;[j#1z=qa :6I?ӟ}&vY!k'N<Բ!(=!m-Y-˯G'aDnC.ӹLt\=*`[74n_y(p %f`V 0|aS-e%S;A 0`p)OdOf-ֶ@x#Il ݚABX:^s!"%K{ͩ,':Lүȯ$lH:~0r%Ke aL{Kvh ˱SS#0 WB9 l*3Bۇti|l6ak*t`|. }M3y D%N7֡`ٚ&#anLơ@HLy;Ƕۻdy=k7SG۲̿UT~ SQI~xxK:pY31Z;Y_ ?o~M6M]!v 0*Q6Y_I[{dq[ut j&  Ϭs`&'{qےJZ|0;exm; >L/Ͻk'ryFbXaLkv6V]Msn2v! o60-iv"?00vy`U*sa1؟ y~جfX2x}=*7*F;1Ԕ~gzTXtcommentxsru RSK-*S034HTPJ-R047Է4QsW(H,IP03TP,M,TU040Q/K p'ũzTXtjpeg:colorspacex3338#5&zTXtjpeg:sampling-factorx3010a=/OIENDB`techblue-jmagick-b4412af/test/correct_output/raised.jpg000066400000000000000000000114551452765401600233460ustar00rootroot00000000000000JFIFHHYCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222"D !"1AQaqd#$23BS%CTr5s%!Q"1Aaq ?\nrh8J%iq{^ _A(}2[jP+2R@Km"M+\b+MTGIlPXqS\HHqR\HDdW$TW$RcDDTRƌQA,p54;TQf8ytG6| yyl,=)3ãiCY^iUHqUynzY:u Cnuu%cPGH5ϣ}†ӵ[_Ri]7WGgl#~M~CS:O7όfI=I)V&V xXl.ڤ!$^y݌cʫOPcpӭ8q6ミ¢dBMTH~ ie+C]|l*zGOW'DOd5 48x a/\7I W##;6Z]oV ҏ£n} ~aKçB_F,L ; ewVX{q ;S fnmҌ~³8;!]J='=>?_/7G"H*A*~pﺫKcq)lWw Ťʙ ȡrFiЦ*+JU"H(Rf ȫՆ9fVo]P(UiF{'c~;3j"i1#`=·6LdesO Y HhKFf{ypkW8~[1 QɦՐˬi~ @φy,Br@N`F}+ε Bhr`/pmQĒu2HǹMs<3oҚFMt(Jw*Σ$$w(mqݑGD%zŜh^Eۈjʶq}z ό s$QJO d RD FN@-,Uo!JIè^O`skIjX!Sw*rGNP'&se**񚉔P9 u\1 y\@VgV[P_*ՖQQ(|n~‹>hfOVY `sJ"r{+Wۺ"FG./K\O-e= 7'=³9yIogH_Fё^>4^m;$2*_ӿ3F&=+o/ٓq%?fA.o׍*A'uRbh$Usot{RUk FD!2H$(Vq@+[dV v3EG.v ?ªyЭB{ n*pq1G^¬SnwJ9%:6KkkGobkEJx}.aHCRLqybV{2$(^B:K(W~,QJFGXG. A 2N9X]^ٹV+Ϗp}~t M[`op½]nٙlЕ&4jjRbiUQWg#_T"b1FP*U 1Ϻ.(.7U ǁ5X3 V^8ސSj>Ubrgш2@u-NaqEͽ["F< ϙNUBFGS) iU7gv3bJEN' |F~U1E'J>Ԅ`Գ!G };Y|#rCN8b{"EPYh%CZZX#gEY-js8 x5c#VGZhK׬gAփׁMT!*DLo]9rjAZaqȩ͉e8OKZi&؎i]q\}BA<;(?} m3EɅbƒz2[n#°h(lB?cn4RVHō-ƕ*CiJ,f*@6k0˴ ҥIl.y{RvG*@3{&BswTRtechblue-jmagick-b4412af/test/correct_output/rotated.jpg000066400000000000000000000152401452765401600235350ustar00rootroot00000000000000JFIFHHYCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222":!1AQa"2BRq#3bC$4S%!1Aq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>%$#,.\$$pv3S݃9*'WjzYDdp{Z To!|eAj'y252;d8SQAeN0*~1uWrO'QT҂Żק#cdc%Dz[EV/y\2\O@Q[e}KRcfoͰ4='\=:ivwNeaͫ=ۣGsܬvRrzȥ@DDD@DDD@kR}6Ak0&8LخhVΝrjw!|aqd`'ZaLܤCc0\BhV,-Q۫gO-;pH0ZW=譢<.c#>U9ஶ߀AEdc/gw `kJ陿#;nCR/y2=f:t1$L=/[-ḓհܮo>u-EY+|+f"(""" """ ""^}봃!ao瀘߱蹦sL܅Hǖ=,pWl, _NoL6-Qv{VBy8*_=2ƙjZ!'1収AFͥYp]DjzUj%ǰ J5 qT +#%u'~AYMdܭy-oSCK+uFZ6+xmolED@DDD@DDD@DD'Uӊ6jѷ8 s%P2>w S3Й~ <をzY]}ORk&omqrr"""" techblue-jmagick-b4412af/test/correct_output/scaled.jpg000066400000000000000000000035741452765401600233350ustar00rootroot00000000000000JFIFHHYCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222Pd"4!1"AQa#2qBR3!!1AQ2 ? S}շҽgjsLjфzQ6/jM 8u&b,G&!>m1IGGu GLm9-BR~f-rlG}j>HX?Z)W0LsA}D3k*aZ71fъ#uZ8ncc1ǧQ^~豕mϋ޼Ov3/ۭ?OҗO0#݄ڬv]զ62a<׉(t `S+[D+7>ڄ{qf/\Gou:Jۼ!,[_fAVy!oǘJ zmJ- R>T1۔ZeCXʪ񪸔zsQ:Ln"#+.\Nyאɨ^32'5 wyfo2Nje{c͹zhv ž.K"d`uTvXuY%\yf6Sҹ!8SV-q ~K%+iHW{Me0GJ^d97XG GZ|eQ#I;An`h?'xO:>U(UA?*E sM{9<]TOT#W޼!L§,pIo m dg-Ehiug߰?iR\BDc*. qhR4њ:xV9dW? Rs c&jWKsF,^egB}fUN"$R}]^j3H;HF2ֹ7F6w5#ymS @mA1b<5ѷehB``b>ݜz&Lcu8*ʋZF X`BibG\ /i)w[ r(p`2ODM#gمNC?bVQʯ\3ֲŏtechblue-jmagick-b4412af/test/correct_output/sharpened.jpg000066400000000000000000000117011452765401600240420ustar00rootroot00000000000000JFIFHHYCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222"F "!2BRa#1brAQ$Cqs3DSt&!1"QAaq ?"VjM}8JhӴNO'i>` X"Ru@pM)Qx(pQq@b(qU"\TRg[(VB8UnVB&U)hhb&T,@)+zYjQ Eh5ӰRh } Km[iѰo6H8#`W6ӓ0vDQ. E,Q8m.(6 oю9v~>HֿXb.Fc(H˜e%J4pQxɠGT=vU3bY (&w7Q WbRQ2$TL*Q$*dQ$ʒe!IXLg4}~& Dqqb_ |<ԬiFIaO:66i`DB$.ϨCN(S8("\YARP3oTPp9!搎IryKz~χ.B}w?ɦՃM{šW}2˻.qXˉ.8"]܈/uyG;cɶ,>>ױZ=Q3T"&ܓ"XeNx&ҚGYo^Payb{m&9#m8+NHan)Io},e )*ix# d/yxRԢ˵ת`b8X2Hq.{WPB*j:􁝆(@c\Hq/..x:F2v &("/.=zJ)93,6RUD,j.Uj}"=Hc.Xy!tF#Ǯ>G%e^ % qd!o @*Hz K`_T(R]*w*,PHC2љGy}қe+Eⶶx*(ʭ7&Z!:/`'̙V޶\˝])0bQyE|2JY0~=)LVD-T! 3#/wev錓 Lvı]%ij*$h PJCRu𐝄^z`:haIvGzm)#(%ex'SwlU x*:rl{CXΎi(,-2,V5 )n@YB$.C,Ļ>//k6J]tI)\y2n=.=H%~T[*g s6w$|=Xt]txjc[)kަ^:h@*6uc"\sB)\-cvY6r%bEutV)ug )%HGC!/ud\穂rngbqGp/C{04ѸBG8WFٓ'i,Gɢ,DD^IO^s 4 x ~/xlGuCT5\qв\}PI_FmC2e3_&ЏYMޒSt=Hşs[u=?Cgh&-!HJN_yU.,W.1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7b8c'3H>i-ы"[47(d8ݐVTn秴kXB%ݢ؜bh sL殒'7v..HjVsɑjO9B-tRFFZ{iYg\ dPy,]SE[9ś,>nIٺYI igLFQ ;} I}mJuY)Ŕ stY%ٺY:I-I!I 'QrI$کEQlg CI)C4ƍq@NbrӤ7 t~?xRICzM-YZk4B=_)$J ?techblue-jmagick-b4412af/test/correct_output/sheared.jpg000066400000000000000000000155641452765401600235170ustar00rootroot00000000000000JFIFHHYCREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0 C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222f"A!1AQaq"2BRb#3r$CScs)!1"A2QBa ?舀""" """ T6CZb<d9%ٟıZ<"Vsq5˳v ˩hY&5:Y^tv^<TR;U5Do->5K -19^:J`Jl.˺X/&f]]78VԳoE::x˞כ>˞^eK/X )cpVb-ғɒ~%~2hϠplOW&J@,6y4r6Qb$,(7a/MV%E=T'ogDe/`鳆Um,=%eધny╽cxp\8~I*"*DDD@DDD@DDD@V.ڪP#0чCF[VWQQ_9GHא:.OJu}fPrzSH>s-od6Kc*F cMe{^lEh/ a]%yERcKEƯ U5Ab,쩖`98$epZsT@Zk1Ů6*R /&7Gm)TH\>eFǠ{He+gER@,*7E/G$uM17\ ~˥_Ye;.g-iI<Oج^״9iA+T5u4MQ,.O埤"?It2g9L0%fi|XaC\gyT,;.oK]D]LOl'+X:8pU?<{.m(+bT9OW.@""" "I r|fm(0 !|./ɅYT&} `8A.qlΆt'/=_-yR!9hlQU2sRh#Nǀw.+!o٩#Ecn Fܮ$56c=q!мZ=⢕8T>݈=kA-l4bcGPZ VT",SuI E"(PXp E T9as I+ bb9bl$]ӹIe{#eYqqưִT v1Ѱ؏A'ϲY#f-=CX{M$n㩁1a{lȻZL<*IK5X @Y#[" @PBxk`RQ.,N !xwRcut\!H\:p'QG,sbhEʸRB VܣrF#rTdRJ[N(أN*9fj){1SJȰBqcWo=,y?5lm%Lon]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~*gp9+q/uZ2B~A?uU FE17uXX7uP( UWwX7E첸BKA77^n(Q~߈olzR8Ab,ҝ4 )$~`ey]}&gCOO@ &&vKn(c'2acۚՅmTpuUm s\n٤ZZE13f,}-FJgڹe9\V;Ifp'R!9.xH⣺"]<^#$scK$csKI߽Iu7ss$[#wUU|)u4uh"pT{Nc̴V'JۀSUqQQ4LqDے|rɞcV3I&m=#yvOXK,éê^2J *2llxm;sGQ#}yUCI]ή}cB n#}JyoMWGʢK*EGYR;״|+#TBArfQGrq/u$uOEF 0><> -b-]v _NpoWUb~^_, 76'AM{xJlL;^M c<>=h96d骢M,v߿QVTbR몚n  hEg9HZ6AUuSISS)#Jx%o >=>]3'd $ј}UKU-|lJQ 1SaCX4 8Z"DDD@DDD@DDD@DDbNן X%W܌$V_b9<7_D")&Y0)hw6[IZFQ˲-RThsN*|JZIH#@7 J쑕MNcͱZ#T7XF9OdQk}J\.CfK~pX5#cf7d |@}!rfQ_-D$^7zIZ9Ab9Lsh뱝G7yQb6 :EB[@DDD@DDD@techblue-jmagick-b4412af/test/correct_output/transparent.jpg000066400000000000000000000037271452765401600244430ustar00rootroot00000000000000JFIFHHC       C d" 0X68rv1!"Q; !S4TU126Aqrst#QBR ?Lwgy8CnW(m^ʭh]Zk^.֦iO5<<(<R˂BݢWީPcEYcxʮ]w8r{u*'8|0կgx&sM?ypMO>3k6Go 8|oa^ɴ=xEOx}yp ZwM('8|g׳2m777i y~{;&sM?ypMO>3k6Go 8|<"K5^0nX_aZ5ee[ƭjiZ<+Q>it5W'ٜe[ 5\K$kzJr%ѥNä́ *'oVUPzWo&iDPPdLz]}w^Lz]}wAjG~8U/`/90῞1[W_B *o^?^՟M;  K K-^C7g>&7+|(Z῞1[W_B\kټ}@AA3vqþ{A3vqþfSVgC4xo]E P7+|(Zyx?{7V}4((2&z.>w߻h&z.>w߻y # u{ƗOj+33[ч9vhg+C𶳺X]**zQEQ4Tob%= %E=MCaGr9"7]lQ7hҾ A]riiww[PfZ,^H3K._C .}1;^X>fx\uA]rcsj=wKSjx} .}44;?l{7yb A]riiwwYͨ~oY-OժA4; P޳ZUiwwY/f76cgt?V H3K._CnmCǾ3zj~W//ffx\uڇ|fZ,^H3K._C .}1;^X 8~H3K._Cډ-وZ~%f5,m+Dny2siԷ^lxԣ·j(ƭjTitle:

* *

Description:

* *

Copyright: Copyright (c) 2008

* *

Company:

* * @author Jacob Nordfalk */ public class MagickTesttools { public static String path_input = "test"+File.separator+"magicktest"+File.separator; public static String path_actual_output = "test"+File.separator+"actual_output"+File.separator; public static String path_correct_output = "test"+File.separator+"correct_output"+File.separator; /** * This flag makes all file comparisons pass and avoids that files are deleted in magictest/actual_output/ * Set to true and run tests to generate examples of "correct" output. * Copy then all files from magictest/actual_output/ to magictest/correct_output/ to define * the 'correct' result files which the test should conform to. */ public static boolean generate_correct_output = false; private static boolean generate_correct_output_warned; /** Speedup running tests by a factor 5 by by not invoking compare at all. For memory leak testing, not for unit test.*/ public static boolean dont_compare_output = false; /** * Compares two image files pixel by pixel (by invoking the IM command 'compare') * @param file1 First image file name * @param file2 Second image file name * @return double difference The max allowed pixel difference (MSE metric) * @throws IOException If the difference is unacceptable big */ public static void compareImage(String file1, String file2, double maxDiff) throws IOException { //maxDiff = 2; // uncomment to make very strict test! if (generate_correct_output) { System.err.println("************************************** WARNING ************************************************"); System.err.println("* With generate_correct_output = true you are generating 'correct' output, instead of testing *"); System.err.println("***********************************************************************************************"); // show popup once if (!generate_correct_output_warned) { int ret = JOptionPane.showConfirmDialog(null, "generate_correct_output is on, so you are a generating 'correct' output, instead of comparing files"); System.out.println("ret="+ret); if (ret != JOptionPane.OK_OPTION) { System.err.println("generate_correct_output cancelled by user"); System.exit(-1); } generate_correct_output_warned = true; } return; } if (!new File(file1).exists()) throw new java.io.FileNotFoundException("Fil 1 not found: " + file1); if (!new File(file2).exists()) throw new java.io.FileNotFoundException("Fil 2 not found: " + file2); /* compare -metric MSE rose.jpg reconstruct.jpg difference.png 29.5615 dB MetricOptions[] = { { "Undefined", (long) UndefinedMetric }, { "MAE", (long) MeanAbsoluteErrorMetric }, { "MSE", (long) MeanSquaredErrorMetric }, { "PAE", (long) PeakAbsoluteErrorMetric }, { "PSNR", (long) PeakSignalToNoiseRatioMetric }, { "RMSE", (long) RootMeanSquaredErrorMetric }, { (char *) NULL, (long) UndefinedMetric } } */ //String cmd = "compare -metric MSE "+file1+" "+file2+" tempImageDifference.jpg"; String[] cmd = new String[] {"compare","-metric","MSE",file1,file2,"tempcompareImage.jpg"}; // Some may need an absolute path for IM 'compare' command. // Here are some examples: // if (System.getProperty("user.dir").startsWith("E:")) cmd = "E:\\user\\caramba\\magick-6.2.6-Q8\\"+cmd; // cmd = "C:\\Program Files\\ImageMagick-6.3.5-Q8\\"+cmd; Process compProces = Runtime.getRuntime().exec(cmd, new String[0]); InputStream std = compProces.getInputStream(); InputStream err = compProces.getErrorStream(); StringBuffer outsb = new StringBuffer(20); StringBuffer errsb = new StringBuffer(20); do { int ch =std.read(); if (ch==-1) break; outsb.append( (char) ch); } while (true); do { int ch =err.read(); if (ch==-1) break; errsb.append( (char) ch); } while (true); compProces.getOutputStream().close(); std.close(); err.close(); String ret = outsb.toString() + errsb.toString(); // parse the first number in output int n = ret.indexOf(" "); try { double difference = Double.parseDouble(n > 0 ? ret.substring(0, n) : ret.toString()); if (difference > maxDiff) { throw new RuntimeException("Images had a difference of " + difference + " which is bigger than max allowed of " + maxDiff + ":\n " + file1 + " " + file2); } } catch (NumberFormatException ex) { System.err.println("Output of command "+Arrays.asList(cmd)+" could not be parsed."); System.err.println("Perhaps you need to give full path to IMs 'compare' command?"); System.err.println(cmd[0] + " gave stdout: '"+outsb.toString().trim()+"'"); System.err.println(cmd[0] + " gave stderr: '"+errsb.toString().trim()+"'"); throw new RuntimeException(ret); } // delete temporary file if no significan difference was found new File("tempImageDifference.jpg").delete(); } public static void writeAndCompare(MagickImage image, ImageInfo info, String fileName) throws Exception { new File(path_actual_output).mkdirs(); // Delete old files to make sure they dont interfere new File(path_actual_output+fileName).delete(); image.setFileName(path_actual_output+fileName); image.writeImage(info); // compare the pixel data (allowing for a small difference) if (!dont_compare_output) compareImage(path_actual_output+fileName, path_correct_output+fileName, 20); if (!generate_correct_output) { // Check that IPCT and ICC data are exactly the same MagickImage correct = new MagickImage(new ImageInfo(path_correct_output+fileName)); if (!compareImageProfiles(image, correct)) { throw new RuntimeException("Image "+fileName+" had a difference in profiles."); } } } public static boolean compareImageProfiles(MagickImage image, MagickImage correct) throws Exception { if (!equals(image.getIptcProfile(), correct.getIptcProfile())) { System.out.println("Images had a IPTC profile difference"); System.out.println("Correct : "+profileInfoToString(correct.getIptcProfile())); System.out.println("Actual : "+profileInfoToString(image.getIptcProfile())); return false; } if (!equals(image.getColorProfile(), correct.getColorProfile())) { System.out.println("Images had a ICC profile difference"); System.out.println("Correct : "+profileInfoToString(correct.getColorProfile())); System.out.println("Actual : "+profileInfoToString(image.getColorProfile())); return false; } return true; } /** * Class ProfileInfo is missing the .equals()-method, so we make it here * @param p1 ProfileInfo * @param p2 ProfileInfo * @return boolean false if different content, true otherwise */ public static boolean equals(ProfileInfo p1, ProfileInfo p2) { if (p1==p2) return true; if (p1==null || p2==null) return false; // one but not both null return (p1.getName()==p2.getName() || (p1.getName()!=null && p1.getName().equals(p2.getName()))) && Arrays.equals(p1.getInfo(), p2.getInfo()); } /** * Display the information about the profile supplied. * * @param profile the profile for which to display */ public static void displayProfile(ProfileInfo profile) { System.out.println(profileInfoToString(profile)); } /** * Returns information about the profile supplied. * * @param profile the profile for which to display */ public static String profileInfoToString(ProfileInfo profile) { if (profile == null) { return "(null)"; } if (profile.getInfo() == null) { return "profile info=null"; } else { //return "profile info.length=" + profile.getInfo().length+" hash="+Arrays.hashCode(profile.getInfo()); return "profile info.length=" + profile.getInfo().length; } } public static void allocateAndFreeSomeMem(int n) { byte[] b = new byte[n]; for (int i=0; i= requiredValue && red >= requiredValue && green >= requiredValue ) { return Color.WHITE; } else if ( blue >= requiredValue && red <= ignoredValue && green <= ignoredValue ) { return Color.BLUE; } else if ( blue <= ignoredValue && red >= requiredValue && green <= ignoredValue ) { return Color.RED; } else if ( blue <= ignoredValue && red <= ignoredValue && green >= requiredValue ) { return Color.GREEN; } else { fail("invalidate color b=[" + blue + "] red= [" + red + "] green=[" + green + "]"); return null; } } public void testAutoOrientImage() throws Exception { // const value final String exif_orientation_path = "exif_orientation" + File.separator; final int image_size = 50; for ( int orientation = 0; orientation <= 8; orientation++ ) { // do AutoOrient from input file MagickImage inputImage = new MagickImage(new ImageInfo(MagickTesttools.path_input + exif_orientation_path + "exif_orientation_" + orientation + ".jpg")); MagickImage outputImage = inputImage.autoOrientImage(); assertNotNull(outputImage); outputImage.setFileName(MagickTesttools.path_actual_output + "exif_orientation_" + orientation + ".jpg"); outputImage.writeImage(new ImageInfo()); inputImage.destroyImages(); outputImage.destroyImages(); // open actual outputfiles and preparing for checking MagickImage actualImage = new MagickImage(new ImageInfo(MagickTesttools.path_actual_output + "exif_orientation_" + orientation + ".jpg")); PixelPacket leftTop = actualImage.getOnePixel(0,0); PixelPacket leftBottom = actualImage.getOnePixel(0,image_size-1); PixelPacket rightTop = actualImage.getOnePixel(image_size-1,0); PixelPacket rightBottom = actualImage.getOnePixel(image_size-1,image_size-1); // checking on aspect of image switch( orientation ) { case 0: assertEquals("orientation[" + orientation + "] leftTop" ,Color.RED ,this.judgeColor(leftTop)); assertEquals("orientation[" + orientation + "] leftBottom" ,Color.GREEN,this.judgeColor(leftBottom)); assertEquals("orientation[" + orientation + "] rightTop" ,Color.BLUE ,this.judgeColor(rightTop)); assertEquals("orientation[" + orientation + "] rightBottom",Color.WHITE,this.judgeColor(rightBottom)); break; case 1: assertEquals("orientation[" + orientation + "] leftTop" ,Color.RED ,this.judgeColor(leftTop)); assertEquals("orientation[" + orientation + "] leftBottom" ,Color.GREEN,this.judgeColor(leftBottom)); assertEquals("orientation[" + orientation + "] rightTop" ,Color.BLUE ,this.judgeColor(rightTop)); assertEquals("orientation[" + orientation + "] rightBottom",Color.WHITE,this.judgeColor(rightBottom)); break; case 2: assertEquals("orientation[" + orientation + "] leftTop" ,Color.BLUE ,this.judgeColor(leftTop)); assertEquals("orientation[" + orientation + "] leftBottom" ,Color.WHITE,this.judgeColor(leftBottom)); assertEquals("orientation[" + orientation + "] rightTop" ,Color.RED ,this.judgeColor(rightTop)); assertEquals("orientation[" + orientation + "] rightBottom",Color.GREEN,this.judgeColor(rightBottom)); break; case 3: assertEquals("orientation[" + orientation + "] leftTop" ,Color.WHITE,this.judgeColor(leftTop)); assertEquals("orientation[" + orientation + "] leftBottom" ,Color.BLUE ,this.judgeColor(leftBottom)); assertEquals("orientation[" + orientation + "] rightTop" ,Color.GREEN,this.judgeColor(rightTop)); assertEquals("orientation[" + orientation + "] rightBottom",Color.RED ,this.judgeColor(rightBottom)); break; case 4: assertEquals("orientation[" + orientation + "] leftTop" ,Color.GREEN,this.judgeColor(leftTop)); assertEquals("orientation[" + orientation + "] leftBottom" ,Color.RED ,this.judgeColor(leftBottom)); assertEquals("orientation[" + orientation + "] rightTop" ,Color.WHITE,this.judgeColor(rightTop)); assertEquals("orientation[" + orientation + "] rightBottom",Color.BLUE ,this.judgeColor(rightBottom)); break; case 5: assertEquals("orientation[" + orientation + "] leftTop" ,Color.RED ,this.judgeColor(leftTop)); assertEquals("orientation[" + orientation + "] leftBottom" ,Color.BLUE ,this.judgeColor(leftBottom)); assertEquals("orientation[" + orientation + "] rightTop" ,Color.GREEN,this.judgeColor(rightTop)); assertEquals("orientation[" + orientation + "] rightBottom",Color.WHITE,this.judgeColor(rightBottom)); break; case 6: assertEquals("orientation[" + orientation + "] leftTop" ,Color.GREEN,this.judgeColor(leftTop)); assertEquals("orientation[" + orientation + "] leftBottom" ,Color.WHITE,this.judgeColor(leftBottom)); assertEquals("orientation[" + orientation + "] rightTop" ,Color.RED ,this.judgeColor(rightTop)); assertEquals("orientation[" + orientation + "] rightBottom",Color.BLUE ,this.judgeColor(rightBottom)); break; case 7: assertEquals("orientation[" + orientation + "] leftTop" ,Color.WHITE,this.judgeColor(leftTop)); assertEquals("orientation[" + orientation + "] leftBottom" ,Color.GREEN,this.judgeColor(leftBottom)); assertEquals("orientation[" + orientation + "] rightTop" ,Color.BLUE ,this.judgeColor(rightTop)); assertEquals("orientation[" + orientation + "] rightBottom",Color.RED ,this.judgeColor(rightBottom)); break; case 8: assertEquals("orientation[" + orientation + "] leftTop" ,Color.BLUE ,this.judgeColor(leftTop)); assertEquals("orientation[" + orientation + "] leftBottom" ,Color.RED ,this.judgeColor(leftBottom)); assertEquals("orientation[" + orientation + "] rightTop" ,Color.WHITE,this.judgeColor(rightTop)); assertEquals("orientation[" + orientation + "] rightBottom",Color.GREEN,this.judgeColor(rightBottom)); break; } // checking on Orientation tag String exifOrientationTag = actualImage.getImageAttribute("EXIF:Orientation"); if ( orientation == 0 ) { assertNull("orientation[" + orientation + "] image should not have orientation tag",exifOrientationTag); } else { assertEquals("orientation[" + orientation + "] image's orientation tag should be 1",1,Integer.parseInt(exifOrientationTag)); } actualImage.destroyImages(); } } /** * Test if diverse operations on a small image is processed correctly * Values on Linux with JMagick 6.2.8 and IM 6.2.8:
	 Scaled to 60x30
	 Depth 8
	 Quality is 75
	 Colorspace is 1
	 Resolution units is 1
	 X resolution is 72.0
	 Y resolution is 72.0
	 Size blob is 4538
	 Colors 0
	 Total colors 0
	 Depth is 8
	 Old colour PixelPacket(255,255,255,0)
	 New colour PixelPacket(255,0,0,0)
	 
*/ public void testDiverseOperations() throws Exception { Rectangle rect = new Rectangle(0, 0, 80, 40); int flags = Magick.parseImageGeometry("60x50", rect); assertEquals("Scaled to ", 60, rect.width); assertEquals("Scaled to ", 30, rect.height); // Copy an image. ImageInfo info = new ImageInfo(MagickTesttools.path_input + "pics.jpg"); info.setPage("50x50+0+0"); info.setUnits(ResolutionType.PixelsPerInchResolution); info.setColorspace(ColorspaceType.RGBColorspace); info.setBorderColor(PixelPacket.queryColorDatabase("red")); if (IMver > 557) { // Doesent exists in IM557 info.setDepth(8); assertEquals("Depth ", 8, info.getDepth()); info.setDepth(0); } image = new MagickImage(info); image.setImageAttribute("Comment", "Processed by JMagick"); if (IMver > 557) { assertEquals("Quality is ", 75, image.getQuality()); } assertEquals("Colorspace is ", 1, image.getColorspace()); assertEquals("Resolution units is ", 1, image.getUnits()); assertEquals("X resolution is ", 72, image.getXResolution(), 0.1); assertEquals("Y resolution is ", 72, image.getYResolution(), 0.1); assertEquals("Size blob is ", 4538, image.sizeBlob()); assertEquals("Colors ", 0, image.getColors()); assertEquals("Total colors ", 0, image.getTotalColors()); assertEquals("Depth is ", 8, image.getDepth()); image.signatureImage(); MagickTesttools.writeAndCompare(image, info, "copy.jpg"); // Background Color if (IMver > 557) { // As .equals() is not implementet we compare the strings // This only works if we are running Q8 (8 bits per pixel //assertEquals("Old colour ", image.getBackgroundColor().toString(), // new PixelPacket(255, 255, 255, 0).toString()); // instead query the color "white" assertEquals("Old colour ", image.getBackgroundColor().toString(), PixelPacket.queryColorDatabase("white").toString()); image.setBackgroundColor(PixelPacket.queryColorDatabase("red")); // This only works if we are running Q8 (8 bits per pixel //assertEquals("New colour ", image.getBackgroundColor().toString(), // new PixelPacket(255, 0, 0, 0).toString()); assertEquals("New colour ", image.getBackgroundColor().toString(), PixelPacket.queryColorDatabase("red").toString()); } // Profile test assertEquals("Number of generic profiles ", 0, image.getGenericProfileCount()); image.setColorProfile(new ProfileInfo("Test", new byte[20])); //assertEquals( "Test", image.getColorProfile().getName()); // names are not stored in IM any more assertEquals(20, image.getColorProfile().getInfo().length); // Border image image.setBorderColor(PixelPacket.queryColorDatabase("green")); MagickImage borderedImage = image.borderImage(new Rectangle(0, 0, 10, 20)); // In IM 557 the profile wont load from file if (IMver > 557) { MagickTesttools.writeAndCompare(borderedImage, info, "border.jpg"); } } public void testRaise() throws Exception { // Raise image image.raiseImage(new Rectangle(0, 0, 10, 20), true); MagickTesttools.writeAndCompare(image, info, "raised.jpg"); } public void testMontage() throws Exception { // Montage test MagickImage images[] = new MagickImage[2]; images[0] = image; images[1] = image.rotateImage(180.0); MagickImage seqImage = new MagickImage(images); MontageInfo montageInfo = new MontageInfo(new ImageInfo()); montageInfo.setFileName("montage.jpg"); montageInfo.setBorderWidth(5); MagickImage montage = seqImage.montageImages(montageInfo); MagickTesttools.writeAndCompare(montage, new ImageInfo(), "montage.jpg"); } /** * Test montage with text. * Expect this test to fail when the font set change. This is probably always the case on a fresh installation. */ public void testMontageWithText_failMightBeOk() throws Exception { // Montage test MagickImage images[] = new MagickImage[2]; images[0] = image; images[1] = image.rotateImage(180.0); MagickImage seqImage = new MagickImage(images); MontageInfo montageInfo = new MontageInfo(new ImageInfo()); montageInfo.setTitle("Melbourne"); montageInfo.setFont("Helvetica"); // added january 2009 to try to fix font a little more montageInfo.setBorderWidth(5); MagickImage montage = seqImage.montageImages(montageInfo); MagickTesttools.writeAndCompare(montage, new ImageInfo(), "montage_w_text.jpg"); } /** * Test if diverse operations on a small image is processed correctly * Values on Linux with JMagick 6.2.8 and IM 6.2.8:
	 Length 22687
	 Blob width is 198
	 Blob heght is 134
	 java.awt.Dimension[width=198,height=134]
	 
*/ public void testAverage() throws Exception { MagickImage images[] = new MagickImage[2]; images[0] = image; images[1] = image.rotateImage(180.0); MagickImage seqImage = new MagickImage(images); // Test average MagickImage average = seqImage.averageImages(); MagickTesttools.writeAndCompare(average, new ImageInfo(), "average.jpg"); } public void testBlob() throws Exception { // Converting the montage into a blob image.setMagick("JPG"); byte[] mblob = image.imageToBlob(new ImageInfo()); System.out.println("Blob length " + mblob.length); // Image to blob info = new ImageInfo(); byte[] blob = image.imageToBlob(info); // Blob to image info = new ImageInfo(); MagickImage blobImage = new MagickImage(info, blob); Dimension imageDim = blobImage.getDimension(); assertEquals("Blob width is ", 198, imageDim.width); assertEquals("Blob heght is ", 134, imageDim.height); MagickTesttools.writeAndCompare(blobImage, info, "blob.jpg"); // JPEG Image to GIF blob image.setMagick("GIF"); blob = image.imageToBlob(info); FileOutputStream out = new FileOutputStream(MagickTesttools.path_actual_output + "blob.gif"); out.write(blob); out.close(); // Going from Q8 to Q16 gives difference 23.5207 here, so set it to 40 to be on the safe side // 2008-08-05: Switching from IM 6.3.9 to IM 6.4.2 gives difference 933616.0 here (GIF looks OK // overall but is pixelized differently) so we have to set it to 1500000 to be on the safe side MagickTesttools.compareImage(MagickTesttools.path_actual_output + "blob.gif", MagickTesttools.path_correct_output + "blob.gif", 1500000); } /** * Test of diverse operations on a small is processed correctly */ public void testRotShearScale() throws Exception { // Rotation and shear MagickImage rotated = image.rotateImage(45.0); MagickTesttools.writeAndCompare(rotated, info, "rotated.jpg"); MagickImage sheared = image.shearImage(50.0, 10.0); MagickTesttools.writeAndCompare(sheared, info, "sheared.jpg"); MagickImage scaled = image.scaleImage(100, 80); MagickTesttools.writeAndCompare(scaled, info, "scaled.jpg"); } public void testCloning() throws Exception { // Cloning Dimension imageDim = image.getDimension(); assertEquals("Width is ", 198, imageDim.width); assertEquals("Height is ", 134, imageDim.height); assertEquals("Depth is ", 8, image.getDepth()); assertEquals("Storage class is ", 1, image.getStorageClass()); assertEquals("Comment is ", "CREATOR: XV Version 3.10a Rev: 12/29/94 (PNG patch 1.2) Quality = 100, Smoothing = 0\n", image.getImageAttribute("Comment")); MagickImage clonedImage = image.cloneImage(0, 0, false); MagickTesttools.writeAndCompare(clonedImage, info, "clone.jpg"); } /** * Test of diverse operations on a small is processed correctly * This test might fail if ImageMagick doesent have PNG support. */ public void testQuantizeImage_failMightBeOk() throws Exception { // Quantization MagickImage quantizedImage = image; QuantizeInfo quantizeInfo = new QuantizeInfo(); quantizeInfo.setColorspace(ColorspaceType.GRAYColorspace); quantizeInfo.setNumberColors(256); quantizeInfo.setTreeDepth(4); assertTrue("QuantizeImage ", quantizedImage.quantizeImage(quantizeInfo)); assertEquals("Colors ", 235, quantizedImage.getColors()); assertEquals("Total colors ", 0, quantizedImage.getTotalColors()); MagickTesttools.writeAndCompare(quantizedImage, info, "quantized.png"); } public void testConstituteDrawTransparent() throws Exception { // Create an image from scratch MagickImage blankImage = new MagickImage(); byte[] pixels = new byte[200 * 100 * 4]; for (int i = 0; i < 200 * 100; i++) { pixels[4 * i] = (byte) 255; pixels[4 * i + 1] = (byte) 255; pixels[4 * i + 2] = (byte) 255; pixels[4 * i + 3] = (byte) 0; } blankImage.constituteImage(200, 100, "RGBA", pixels); // Put a red rectangle around the border DrawInfo drawInfo = new DrawInfo(new ImageInfo()); drawInfo.setPrimitive("Rectangle 10 10 190 90"); drawInfo.setStroke(PixelPacket.queryColorDatabase("red")); drawInfo.setFill(PixelPacket.queryColorDatabase("white")); blankImage.drawImage(drawInfo); MagickTesttools.writeAndCompare(blankImage, info, "blank.jpg"); // Make the white page of the image transparent blankImage.transparentImage( PixelPacket.queryColorDatabase("white"), 65535); //info.setMagick("PNG"); MagickTesttools.writeAndCompare(blankImage, info, "transparent.jpg"); } /** * Test annotate with text. * Expect this test to fail when the font set change */ public void testAnnotate_failMightBeOk() throws Exception { // Create an image from scratch MagickImage blankImage = new MagickImage(); byte[] pixels = new byte[200 * 100 * 4]; for (int i = 0; i < 200 * 100; i++) { pixels[4 * i] = (byte) 255; pixels[4 * i + 1] = (byte) 255; pixels[4 * i + 2] = (byte) 255; pixels[4 * i + 3] = (byte) 0; } blankImage.constituteImage(200, 100, "RGBA", pixels); // Annotate the image with a green Hello ImageInfo blankImageInfo = new ImageInfo(); DrawInfo annotateInfo = new DrawInfo(blankImageInfo); annotateInfo.setOpacity(0); annotateInfo.setFont("fixed"); annotateInfo.setFill(PixelPacket.queryColorDatabase("green")); annotateInfo.setText("Hello"); annotateInfo.setGeometry("+30+30"); blankImage.annotateImage(annotateInfo); MagickTesttools.writeAndCompare(blankImage, info, "blank_w_text.jpg"); } public void testCropChop() throws Exception { Rectangle rect; // Crop image rect = new Rectangle(20, 20, 150, 120); MagickImage cropped = image.cropImage(rect); MagickTesttools.writeAndCompare(cropped, info, "cropped.jpg"); // Chop image rect = new Rectangle(0, 0, 150, 120); MagickImage chopped = image.chopImage(rect); MagickTesttools.writeAndCompare(chopped, info, "chopped.jpg"); } public void testSharpen() throws Exception { // Sharpen image MagickImage sharpened = image.sharpenImage(1.0, 5.0); MagickTesttools.writeAndCompare(sharpened, info, "sharpened.jpg"); } public void testDespeckle() throws Exception { // Despeckle image MagickImage despeckled = image.despeckleImage(); MagickTesttools.writeAndCompare(despeckled, info, "despeckled.jpg"); } public void testConvolve() throws Exception { // Convolve image double[] kernel = new double[9]; for (int i = 0; i < 9; i++) { kernel[i] = 1.0; } kernel[4] = 2.0; MagickImage convolvedImage = image.convolveImage(3, kernel); MagickTesttools.writeAndCompare(convolvedImage, info, "convolved.jpg"); // Finally display the image. MagickWindow window = new MagickWindow(image); if (popupWindow) window.setVisible(true); // MagickInfo test MagickInfo minfo = new MagickInfo("JPEG"); assertEquals("JPG description: ", "Joint Photographic Experts Group JFIF format", minfo.getDescription()); } public void testException() throws Exception { // When we fail to read image try { ImageInfo notFoundInfo = new ImageInfo( "not_exist.png" ); MagickImage notFound = new MagickImage(); notFound.readImage(notFoundInfo); fail("MagickException shold be thrown from readImage due to no image"); } catch ( MagickException e ) { } } } techblue-jmagick-b4412af/test/magicktest/exif_orientation/000077500000000000000000000000001452765401600240075ustar00rootroot00000000000000techblue-jmagick-b4412af/test/magicktest/exif_orientation/exif_orientation_0.jpg000077500000000000000000000026011452765401600303000ustar00rootroot00000000000000JFIF``C      C  22" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?(39?G<[`ko/$sſ_%'*T3~?zGuEW!EPCoiG.AWE`S(wݕ,_*+??3 W*< j_ #> ?fEࡓ}8n ^}ձmrf2HK:ܺM6C> {/{wo/(UnEm|~*.~||-NM~~ǂӧ"`S~iG?h>~!r";ꭠ?MV7-s{6x s_rրAk YnSVxK#3gDzya0cNׯ,>"}m]73gY#َ-ŵ!_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ISkj[*Ug8[*T-yJ[*TX y!L#l 1?ԐH TAtr XfiRH;co4TҥHcn4ۍ*TmƢZ*Vn!OIpTJlsC~?__>})Rle hZflq4R*techblue-jmagick-b4412af/win32/000077500000000000000000000000001452765401600162715ustar00rootroot00000000000000techblue-jmagick-b4412af/win32/Makefile.VC++000077500000000000000000000057531452765401600204030ustar00rootroot00000000000000 # # This makefile only compiles the C files and the generated # jni stub and headrer files and produces a DLL. # # The java compilation, generation of the JAR file and the JNI stubs # still have to be done on Unix using the regularly supplied make # file. # # Hint: To be placed in .../srm/magick and invoked from there, # nmake -f Makefile.VC++ # # NOTE: If you use a Visual Studio 2003 or later you will propably # prefer the Makefile.all instead # # TODO: Complete generation of JMagick in the NT Environment. # # Author: IT # Date: Oct 2000 # $Id: Makefile.VC++,v 1.2 2002/10/08 20:37:07 ttey Exp $ # CPP=cl.exe LINK32=link.exe OUTDIR=..\..\lib INTDIR=..\..\obj\magick JNIINC=C:\jdk1.3.1_01\include GENINC=..\..\generated\magick MAGICKINC=c:\image_stuff\ImageMagick-5.4.9-Q16\include MAGICKLIB=c:\image_stuff\ImageMagick-5.4.9-Q16\lib\CORE_RL_magick_.lib ALL : "$(OUTDIR)\jmagick.dll" # Debugging, no optimizing and stack checks are required. It bangs otherwise! CPP_PROJ=/nologo /MTd /W3 /GX /Od /Ge /Fo"$(INTDIR)\\" /c \ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" \ /D "JMAGICK_EXPORTS" /D "_VISUALC_" \ /I "$(JNIINC)" /I "$(JNIINC)/win32" /I "$(MAGICKINC)" /I "$(GENINC)" LINK32_FLAGS=$(MAGICKLIB) \ /nologo /dll /incremental:no /machine:I386 \ /out:"$(OUTDIR)\jmagick.dll" /implib:"$(OUTDIR)\jmagick.lib" LINK32_OBJS= \ "$(INTDIR)\jmagick.obj" \ "$(INTDIR)\magick_DrawInfo.obj" \ "$(INTDIR)\magick_ImageInfo.obj" \ "$(INTDIR)\magick_MagickImage.obj" \ "$(INTDIR)\magick_MagickInfo.obj" \ "$(INTDIR)\magick_MontageInfo.obj" \ "$(INTDIR)\magick_Magick.obj" \ "$(INTDIR)\magick_PixelPacket.obj" \ "$(INTDIR)\magick_QuantizeInfo.obj" "$(OUTDIR)\jmagick.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) $(LINK32_FLAGS) $(LINK32_OBJS) .c{$(INTDIR)}.obj:: $(CPP) $(CPP_PROJ) $< "$(INTDIR)\jmagick.obj" : .\jmagick.c "$(INTDIR)\magick_DrawInfo.obj" : .\magick_DrawInfo.c "$(INTDIR)\magick_ImageInfo.obj" : .\magick_ImageInfo.c "$(INTDIR)\magick_Magick.obj" : .\magick_Magick.c "$(INTDIR)\magick_MagickImage.obj" : .\magick_MagickImage.c "$(INTDIR)\magick_MagickInfo.obj" : .\magick_MagickInfo.c "$(INTDIR)\magick_MontageInfo.obj" : .\magick_MontageInfo.c "$(INTDIR)\magick_PixelPacket.obj" : .\magick_PixelPacket.c "$(INTDIR)\magick_QuantizeInfo.obj" : .\magick_QuantizeInfo.c CLEAN : -@erase "$(INTDIR)\jmagick.obj" -@erase "$(INTDIR)\magick_DrawInfo.obj" -@erase "$(INTDIR)\magick_ImageInfo.obj" -@erase "$(INTDIR)\magick_MagickImage.obj" -@erase "$(INTDIR)\magick_MagickInfo.obj" -@erase "$(INTDIR)\magick_MontageInfo.obj" -@erase "$(INTDIR)\magick_Magick.obj" -@erase "$(INTDIR)\magick_PixelPacket.obj" -@erase "$(INTDIR)\magick_QuantizeInfo.obj" -@erase "$(INTDIR)\vc60.idb" -@erase "$(OUTDIR)\jmagick.dll" -@erase "$(OUTDIR)\jmagick.exp" -@erase "$(OUTDIR)\jmagick.lib" techblue-jmagick-b4412af/win32/Makefile.all000066400000000000000000000161221452765401600205020ustar00rootroot00000000000000# # -- See update notes below --> # # This makefile only compiles the C files and the generated # jni stub and headrer files and produces a DLL. # # # Hint: To be placed in .../src and invoked from there, # nmake -f Makefile.all # From the Visual Studio .NET 2003 Command Prompt: # copy Makefile.all ..\src # cd ..\src # nmake -f Makefile.all # # Author: IT # Date: Oct 2000 # $Id: Makefile.all,v 1.3 2007/02/12 07:22:06 ttey Exp $ # # -- Updated for Win32 instance, EMXOREN Apr 09, 2002 --> # -- For runtime convenience copy '*.dll', '*.jar' as necessary. # -- Copy the 'jmagick.dll' to MAGICK_HOME (e.g. 'MAGICBIN' below). # -- Copy the 'jmagick.jar' to JRE's 'lib/ext'. # -- Just always rebuilt ALL, it's fast and somewhat fixed anyway! # -- Run 'javac', 'jar', 'javah' respectively prior to 'cl', 'link'. # -- Disabled warnings as it was kind of noisy. # -- Setup VC++ environment "path" for 'cl', 'link' and 'lib'. # -- Created manually 'obj\magick', 'lib' place holders. # -- Created manually 'classes', 'generated', 'docs' place holders. # changed by Sava Slijepcevic # # Author: KLS # Date: Jan 2007 # $Id: Makefile.all,v 1.3 2007/02/12 07:22:06 ttey Exp $ # # Updated Makefile for Visual Studio .NET 2003, JDK1.6 (Java 6), and # added missing targets from the current JMagick. JMagick is also # rumored to be buildable using gcc/MinGW, but this Makefile does not # target that compiler; instead I suppose you use MSYS or Cygwin and # the configure script. # # # Author: Jacob Nordfalk # Date: Feb 2008 # # Added comments and mkdir commands to make sure make doesent fail # becaurse of missing intermediary or output directories. # added invocation of Manifest Tool (mt.exe) and javac -target 1.5 CPP=cl.exe LINK32=link.exe # The C compiler #CPPINC=c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Include #CPPLIB=c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Lib CPPINC=C:\Program Files\Microsoft Visual Studio 8\VC\include CPPLIB=C:\Program Files\Microsoft Visual Studio 8\VC\Lib OUTDIR=..\lib INTDIR=..\obj\magick SRCDIR=..\src\magick GENDIR=..\generated CLSDIR=..\classes DOCDIR=..\doc # File places for Java: JDKDIR=C:\Program Files\Java\jdk1.6.0_01 JNIINC=$(JDKDIR)\include JDKBIN=$(JDKDIR)\bin # File places for standard ImageMagick: MAGICKDIR=C:\Program Files\ImageMagick-6.3.6-Q8 MAGICKINC=$(MAGICKDIR) MAGICKLIB=$(MAGICKDIR)\lib\CORE_RL_magick_.lib MAGICKINCDIR=$(MAGICKDIR)\include # If you compile IM yourself this might be better #MAGICKDIR=C:\Jacob\IM\c_kompilering\beta\bin #MAGICKINC=C:\Jacob\IM\c_kompilering\beta\ImageMagick #MAGICKLIB=C:\Jacob\IM\c_kompilering\beta\lib\CORE_RL_magick_.lib #MAGICKINCDIR=$(MAGICKDIR) # The jmagick.jar file will be installed here: JREEXT=$(JDKDIR)\lib\ext #JREEXT=$(MAGICKDIR) # The jmagick.dll file will be installed here: MAGICKBIN=$(MAGICKDIR) # Debugging, no optimizing and stack checks are required. # It hangs otherwise (re: IT) !? CPP_FLAGS= \ # /nologo /MTd /w /GX /Od /Ge /Fo"$(INTDIR)\\" /c \ /nologo /MD /w /GX /Od /Ge /Fo"$(INTDIR)\\" /c \ /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" \ /D "JMAGICK_EXPORTS" /D "_VISUALC_" /I "$(CPPINC)" \ /I "$(JNIINC)" /I "$(JNIINC)/win32" /I "$(MAGICKINC)" \ /I "$(GENDIR)" /I "$(SRCDIR)" /I "$(MAGICKINCDIR)" LINK32_FLAGS= \ "$(MAGICKLIB)" \ # /nologo /dll /incremental:no /machine:I386 \ /nologo /dll /incremental:no /machine:x86 \ /libpath:"$(CPPLIB)" \ /out:"$(OUTDIR)\jmagick.dll" \ /implib:"$(OUTDIR)\jmagick.lib" LINK32_OBJS= \ "$(INTDIR)\jmagick.obj" \ "$(INTDIR)\magick_Magick.obj" \ "$(INTDIR)\magick_MontageInfo.obj" \ "$(INTDIR)\magick_DrawInfo.obj" \ "$(INTDIR)\magick_ImageInfo.obj" \ "$(INTDIR)\magick_MagickImage.obj" \ "$(INTDIR)\magick_MagickInfo.obj" \ "$(INTDIR)\magick_PixelPacket.obj" \ "$(INTDIR)\magick_QuantizeInfo.obj" LINK32_OBJSD="$(INTDIR)\jmagick.obj" \ "$(INTDIR)\Magick_DrawInfo.obj" \ "$(INTDIR)\Magick_ImageInfo.obj" \ "$(INTDIR)\Magick_MagickImage.obj" \ "$(INTDIR)\Magick_MagickInfo.obj" \ "$(INTDIR)\Magick_MontageInfo.obj" \ "$(INTDIR)\Magick_Magick.obj" \ "$(INTDIR)\Magick_PixelPacket.obj" \ "$(INTDIR)\Magick_QuantizeInfo.obj" ALL : CLEAN BUILD BUILD : DIRS CLASSES DOCS HEADERS \ "$(OUTDIR)\jmagick.dll" "$(MAGICKBIN))\jmagick.dll" jmagick.obj: "$(SRCDIR)\jmagick.c" $(CPP) $(CPP_PROJ) $? magick_DrawInfo.obj: "$(SRCDIR)\magick_DrawInfo.c" $(CPP) $(CPP_PROJ) $? magick_ImageInfo.obj: "$(SRCDIR)\magick_ImageInfo.c" $(CPP) $(CPP_PROJ) $? magick_Magick.obj: "$(SRCDIR)\magick_Magick.c" $(CPP) $(CPP_PROJ) $? magick_MagickImage.obj: "$(SRCDIR)\magick_MagickImage.c" $(CPP) $(CPP_PROJ) $? magick_MagickInfo.obj: "$(SRCDIR)\magick_MagickInfo.c" $(CPP) $(CPP_PROJ) $? magick_MontageInfo.obj: "$(SRCDIR)\magick_MontageInfo.c" $(CPP) $(CPP_PROJ) $? magick_PixelPacket.obj: "$(SRCDIR)\magick_PixelPacket.c" $(CPP) $(CPP_PROJ) $? magick_QuantizeInfo.obj: "$(SRCDIR)\magick_QuantizeInfo.c" $(CPP) $(CPP_PROJ) $? "$(MAGICKBIN))\jmagick.dll" : "$(OUTDIR)\jmagick.dll" copy $(?) "$(MAGICKBIN)" "$(OUTDIR)\jmagick.dll" : $(LINK32_OBJS) $(LINK32) $(LINK32_FLAGS) $(LINK32_OBJSD) mt.exe -manifest $@.manifest -outputresource:$@;2 {$(SRCDIR)}.c{$(INTDIR)}.obj:: $(CPP) $(CPP_FLAGS) $< CLEAN : -@erase "$(INTDIR)\jmagick.obj" -@erase "$(INTDIR)\magick_Magick.obj" -@erase "$(INTDIR)\magick_MontageInfo.obj" -@erase "$(INTDIR)\magick_DrawInfo.obj" -@erase "$(INTDIR)\magick_ImageInfo.obj" -@erase "$(INTDIR)\magick_MagickImage.obj" -@erase "$(INTDIR)\magick_PixelPacket.obj" -@erase "$(INTDIR)\magick_QuantizeInfo.obj" -@erase "$(OUTDIR)\jmagick.dll" -@erase "$(OUTDIR)\jmagick.exp" -@erase "$(OUTDIR)\jmagick.lib" # The following items are always rebuilt ... DIRS : -mkdir "$(OUTDIR)" -mkdir "$(INTDIR)" -mkdir "$(GENDIR)" -mkdir "$(DOCDIR)" HEADERS : $(GENDIR) "$(JDKBIN)\javah" -d $(GENDIR) -classpath $(CLSDIR) -jni magick.Magick "$(JDKBIN)\javah" -d $(GENDIR) -classpath $(CLSDIR) -jni magick.DrawInfo "$(JDKBIN)\javah" -d $(GENDIR) -classpath $(CLSDIR) -jni magick.ImageInfo "$(JDKBIN)\javah" -d $(GENDIR) -classpath $(CLSDIR) -jni magick.MagickImage "$(JDKBIN)\javah" -d $(GENDIR) -classpath $(CLSDIR) -jni magick.MagickInfo "$(JDKBIN)\javah" -d $(GENDIR) -classpath $(CLSDIR) -jni magick.MontageInfo "$(JDKBIN)\javah" -d $(GENDIR) -classpath $(CLSDIR) -jni magick.PixelPacket "$(JDKBIN)\javah" -d $(GENDIR) -classpath $(CLSDIR) -jni magick.QuantizeInfo CLASSES : $(SRCDIR)\*.java $(SRCDIR)\util\*.java "$(JDKBIN)\javac" -target 1.5 -d $(CLSDIR) -classpath $(SRCDIR) -sourcepath $(SRCDIR) $(?) "$(JDKBIN)\jar" -cvf $(OUTDIR)/jmagick.jar -C $(CLSDIR) magick copy "$(OUTDIR)\jmagick.jar" "$(JREEXT)" DOCS : $(DOCDIR) "$(JDKBIN)\javadoc" -author -version -d $(DOCDIR) \ -sourcepath $(SRCDIR)/.. magick magick.util techblue-jmagick-b4412af/win32/README000066400000000000000000000006031452765401600171500ustar00rootroot00000000000000Makefiles for Windows ~~~~~~~~~~~~~~~~~~~~~ Makefile.VC++ was originally contributed by Ibrahim Tannir. Makefile.all was contributed by David Oren. It was later modified by Sava Slijepcevic. These files are not currently being actively maintained. Should you need to make any modifications to it while compiling JMagick, please send a copy of the changes to the JMagick mailing list.