From 16372b846c2bf8f4e25bb6747882a1f35c0370d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 19:11:47 +0100 Subject: [PATCH 001/179] added class body --- .../commons/imaging/ImagingParameters.java | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 src/main/java/org/apache/commons/imaging/ImagingParameters.java diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java new file mode 100644 index 0000000000..1bdb28243e --- /dev/null +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Created 2015 by Michael Gross, mgmechanics@mgmechanics.de + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de + */ + +package org.apache.commons.imaging; + +import org.apache.commons.imaging.common.BufferedImageFactory; + +/** + * This class is a POJO holding data for parameters as requested in IMAGING-159. + * It implements lazy initialization:
+ * After getting an instance there is no value present until you set one using + * one the setter methods. Until a value is set, isPresentX() will return + * {@code false}. If you try to access the value you will get an RuntimeException. + *

+ * After a value is set isPresentX() will return true and you may access the value. + * You can unset any value using unsetX(). Then you got the same state as before + * a value for this parameter was set. + */ +public class ImagingParameters { + + private Boolean verbose; + + private Boolean strict; + + private String fileNameForReading; + + private String xmpXmlAsString; + + private ImageFormat imageFormat; + + private BufferedImageFactory bufferedImageFactory; + + private PixelDensity pixelDensity; + + /** + * This gives you a parameter object without values. + */ + public ImagingParameters() { + this.verbose = null; + this.strict = null; + this.fileNameForReading = null; + this.xmpXmlAsString = null; + this.imageFormat = null; + this.bufferedImageFactory = null; + this.pixelDensity = null; + } + + + + + /** + * Throws a RuntimeException if the value for this parameter isn't set yet. + * @param value + */ + private void checkIfParameterWasSet(final Object value) { + if (value == null) { + throw new IllegalStateException("You tried to get a value which is not present."); + } + } +} From 217abfac3e6b907e22d62d943439b1d354301909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 19:25:50 +0100 Subject: [PATCH 002/179] finished work for parameter verbose only (meant as example) --- .../commons/imaging/ImagingParameters.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 1bdb28243e..fa4b61ec45 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -62,8 +62,50 @@ public ImagingParameters() { this.pixelDensity = null; } + /** + * Parameter key. Applies to read and write operations. + * @return {@code true} if there is a value present, {@false} else. + */ + public boolean isVerboseIsPresent() { + return this.verbose == null; + } + /** + * Parameter key. Applies to read and write operations. + * @return Valid values: Boolean.TRUE and Boolean.FALSE. + */ + public Boolean isVerbose() { + Boolean value = this.verbose; + checkIfParameterWasSet(value); + return value; + } + /** + * Parameter key. Applies to read and write operations. + * @param value Valid values: Boolean.TRUE and Boolean.FALSE. + */ + public void setVerbose(final Boolean value) { + checkIfValueIsNull(value); + this.verbose = value; + } + + /** + * Parameter key. Applies to read and write operations. + */ + public void unsetVerbose() { + this.verbose = null; + } + + + /** + * Throws a RuntimeException if a given value is {code null}. + * @param value + */ + private void checkIfValueIsNull(final Object value) { + if (value == null) { + throw new IllegalArgumentException("The value for any parameter must not null."); + } + } /** * Throws a RuntimeException if the value for this parameter isn't set yet. From ddd20521a6960ed869efb7ea44e7af70528e870c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 19:44:34 +0100 Subject: [PATCH 003/179] added code for strict-parameter; corrected verbose-pm regarding a default value --- .../commons/imaging/ImagingParameters.java | 61 ++++++++++++++----- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index fa4b61ec45..85633da166 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -24,7 +24,7 @@ /** * This class is a POJO holding data for parameters as requested in IMAGING-159. - * It implements lazy initialization:
+ * It implements lazy initialization for some values:
* After getting an instance there is no value present until you set one using * one the setter methods. Until a value is set, isPresentX() will return * {@code false}. If you try to access the value you will get an RuntimeException. @@ -32,6 +32,8 @@ * After a value is set isPresentX() will return true and you may access the value. * You can unset any value using unsetX(). Then you got the same state as before * a value for this parameter was set. + *

Other values have a default value, see the particular javadoc. + * For these values there is a resetX() method which restores the default value. */ public class ImagingParameters { @@ -51,10 +53,13 @@ public class ImagingParameters { /** * This gives you a parameter object without values. + *

+ * Some values got default values:
+ * verbose (Boolean.FALSE), strict */ public ImagingParameters() { - this.verbose = null; - this.strict = null; + this.verbose = Boolean.FALSE; + this.strict = Boolean.FALSE; this.fileNameForReading = null; this.xmpXmlAsString = null; this.imageFormat = null; @@ -62,22 +67,15 @@ public ImagingParameters() { this.pixelDensity = null; } - /** - * Parameter key. Applies to read and write operations. - * @return {@code true} if there is a value present, {@false} else. - */ - public boolean isVerboseIsPresent() { - return this.verbose == null; - } - + //****** verbose ****** /** * Parameter key. Applies to read and write operations. + *

+ * This one comes with a default value: Boolean.FALSE. * @return Valid values: Boolean.TRUE and Boolean.FALSE. */ public Boolean isVerbose() { - Boolean value = this.verbose; - checkIfParameterWasSet(value); - return value; + return this.verbose; } /** @@ -92,8 +90,39 @@ public void setVerbose(final Boolean value) { /** * Parameter key. Applies to read and write operations. */ - public void unsetVerbose() { - this.verbose = null; + public void resetVerbose() { + this.verbose = Boolean.FALSE; + } + + //****** strict ****** + + /** + * Parameter key. Indicates whether to throw exceptions when parsing invalid + * files, or whether to tolerate small problems. + *

+ * This one comes with a default value: Boolean.FALSE. + * @return Valid values: Boolean.TRUE and Boolean.FALSE. Default value: + * Boolean.FALSE. + * @see org.apache.commons.imaging.formats.tiff.constants.TiffConstants + */ + public Boolean isStrict() { + return this.strict; + } + + /** + * Parameter key. Applies to read and write operations. + * @param value Valid values: Boolean.TRUE and Boolean.FALSE. + */ + public void setStrict(final Boolean value) { + checkIfValueIsNull(value); + this.strict = value; + } + + /** + * Parameter key. Applies to read and write operations. + */ + public void resetStrict() { + this.strict = Boolean.FALSE; } From 584c46b8074fbf9ea47751f7b937c1f457f23e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 19:58:24 +0100 Subject: [PATCH 004/179] added code for fileName-parameter; corrected javadoc for verbose-parameter --- .../commons/imaging/ImagingParameters.java | 69 +++++++++++++++++-- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 85633da166..46ac257442 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -30,10 +30,10 @@ * {@code false}. If you try to access the value you will get an RuntimeException. *

* After a value is set isPresentX() will return true and you may access the value. - * You can unset any value using unsetX(). Then you got the same state as before + * You can reset any value using resetX(). Then you got the same state as before * a value for this parameter was set. *

Other values have a default value, see the particular javadoc. - * For these values there is a resetX() method which restores the default value. + * For these values the resetX() method restores the default value. */ public class ImagingParameters { @@ -89,6 +89,7 @@ public void setVerbose(final Boolean value) { /** * Parameter key. Applies to read and write operations. + * Reset this parameter to it's default value (Boolean.FALSE). */ public void resetVerbose() { this.verbose = Boolean.FALSE; @@ -110,7 +111,8 @@ public Boolean isStrict() { } /** - * Parameter key. Applies to read and write operations. + * Parameter key. Indicates whether to throw exceptions when parsing invalid + * files, or whether to tolerate small problems. * @param value Valid values: Boolean.TRUE and Boolean.FALSE. */ public void setStrict(final Boolean value) { @@ -119,12 +121,69 @@ public void setStrict(final Boolean value) { } /** - * Parameter key. Applies to read and write operations. + * Parameter key. Indicates whether to throw exceptions when parsing invalid + * files, or whether to tolerate small problems. + * Reset this parameter to it's default value (Boolean.FALSE). */ public void resetStrict() { this.strict = Boolean.FALSE; } + //****** fileNameForReading ****** + + /** + * Parameter key. Used to hint the filename when reading from a byte array + * or InputStream. The filename hint can help disambiguate what file the + * image format. + *

+ * Applies to read operations. + * @return {@code true} if there is a value present, {@false} else. + */ + public boolean isFileNameForReadingPresent() { + return this.fileNameForReading == null; + } + + /** + * Parameter key. Used to hint the filename when reading from a byte array + * or InputStream. The filename hint can help disambiguate what file the + * image format. + *

+ * Applies to read operations. + * @return Valid values: filename as string + * @see java.io.InputStream + */ + public String getFileNameForReading() { + String value = this.fileNameForReading; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter key. Used to hint the filename when reading from a byte array + * or InputStream. The filename hint can help disambiguate what file the + * image format. + *

+ * Applies to read operations. + * @param value Valid values: filename as string + * @see java.io.InputStream + */ + public void setFileNameForReading(final String value) { + checkIfValueIsNull(value); + this.fileNameForReading = value; + } + + /** + * Parameter key. Used to hint the filename when reading from a byte array + * or InputStream. The filename hint can help disambiguate what file the + * image format. + *

+ * Applies to read operations. + *

Resets the parameter to the default state (value not present) + */ + public void resetFileNameForReading() { + this.fileNameForReading = null; + } + /** * Throws a RuntimeException if a given value is {code null}. @@ -140,7 +199,7 @@ private void checkIfValueIsNull(final Object value) { * Throws a RuntimeException if the value for this parameter isn't set yet. * @param value */ - private void checkIfParameterWasSet(final Object value) { + private void checkIfParameterIsPresent(final Object value) { if (value == null) { throw new IllegalStateException("You tried to get a value which is not present."); } From 1edd229d65cbc5bfa2839d9ea7602e7ec0100afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 20:06:12 +0100 Subject: [PATCH 005/179] added code for PARAM_KEY_XMP_XML --- .../commons/imaging/ImagingParameters.java | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 46ac257442..30b4af1583 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -178,12 +178,58 @@ public void setFileNameForReading(final String value) { * image format. *

* Applies to read operations. - *

Resets the parameter to the default state (value not present) + *

+ * Resets the parameter to the default state (value not present) */ public void resetFileNameForReading() { this.fileNameForReading = null; } + //****** xmpXmlAsString ****** + + /** + * Parameter key. + * + * Only used when writing images. Valid values: String of XMP XML. + * @return {@code true} if there is a value present, {@false} else. + */ + public boolean isXmpXmlAsStringPresent() { + return this.xmpXmlAsString == null; + } + + /** + * Parameter key. + * + * Only used when writing images. + * @return Valid values: String of XMP XML. + */ + public String getXmpXmlAsString() { + String value = this.xmpXmlAsString; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter key. + * + * Only used when writing images. + * @param value Valid values: String of XMP XML. + */ + public void setXmpXmlAsString(final String value) { + checkIfValueIsNull(value); + this.xmpXmlAsString = value; + } + + /** + * Parameter key. + * + * Only used when writing images. Valid values: String of XMP XML. + *

+ * Resets the parameter to the default state (value not present) + */ + public void resetXmpXmlAsString() { + this.xmpXmlAsString = null; + } /** * Throws a RuntimeException if a given value is {code null}. From b215e4b6f13fd091e18bc3c91332033a4da2e59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 20:42:45 +0100 Subject: [PATCH 006/179] corrected javadoc --- .../commons/imaging/ImagingParameters.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 30b4af1583..7f541b6d20 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -69,7 +69,7 @@ public ImagingParameters() { //****** verbose ****** /** - * Parameter key. Applies to read and write operations. + * Parameter applies to read and write operations. *

* This one comes with a default value: Boolean.FALSE. * @return Valid values: Boolean.TRUE and Boolean.FALSE. @@ -79,7 +79,7 @@ public Boolean isVerbose() { } /** - * Parameter key. Applies to read and write operations. + * Parameter applies to read and write operations. * @param value Valid values: Boolean.TRUE and Boolean.FALSE. */ public void setVerbose(final Boolean value) { @@ -88,7 +88,7 @@ public void setVerbose(final Boolean value) { } /** - * Parameter key. Applies to read and write operations. + * Parameter applies to read and write operations. * Reset this parameter to it's default value (Boolean.FALSE). */ public void resetVerbose() { @@ -98,7 +98,7 @@ public void resetVerbose() { //****** strict ****** /** - * Parameter key. Indicates whether to throw exceptions when parsing invalid + * Parameter indicates whether to throw exceptions when parsing invalid * files, or whether to tolerate small problems. *

* This one comes with a default value: Boolean.FALSE. @@ -111,7 +111,7 @@ public Boolean isStrict() { } /** - * Parameter key. Indicates whether to throw exceptions when parsing invalid + * Parameter indicates whether to throw exceptions when parsing invalid * files, or whether to tolerate small problems. * @param value Valid values: Boolean.TRUE and Boolean.FALSE. */ @@ -121,7 +121,7 @@ public void setStrict(final Boolean value) { } /** - * Parameter key. Indicates whether to throw exceptions when parsing invalid + * Parameter indicates whether to throw exceptions when parsing invalid * files, or whether to tolerate small problems. * Reset this parameter to it's default value (Boolean.FALSE). */ @@ -132,7 +132,7 @@ public void resetStrict() { //****** fileNameForReading ****** /** - * Parameter key. Used to hint the filename when reading from a byte array + * Parameter used to hint the filename when reading from a byte array * or InputStream. The filename hint can help disambiguate what file the * image format. *

@@ -144,7 +144,7 @@ public boolean isFileNameForReadingPresent() { } /** - * Parameter key. Used to hint the filename when reading from a byte array + * Parameter used to hint the filename when reading from a byte array * or InputStream. The filename hint can help disambiguate what file the * image format. *

@@ -159,7 +159,7 @@ public String getFileNameForReading() { } /** - * Parameter key. Used to hint the filename when reading from a byte array + * Parameter used to hint the filename when reading from a byte array * or InputStream. The filename hint can help disambiguate what file the * image format. *

@@ -173,7 +173,7 @@ public void setFileNameForReading(final String value) { } /** - * Parameter key. Used to hint the filename when reading from a byte array + * Parameter used to hint the filename when reading from a byte array * or InputStream. The filename hint can help disambiguate what file the * image format. *

From 13a14d3159138b46b38e8feea6429a7c570751af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 20:46:16 +0100 Subject: [PATCH 007/179] added code for PARAM_KEY_FORMAT --- .../commons/imaging/ImagingParameters.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 7f541b6d20..23ac88f6c4 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -231,6 +231,48 @@ public void resetXmpXmlAsString() { this.xmpXmlAsString = null; } + //****** imageFormat ****** + + /** + * Parameter used in write operations to indicate desired image format. + * @return {@code true} if there is a value present, {@false} else. + */ + public boolean isImageFormatPresent() { + return this.imageFormat == null; + } + + /** + * Parameter used in write operations to indicate desired image format. + * @return Valid values: Any format defined in ImageFormat, such as + * ImageFormat.IMAGE_FORMAT_PNG. + */ + public ImageFormat getImageFormat() { + ImageFormat value = this.imageFormat; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter used in write operations to indicate desired image format. + * @param value Valid values: Any format defined in ImageFormat, such as + * ImageFormat.IMAGE_FORMAT_PNG. + */ + public void setImageFormat(final ImageFormat value) { + checkIfValueIsNull(value); + this.imageFormat = value; + } + + /** + * Parameter used in write operations to indicate desired image format. + *

+ * Resets the parameter to the default state (value not present) + */ + public void resetImageFormat() { + this.imageFormat = null; + } + + //****** check methods ****** + /** * Throws a RuntimeException if a given value is {code null}. * @param value From b8b1aef55d825e1164f3ef144ed9fd57bb2c0bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 20:52:09 +0100 Subject: [PATCH 008/179] added code for BUFFERED_IMAGE_FACTORY --- .../commons/imaging/ImagingParameters.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 23ac88f6c4..835817b111 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -271,6 +271,44 @@ public void resetImageFormat() { this.imageFormat = null; } + //****** bufferedImageFactory ****** + + /** + * + * @return {@code true} if there is a value present, {@false} else. + */ + public boolean isBufferedImageFactoryPresent() { + return this.bufferedImageFactory == null; + } + + /** + * + * @return A BufferedImageFactory + */ + public BufferedImageFactory getBufferedImageFactory() { + BufferedImageFactory value = this.bufferedImageFactory; + checkIfParameterIsPresent(value); + return value; + } + + /** + * + * @param value A BufferedImageFactory + */ + public void setBufferedImageFactory(final BufferedImageFactory value) { + checkIfValueIsNull(value); + this.bufferedImageFactory = value; + } + + /** + * + *

+ * Resets the parameter to the default state (value not present) + */ + public void resetBufferedImageFactory() { + this.bufferedImageFactory = null; + } + //****** check methods ****** /** From 07f98aa11d93f2859894e80f92c34baa017660c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 21:01:09 +0100 Subject: [PATCH 009/179] PARAM_KEY_PIXEL_DENSITY --- .../commons/imaging/ImagingParameters.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 835817b111..7b71852aab 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -309,6 +309,52 @@ public void resetBufferedImageFactory() { this.bufferedImageFactory = null; } + //****** pixelDensity ****** + + /** + * Parameter key. Used in write operations to indicate the desired pixel + * density (DPI), and/or aspect ratio. + * @return {@code true} if there is a value present, {@false} else. + * @see org.apache.commons.imaging.PixelDensity + */ + public boolean isPixelDensityPresent() { + return this.pixelDensity == null; + } + + /** + * Parameter key. Used in write operations to indicate the desired pixel + * density (DPI), and/or aspect ratio. + * @return Valid values: PixelDensity + * @see org.apache.commons.imaging.PixelDensity + */ + public PixelDensity getPixelDensity() { + PixelDensity value = this.pixelDensity; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter key. Used in write operations to indicate the desired pixel + * density (DPI), and/or aspect ratio. + * @param value Valid values: PixelDensity + * @see org.apache.commons.imaging.PixelDensity + */ + public void setPixelDensity(final PixelDensity value) { + checkIfValueIsNull(value); + this.pixelDensity = value; + } + + /** + * Parameter key. Used in write operations to indicate the desired pixel + * density (DPI), and/or aspect ratio. + *

+ * Resets the parameter to the default state (value not present) + * @see org.apache.commons.imaging.PixelDensity + */ + public void resetPixelDensity() { + this.pixelDensity = null; + } + //****** check methods ****** /** From 6957d076d06b5fd5151f13f22127ccc485044d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 21:13:21 +0100 Subject: [PATCH 010/179] corrected javadoc --- .../org/apache/commons/imaging/ImagingParameters.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 7b71852aab..3bfaf52a2c 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -24,6 +24,9 @@ /** * This class is a POJO holding data for parameters as requested in IMAGING-159. + * It holds data needed for all image formats. For data needed only by one + * particular format there are inherited classes. + *

* It implements lazy initialization for some values:
* After getting an instance there is no value present until you set one using * one the setter methods. Until a value is set, isPresentX() will return @@ -52,10 +55,7 @@ public class ImagingParameters { private PixelDensity pixelDensity; /** - * This gives you a parameter object without values. - *

- * Some values got default values:
- * verbose (Boolean.FALSE), strict + * This gives you a parameter object with default values. */ public ImagingParameters() { this.verbose = Boolean.FALSE; From 56e9fd1c6a95caa518e030d882bf7db4fda3fe21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 21:16:37 +0100 Subject: [PATCH 011/179] let inherit check methods --- .../commons/imaging/ImagingParameters.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 3bfaf52a2c..14c456d807 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -40,7 +40,7 @@ */ public class ImagingParameters { - private Boolean verbose; + private Boolean readThumbnails; private Boolean strict; @@ -58,7 +58,7 @@ public class ImagingParameters { * This gives you a parameter object with default values. */ public ImagingParameters() { - this.verbose = Boolean.FALSE; + this.readThumbnails = Boolean.FALSE; this.strict = Boolean.FALSE; this.fileNameForReading = null; this.xmpXmlAsString = null; @@ -67,7 +67,7 @@ public ImagingParameters() { this.pixelDensity = null; } - //****** verbose ****** + //****** readThumbnails ****** /** * Parameter applies to read and write operations. *

@@ -75,7 +75,7 @@ public ImagingParameters() { * @return Valid values: Boolean.TRUE and Boolean.FALSE. */ public Boolean isVerbose() { - return this.verbose; + return this.readThumbnails; } /** @@ -84,7 +84,7 @@ public Boolean isVerbose() { */ public void setVerbose(final Boolean value) { checkIfValueIsNull(value); - this.verbose = value; + this.readThumbnails = value; } /** @@ -92,7 +92,7 @@ public void setVerbose(final Boolean value) { * Reset this parameter to it's default value (Boolean.FALSE). */ public void resetVerbose() { - this.verbose = Boolean.FALSE; + this.readThumbnails = Boolean.FALSE; } //****** strict ****** @@ -361,7 +361,7 @@ public void resetPixelDensity() { * Throws a RuntimeException if a given value is {code null}. * @param value */ - private void checkIfValueIsNull(final Object value) { + final void checkIfValueIsNull(final Object value) { if (value == null) { throw new IllegalArgumentException("The value for any parameter must not null."); } @@ -371,7 +371,7 @@ private void checkIfValueIsNull(final Object value) { * Throws a RuntimeException if the value for this parameter isn't set yet. * @param value */ - private void checkIfParameterIsPresent(final Object value) { + final void checkIfParameterIsPresent(final Object value) { if (value == null) { throw new IllegalStateException("You tried to get a value which is not present."); } From 90377fff78d515dcc1401073b8718dbb8454f941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 21:20:22 +0100 Subject: [PATCH 012/179] added parameters for JPEG/JFIF --- .../imaging/ImagingParametersJpeg.java | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java new file mode 100644 index 0000000000..0838d37a5d --- /dev/null +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Created 2015 by Michael Gross, mgmechanics@mgmechanics.de + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de + */ + +package org.apache.commons.imaging; + +/** + * This class is a POJO holding data for parameters as requested in IMAGING-159. + * It holds additional data needed for the JPEG/JFIF format only. + */ +public final class ImagingParametersJpeg extends ImagingParameters { + + private Boolean readThumbnailsValue; + + /** + * This gives you a parameter object without values. + *

+ * Some values got default values:
+ * verbose (Boolean.FALSE), strict + */ + public ImagingParametersJpeg() { + this.readThumbnailsValue = Boolean.FALSE; + } + + //****** verbose ****** + /** + * Parameter key. Indicates whether to read embedded thumbnails. + *

+ * Only applies to read EXIF metadata from JPEG/JFIF files. + * @return Valid values: Boolean.TRUE and Boolean.FALSE. + */ + public Boolean readThumbnails() { + return this.readThumbnailsValue; + } + + /** + * Parameter key. Indicates whether to read embedded thumbnails. + *

+ * Only applies to read EXIF metadata from JPEG/JFIF files. + * @param value Valid values: Boolean.TRUE and Boolean.FALSE. + */ + public void setReadThumbnails(final Boolean value) { + checkIfValueIsNull(value); + this.readThumbnailsValue = value; + } + + /** + * Parameter key. Indicates whether to read embedded thumbnails. + *

+ * Only applies to read EXIF metadata from JPEG/JFIF files. + *

+ * Reset this parameter to it's default value (Boolean.FALSE). + */ + public void resetReadThumbnails() { + this.readThumbnailsValue = Boolean.FALSE; + } +} From b7d5ce17b44f85081aeb57b6f12f48c46352eb80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 21:27:48 +0100 Subject: [PATCH 013/179] corrected javadoc --- .../org/apache/commons/imaging/ImagingParametersJpeg.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index 0838d37a5d..dc5cf28058 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -29,10 +29,7 @@ public final class ImagingParametersJpeg extends ImagingParameters { private Boolean readThumbnailsValue; /** - * This gives you a parameter object without values. - *

- * Some values got default values:
- * verbose (Boolean.FALSE), strict + * This gives you a parameter object with default values. */ public ImagingParametersJpeg() { this.readThumbnailsValue = Boolean.FALSE; From e4ca4025884cc8befcb1e13dd7ee51ac93ab6e29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 21:28:15 +0100 Subject: [PATCH 014/179] corrected javadoc --- .../java/org/apache/commons/imaging/ImagingParametersJpeg.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index dc5cf28058..09a1324eb2 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -35,7 +35,7 @@ public ImagingParametersJpeg() { this.readThumbnailsValue = Boolean.FALSE; } - //****** verbose ****** + //****** readThumbnails ****** /** * Parameter key. Indicates whether to read embedded thumbnails. *

From ff70685ece53ee04c882caa19efded15b5728689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 21:36:35 +0100 Subject: [PATCH 015/179] doc --- .../java/org/apache/commons/imaging/ImagingParametersJpeg.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index 09a1324eb2..c8b3771efc 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -26,7 +26,7 @@ */ public final class ImagingParametersJpeg extends ImagingParameters { - private Boolean readThumbnailsValue; + private Boolean readThumbnailsValue; // PARAM_KEY_READ_THUMBNAILS /** * This gives you a parameter object with default values. From a5da7bdb904282d5ebe53bf62cedc6eaea66f749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 21:38:23 +0100 Subject: [PATCH 016/179] added parameters for TIFF --- .../imaging/ImagingParametersTiff.java | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java new file mode 100644 index 0000000000..d1c92e5ad6 --- /dev/null +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -0,0 +1,150 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Created 2015 by Michael Gross, mgmechanics@mgmechanics.de + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de + */ + +package org.apache.commons.imaging; + +import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet; + +/** + * This class is a POJO holding data for parameters as requested in IMAGING-159. + * It holds additional data needed for the TIFF format only. + */ +public final class ImagingParametersTiff extends ImagingParameters { + + private Integer tiffCompressionLevel; // PARAM_KEY_COMPRESSION + + private TiffOutputSet tiffOutputSetForMetaData; // PARAM_KEY_EXIF + + /** + * This gives you a parameter object with default values. + */ + public ImagingParametersTiff() { + this.tiffCompressionLevel = null; + this.tiffOutputSetForMetaData = null; + } + + //****** tiffCompressionLevel ****** + + /** + * Parameter used in write operations to indicate desired compression + * algorithm. + *

+ * Currently only applies to writing TIFF image files. + * @return {@code true} if there is a value present, {@false} else. + */ + public boolean isTiffCompressionLevelPresent() { + return this.tiffCompressionLevel == null; + } + + /** + * Parameter used in write operations to indicate desired compression + * algorithm. + *

+ * Currently only applies to writing TIFF image files. + * @return Valid values: + * TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED, + * TiffConstants.TIFF_COMPRESSION_CCITT_1D, + * TiffConstants.TIFF_COMPRESSION_LZW, + * TiffConstants.TIFF_COMPRESSION_PACKBITS + */ + public Integer getTiffCompressionLevel() { + Integer value = this.tiffCompressionLevel; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter used in write operations to indicate desired compression + * algorithm. + *

+ * Currently only applies to writing TIFF image files. + * @param value Valid values: + * TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED, + * TiffConstants.TIFF_COMPRESSION_CCITT_1D, + * TiffConstants.TIFF_COMPRESSION_LZW, + * TiffConstants.TIFF_COMPRESSION_PACKBITS + */ + public void setTiffCompressionLevel(final Integer value) { + checkIfValueIsNull(value); + this.tiffCompressionLevel = value; + } + + /** + * Parameter used in write operations to indicate desired compression + * algorithm. + *

+ * Currently only applies to writing TIFF image files. + *

+ * Resets the parameter to the default state (value not present) + */ + public void resetTiffCompressionLevel() { + this.tiffCompressionLevel = null; + } + + //****** tiffOutputSetForMetaData ****** + + /** + * Parameter key. + * + * Only used when writing images. + *

+ * Valid values: TiffOutputSet to write into the image's EXIF metadata. + * @return {@code true} if there is a value present, {@false} else. + */ + public boolean isTiffOutputSetPresent() { + return this.tiffOutputSetForMetaData == null; + } + + /** + * Parameter key. + * + * Only used when writing images. + * @return Valid values: TiffOutputSet to write into the image's EXIF metadata. + */ + public TiffOutputSet getTiffOutputSet() { + TiffOutputSet value = this.tiffOutputSetForMetaData; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter key. + * + * Only used when writing images. + * @param value Valid values: TiffOutputSet to write into the image's EXIF metadata. + */ + public void setTiffOutputSet(final TiffOutputSet value) { + checkIfValueIsNull(value); + this.tiffOutputSetForMetaData = value; + } + + /** + * Parameter key. + * + * Only used when writing images. + *

+ * Valid values: TiffOutputSet to write into the image's EXIF metadata. + *

+ * Resets the parameter to the default state (value not present) + */ + public void resetTiffOutputSet() { + this.tiffOutputSetForMetaData = null; + } +} From 9f54d060834bdfe5480c149f1bcf8f4c7b24f62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 30 Jan 2015 21:50:28 +0100 Subject: [PATCH 017/179] doc --- src/main/java/org/apache/commons/imaging/ImagingParameters.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 14c456d807..f001b9932a 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -67,7 +67,7 @@ public ImagingParameters() { this.pixelDensity = null; } - //****** readThumbnails ****** + //****** verbose ****** /** * Parameter applies to read and write operations. *

From 418985091bdb4ff27751f3a0a5de6b6d74f28a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 31 Jan 2015 21:51:32 +0100 Subject: [PATCH 018/179] set default value for tiff compression --- .../commons/imaging/ImagingParametersTiff.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index d1c92e5ad6..95396c9f08 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -20,6 +20,7 @@ package org.apache.commons.imaging; +import org.apache.commons.imaging.formats.tiff.constants.TiffConstants; import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet; /** @@ -36,23 +37,12 @@ public final class ImagingParametersTiff extends ImagingParameters { * This gives you a parameter object with default values. */ public ImagingParametersTiff() { - this.tiffCompressionLevel = null; + this.tiffCompressionLevel = TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED; this.tiffOutputSetForMetaData = null; } //****** tiffCompressionLevel ****** - /** - * Parameter used in write operations to indicate desired compression - * algorithm. - *

- * Currently only applies to writing TIFF image files. - * @return {@code true} if there is a value present, {@false} else. - */ - public boolean isTiffCompressionLevelPresent() { - return this.tiffCompressionLevel == null; - } - /** * Parameter used in write operations to indicate desired compression * algorithm. @@ -95,7 +85,7 @@ public void setTiffCompressionLevel(final Integer value) { * Resets the parameter to the default state (value not present) */ public void resetTiffCompressionLevel() { - this.tiffCompressionLevel = null; + this.tiffCompressionLevel = TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED; } //****** tiffOutputSetForMetaData ****** From cc6ac0f4ceed604329eb32cb2a83a912823ab474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 31 Jan 2015 21:53:10 +0100 Subject: [PATCH 019/179] must have renamed verbose accidentally - corrected --- .../org/apache/commons/imaging/ImagingParameters.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index f001b9932a..3bc42aeaac 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -40,7 +40,7 @@ */ public class ImagingParameters { - private Boolean readThumbnails; + private Boolean verbose; private Boolean strict; @@ -58,7 +58,7 @@ public class ImagingParameters { * This gives you a parameter object with default values. */ public ImagingParameters() { - this.readThumbnails = Boolean.FALSE; + this.verbose = Boolean.FALSE; this.strict = Boolean.FALSE; this.fileNameForReading = null; this.xmpXmlAsString = null; @@ -75,7 +75,7 @@ public ImagingParameters() { * @return Valid values: Boolean.TRUE and Boolean.FALSE. */ public Boolean isVerbose() { - return this.readThumbnails; + return this.verbose; } /** @@ -84,7 +84,7 @@ public Boolean isVerbose() { */ public void setVerbose(final Boolean value) { checkIfValueIsNull(value); - this.readThumbnails = value; + this.verbose = value; } /** @@ -92,7 +92,7 @@ public void setVerbose(final Boolean value) { * Reset this parameter to it's default value (Boolean.FALSE). */ public void resetVerbose() { - this.readThumbnails = Boolean.FALSE; + this.verbose = Boolean.FALSE; } //****** strict ****** From 39b9e670d559ce8d6acbc34fff4c4c41cffb5585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 31 Jan 2015 21:59:38 +0100 Subject: [PATCH 020/179] provided class variables for default values --- .../org/apache/commons/imaging/ImagingParameters.java | 11 +++++++---- .../apache/commons/imaging/ImagingParametersTiff.java | 5 +++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 3bc42aeaac..b0b2436c9d 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -41,8 +41,11 @@ public class ImagingParameters { private Boolean verbose; + // default value for vebose - is set after initialization and resetVerbose() + private final Boolean verboseDefault = Boolean.FALSE; private Boolean strict; + private final Boolean strictDefault = Boolean.FALSE; private String fileNameForReading; @@ -58,8 +61,8 @@ public class ImagingParameters { * This gives you a parameter object with default values. */ public ImagingParameters() { - this.verbose = Boolean.FALSE; - this.strict = Boolean.FALSE; + this.verbose = verboseDefault; + this.strict = strictDefault; this.fileNameForReading = null; this.xmpXmlAsString = null; this.imageFormat = null; @@ -92,7 +95,7 @@ public void setVerbose(final Boolean value) { * Reset this parameter to it's default value (Boolean.FALSE). */ public void resetVerbose() { - this.verbose = Boolean.FALSE; + this.verbose = verboseDefault; } //****** strict ****** @@ -126,7 +129,7 @@ public void setStrict(final Boolean value) { * Reset this parameter to it's default value (Boolean.FALSE). */ public void resetStrict() { - this.strict = Boolean.FALSE; + this.strict = strictDefault; } //****** fileNameForReading ****** diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 95396c9f08..3606af8b90 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -30,6 +30,7 @@ public final class ImagingParametersTiff extends ImagingParameters { private Integer tiffCompressionLevel; // PARAM_KEY_COMPRESSION + private final Integer tiffCompressionLevelDefault = TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED; private TiffOutputSet tiffOutputSetForMetaData; // PARAM_KEY_EXIF @@ -37,7 +38,7 @@ public final class ImagingParametersTiff extends ImagingParameters { * This gives you a parameter object with default values. */ public ImagingParametersTiff() { - this.tiffCompressionLevel = TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED; + this.tiffCompressionLevel = tiffCompressionLevelDefault; this.tiffOutputSetForMetaData = null; } @@ -85,7 +86,7 @@ public void setTiffCompressionLevel(final Integer value) { * Resets the parameter to the default state (value not present) */ public void resetTiffCompressionLevel() { - this.tiffCompressionLevel = TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED; + this.tiffCompressionLevel = tiffCompressionLevelDefault; } //****** tiffOutputSetForMetaData ****** From 386c381d034648648b21b3d91262a4b96df320c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 1 Feb 2015 20:49:17 +0100 Subject: [PATCH 021/179] boolean parameters can be set via business methods --- .../commons/imaging/ImagingParameters.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index b0b2436c9d..b3a3f75fc3 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -83,16 +83,15 @@ public Boolean isVerbose() { /** * Parameter applies to read and write operations. - * @param value Valid values: Boolean.TRUE and Boolean.FALSE. + * This method sets the verbose mode. */ - public void setVerbose(final Boolean value) { - checkIfValueIsNull(value); - this.verbose = value; + public void setVerbose() { + this.verbose = Boolean.TRUE; } /** * Parameter applies to read and write operations. - * Reset this parameter to it's default value (Boolean.FALSE). + * This method removes the verbose mode. */ public void resetVerbose() { this.verbose = verboseDefault; @@ -116,17 +115,17 @@ public Boolean isStrict() { /** * Parameter indicates whether to throw exceptions when parsing invalid * files, or whether to tolerate small problems. - * @param value Valid values: Boolean.TRUE and Boolean.FALSE. + * This method switches the behavior so that it tolerates small problems. */ - public void setStrict(final Boolean value) { - checkIfValueIsNull(value); - this.strict = value; + public void setStrict() { + this.strict = Boolean.TRUE; } /** * Parameter indicates whether to throw exceptions when parsing invalid * files, or whether to tolerate small problems. - * Reset this parameter to it's default value (Boolean.FALSE). + * This method switches the behavior so that it throws exceptions when + * parsing invalid files. */ public void resetStrict() { this.strict = strictDefault; From 38f4b8205dbc538766a31fef30f6a672ecbac9a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 2 Feb 2015 21:02:04 +0100 Subject: [PATCH 022/179] typo --- src/main/java/org/apache/commons/imaging/ImagingParameters.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index b3a3f75fc3..962288aee2 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -41,7 +41,7 @@ public class ImagingParameters { private Boolean verbose; - // default value for vebose - is set after initialization and resetVerbose() + // default value for verbose - is set after initialization and resetVerbose() private final Boolean verboseDefault = Boolean.FALSE; private Boolean strict; From cff75edadc3d2a0d8e41c1ae2f642957796d7042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 2 Feb 2015 21:04:48 +0100 Subject: [PATCH 023/179] doc --- .../apache/commons/imaging/ImagingParameters.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 962288aee2..3e6a0cdf29 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -42,20 +42,20 @@ public class ImagingParameters { private Boolean verbose; // default value for verbose - is set after initialization and resetVerbose() - private final Boolean verboseDefault = Boolean.FALSE; + private final Boolean verboseDefault = Boolean.FALSE; //PARAM_KEY_VERBOSE private Boolean strict; - private final Boolean strictDefault = Boolean.FALSE; + private final Boolean strictDefault = Boolean.FALSE; // PARAM_KEY_STRICT - private String fileNameForReading; + private String fileNameForReading; // PARAM_KEY_FILENAME - private String xmpXmlAsString; + private String xmpXmlAsString; // PARAM_KEY_XMP_XML - private ImageFormat imageFormat; + private ImageFormat imageFormat; // PARAM_KEY_FORMAT - private BufferedImageFactory bufferedImageFactory; + private BufferedImageFactory bufferedImageFactory; // BUFFERED_IMAGE_FACTORY - private PixelDensity pixelDensity; + private PixelDensity pixelDensity; // PARAM_KEY_PIXEL_DENSITY /** * This gives you a parameter object with default values. From 4712719519f21cb576f09fbd6800912e53c27007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Tue, 3 Feb 2015 05:15:46 +0100 Subject: [PATCH 024/179] fixed boolean parameters (enable/disable) --- .../commons/imaging/ImagingParameters.java | 63 ++++++++++--------- .../imaging/ImagingParametersJpeg.java | 19 +++--- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 3e6a0cdf29..7dd73daf60 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -27,25 +27,22 @@ * It holds data needed for all image formats. For data needed only by one * particular format there are inherited classes. *

- * It implements lazy initialization for some values:
+ * There are two kinds of parameters: with and without default value. For + * parameters without default value it implements lazy initialization: + *
* After getting an instance there is no value present until you set one using - * one the setter methods. Until a value is set, isPresentX() will return - * {@code false}. If you try to access the value you will get an RuntimeException. + * one the setter methods. Until a value is set, isXPresent() will return + * {@code false}. Accessing the value with getX() in this state will cause a RuntimeException. + * After a value is set with setX() isXPresent() will return {@code true} and you may access the value. *

- * After a value is set isPresentX() will return true and you may access the value. - * You can reset any value using resetX(). Then you got the same state as before - * a value for this parameter was set. - *

Other values have a default value, see the particular javadoc. - * For these values the resetX() method restores the default value. + * Other parameters have a default value. This is told in the javadoc for their + * getX() method. They don't have a isXPresent() method. You may access them any time. */ public class ImagingParameters { - private Boolean verbose; - // default value for verbose - is set after initialization and resetVerbose() - private final Boolean verboseDefault = Boolean.FALSE; //PARAM_KEY_VERBOSE + private Boolean verbose; //PARAM_KEY_VERBOSE - private Boolean strict; - private final Boolean strictDefault = Boolean.FALSE; // PARAM_KEY_STRICT + private Boolean strict; // PARAM_KEY_STRICT private String fileNameForReading; // PARAM_KEY_FILENAME @@ -61,8 +58,8 @@ public class ImagingParameters { * This gives you a parameter object with default values. */ public ImagingParameters() { - this.verbose = verboseDefault; - this.strict = strictDefault; + this.verbose = Boolean.FALSE; + this.strict = Boolean.FALSE; this.fileNameForReading = null; this.xmpXmlAsString = null; this.imageFormat = null; @@ -72,29 +69,32 @@ public ImagingParameters() { //****** verbose ****** /** + * Turns the verbose mode on/off. + *

* Parameter applies to read and write operations. *

- * This one comes with a default value: Boolean.FALSE. - * @return Valid values: Boolean.TRUE and Boolean.FALSE. + * Default value: verbose mode disabled. + * @return Valid values: {@code Boolean.TRUE} means {@literal "verbose mode enabled"} + * and {@code Boolean.FALSE} means {@literal "verbose mode disabled"}. */ public Boolean isVerbose() { return this.verbose; } /** + * Turns the verbose mode on. * Parameter applies to read and write operations. - * This method sets the verbose mode. */ - public void setVerbose() { + public void enableVerbose() { this.verbose = Boolean.TRUE; } /** + * Turns the verbose mode off. * Parameter applies to read and write operations. - * This method removes the verbose mode. */ - public void resetVerbose() { - this.verbose = verboseDefault; + public void disableVerbose() { + this.verbose = Boolean.FALSE; } //****** strict ****** @@ -103,9 +103,9 @@ public void resetVerbose() { * Parameter indicates whether to throw exceptions when parsing invalid * files, or whether to tolerate small problems. *

- * This one comes with a default value: Boolean.FALSE. - * @return Valid values: Boolean.TRUE and Boolean.FALSE. Default value: - * Boolean.FALSE. + * Default value: tolerate small problems. + * @return Valid values: {@code Boolean.TRUE} causes it to throw exceptions + * when parsing invalid files and {@code Boolean.FALSE} let it tolerate small problems. * @see org.apache.commons.imaging.formats.tiff.constants.TiffConstants */ public Boolean isStrict() { @@ -115,20 +115,21 @@ public Boolean isStrict() { /** * Parameter indicates whether to throw exceptions when parsing invalid * files, or whether to tolerate small problems. - * This method switches the behavior so that it tolerates small problems. + * This method switches the behavior so that it throws exceptions when + * parsing invalid files. */ - public void setStrict() { + public void enableStrict() { this.strict = Boolean.TRUE; } /** * Parameter indicates whether to throw exceptions when parsing invalid * files, or whether to tolerate small problems. - * This method switches the behavior so that it throws exceptions when - * parsing invalid files. + * This method switches the behavior so that it tolerates small problems. + * */ - public void resetStrict() { - this.strict = strictDefault; + public void disableStrict() { + this.strict = Boolean.FALSE; } //****** fileNameForReading ****** diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index c8b3771efc..422bfce15e 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -40,31 +40,30 @@ public ImagingParametersJpeg() { * Parameter key. Indicates whether to read embedded thumbnails. *

* Only applies to read EXIF metadata from JPEG/JFIF files. - * @return Valid values: Boolean.TRUE and Boolean.FALSE. + *

+ * Default value: don't read embedded thumbnails + * @return Valid values:{@code Boolean.TRUE} (causes it to read embedded thumbnails + * and {@code Boolean.FALSE} (don't read embedded thumbnails). */ public Boolean readThumbnails() { return this.readThumbnailsValue; } /** - * Parameter key. Indicates whether to read embedded thumbnails. + * Parameter key. Indicates to read embedded thumbnails. *

* Only applies to read EXIF metadata from JPEG/JFIF files. - * @param value Valid values: Boolean.TRUE and Boolean.FALSE. */ - public void setReadThumbnails(final Boolean value) { - checkIfValueIsNull(value); - this.readThumbnailsValue = value; + public void enableReadThumbnails() { + this.readThumbnailsValue = Boolean.TRUE; } /** - * Parameter key. Indicates whether to read embedded thumbnails. + * Parameter key. Indicates not to read embedded thumbnails. *

* Only applies to read EXIF metadata from JPEG/JFIF files. - *

- * Reset this parameter to it's default value (Boolean.FALSE). */ - public void resetReadThumbnails() { + public void disableReadThumbnails() { this.readThumbnailsValue = Boolean.FALSE; } } From 2c3d9cad0e7bd90b3c18b14f5f2e63fed3563bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Tue, 3 Feb 2015 05:23:23 +0100 Subject: [PATCH 025/179] removed resetX() methods --- .../commons/imaging/ImagingParameters.java | 55 +------------------ .../imaging/ImagingParametersTiff.java | 25 --------- 2 files changed, 1 insertion(+), 79 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 7dd73daf60..e4322507a4 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -174,20 +174,7 @@ public void setFileNameForReading(final String value) { checkIfValueIsNull(value); this.fileNameForReading = value; } - - /** - * Parameter used to hint the filename when reading from a byte array - * or InputStream. The filename hint can help disambiguate what file the - * image format. - *

- * Applies to read operations. - *

- * Resets the parameter to the default state (value not present) - */ - public void resetFileNameForReading() { - this.fileNameForReading = null; - } - + //****** xmpXmlAsString ****** /** @@ -223,17 +210,6 @@ public void setXmpXmlAsString(final String value) { this.xmpXmlAsString = value; } - /** - * Parameter key. - * - * Only used when writing images. Valid values: String of XMP XML. - *

- * Resets the parameter to the default state (value not present) - */ - public void resetXmpXmlAsString() { - this.xmpXmlAsString = null; - } - //****** imageFormat ****** /** @@ -265,15 +241,6 @@ public void setImageFormat(final ImageFormat value) { this.imageFormat = value; } - /** - * Parameter used in write operations to indicate desired image format. - *

- * Resets the parameter to the default state (value not present) - */ - public void resetImageFormat() { - this.imageFormat = null; - } - //****** bufferedImageFactory ****** /** @@ -303,15 +270,6 @@ public void setBufferedImageFactory(final BufferedImageFactory value) { this.bufferedImageFactory = value; } - /** - * - *

- * Resets the parameter to the default state (value not present) - */ - public void resetBufferedImageFactory() { - this.bufferedImageFactory = null; - } - //****** pixelDensity ****** /** @@ -347,17 +305,6 @@ public void setPixelDensity(final PixelDensity value) { this.pixelDensity = value; } - /** - * Parameter key. Used in write operations to indicate the desired pixel - * density (DPI), and/or aspect ratio. - *

- * Resets the parameter to the default state (value not present) - * @see org.apache.commons.imaging.PixelDensity - */ - public void resetPixelDensity() { - this.pixelDensity = null; - } - //****** check methods ****** /** diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 3606af8b90..c1a0499ec7 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -77,18 +77,6 @@ public void setTiffCompressionLevel(final Integer value) { this.tiffCompressionLevel = value; } - /** - * Parameter used in write operations to indicate desired compression - * algorithm. - *

- * Currently only applies to writing TIFF image files. - *

- * Resets the parameter to the default state (value not present) - */ - public void resetTiffCompressionLevel() { - this.tiffCompressionLevel = tiffCompressionLevelDefault; - } - //****** tiffOutputSetForMetaData ****** /** @@ -125,17 +113,4 @@ public void setTiffOutputSet(final TiffOutputSet value) { checkIfValueIsNull(value); this.tiffOutputSetForMetaData = value; } - - /** - * Parameter key. - * - * Only used when writing images. - *

- * Valid values: TiffOutputSet to write into the image's EXIF metadata. - *

- * Resets the parameter to the default state (value not present) - */ - public void resetTiffOutputSet() { - this.tiffOutputSetForMetaData = null; - } } From 8ff6d0df59e566d52dc6d07fceed9a29b11b1f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Tue, 3 Feb 2015 05:30:45 +0100 Subject: [PATCH 026/179] doc --- .../org/apache/commons/imaging/ImagingParametersTiff.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index c1a0499ec7..a96b8e7528 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -30,6 +30,9 @@ public final class ImagingParametersTiff extends ImagingParameters { private Integer tiffCompressionLevel; // PARAM_KEY_COMPRESSION + // This is the default value used for the parameter above. + // If you need to change the default value for this parameter, do it here. + // Please remember to change the javadoc also. private final Integer tiffCompressionLevelDefault = TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED; private TiffOutputSet tiffOutputSetForMetaData; // PARAM_KEY_EXIF @@ -49,6 +52,8 @@ public ImagingParametersTiff() { * algorithm. *

* Currently only applies to writing TIFF image files. + *

+ * Default value: TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED * @return Valid values: * TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED, * TiffConstants.TIFF_COMPRESSION_CCITT_1D, From ba7b7be30af525e1b78fa0e72426ced89c720f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 6 Feb 2015 21:06:20 +0100 Subject: [PATCH 027/179] renamed parameter fileNameHint --- .../commons/imaging/ImagingParameters.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index e4322507a4..d0718d9ca4 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -44,7 +44,7 @@ public class ImagingParameters { private Boolean strict; // PARAM_KEY_STRICT - private String fileNameForReading; // PARAM_KEY_FILENAME + private String fileNameHint; // PARAM_KEY_FILENAME private String xmpXmlAsString; // PARAM_KEY_XMP_XML @@ -60,7 +60,7 @@ public class ImagingParameters { public ImagingParameters() { this.verbose = Boolean.FALSE; this.strict = Boolean.FALSE; - this.fileNameForReading = null; + this.fileNameHint = null; this.xmpXmlAsString = null; this.imageFormat = null; this.bufferedImageFactory = null; @@ -132,7 +132,7 @@ public void disableStrict() { this.strict = Boolean.FALSE; } - //****** fileNameForReading ****** + //****** fileNameHint ****** /** * Parameter used to hint the filename when reading from a byte array @@ -142,8 +142,8 @@ public void disableStrict() { * Applies to read operations. * @return {@code true} if there is a value present, {@false} else. */ - public boolean isFileNameForReadingPresent() { - return this.fileNameForReading == null; + public boolean isFileNameHintPresent() { + return this.fileNameHint == null; } /** @@ -155,8 +155,8 @@ public boolean isFileNameForReadingPresent() { * @return Valid values: filename as string * @see java.io.InputStream */ - public String getFileNameForReading() { - String value = this.fileNameForReading; + public String getFileNameHint() { + String value = this.fileNameHint; checkIfParameterIsPresent(value); return value; } @@ -170,9 +170,9 @@ public String getFileNameForReading() { * @param value Valid values: filename as string * @see java.io.InputStream */ - public void setFileNameForReading(final String value) { + public void setFileNameHint(final String value) { checkIfValueIsNull(value); - this.fileNameForReading = value; + this.fileNameHint = value; } //****** xmpXmlAsString ****** From f3605d389e0d907c55d84c1edcd57ab892f2fc72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 6 Feb 2015 22:14:46 +0100 Subject: [PATCH 028/179] Replaced parameter Map by ImagingParameters --- .../apache/commons/imaging/ImageParser.java | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImageParser.java b/src/main/java/org/apache/commons/imaging/ImageParser.java index c3a061fba7..be625960de 100644 --- a/src/main/java/org/apache/commons/imaging/ImageParser.java +++ b/src/main/java/org/apache/commons/imaging/ImageParser.java @@ -169,7 +169,7 @@ public final ImageMetadata getMetadata(final ByteSource byteSource) throws Image * implementation. * @throws IOException In the event of unsuccessful data read operation. */ - public abstract ImageMetadata getMetadata(ByteSource byteSource, Map params) + public abstract ImageMetadata getMetadata(ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException; /** @@ -215,7 +215,7 @@ public final ImageMetadata getMetadata(final byte[] bytes) throws ImageReadExcep * parser implementation. * @throws IOException In the event of unsuccessful data read operation. */ - public final ImageMetadata getMetadata(final byte[] bytes, final Map params) + public final ImageMetadata getMetadata(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { return getMetadata(new ByteSourceArray(bytes), params); } @@ -264,7 +264,7 @@ public final ImageMetadata getMetadata(final File file) throws ImageReadExceptio * @throws IOException In the event of unsuccessful file read or * access operation. */ - public final ImageMetadata getMetadata(final File file, final Map params) + public final ImageMetadata getMetadata(final File file, final ImagingParameters params) throws ImageReadException, IOException { if (getDebug()) { System.out.println(getName() + ".getMetadata" + ": " @@ -302,7 +302,7 @@ public final ImageMetadata getMetadata(final File file, final Map params) + public abstract ImageInfo getImageInfo(ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException; /** @@ -348,7 +348,7 @@ public final ImageInfo getImageInfo(final ByteSource byteSource) throws ImageRea * @throws IOException In the event of unsuccessful data * access operation. */ - public final ImageInfo getImageInfo(final byte[] bytes, final Map params) + public final ImageInfo getImageInfo(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { return getImageInfo(new ByteSourceArray(bytes), params); } @@ -377,7 +377,7 @@ public final ImageInfo getImageInfo(final byte[] bytes, final Map params) + public final ImageInfo getImageInfo(final File file, final ImagingParameters params) throws ImageReadException, IOException { if (!canAcceptExtension(file)) { return null; @@ -505,7 +505,7 @@ public final List getAllBufferedImages(final File file) throws Im * parser implementation. * @throws IOException In the event of unsuccessful read or access operation. */ - public abstract BufferedImage getBufferedImage(ByteSource byteSource, Map params) + public abstract BufferedImage getBufferedImage(ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException; /** @@ -523,7 +523,7 @@ public abstract BufferedImage getBufferedImage(ByteSource byteSource, Map params) + public final BufferedImage getBufferedImage(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { return getBufferedImage(new ByteSourceArray(bytes), params); } @@ -543,7 +543,7 @@ public final BufferedImage getBufferedImage(final byte[] bytes, final Map params) + public final BufferedImage getBufferedImage(final File file, final ImagingParameters params) throws ImageReadException, IOException { if (!canAcceptExtension(file)) { return null; @@ -575,7 +575,7 @@ public final BufferedImage getBufferedImage(final File file, final Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { os.close(); // we are obligated to close stream. @@ -609,7 +609,7 @@ public final Dimension getImageSize(final byte[] bytes) throws ImageReadExceptio * parser implementation. * @throws IOException In the event of unsuccessful read or access operation. */ - public final Dimension getImageSize(final byte[] bytes, final Map params) + public final Dimension getImageSize(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { return getImageSize(new ByteSourceArray(bytes), params); } @@ -640,7 +640,7 @@ public final Dimension getImageSize(final File file) throws ImageReadException, * parser implementation. * @throws IOException In the event of unsuccessful read or access operation. */ - public final Dimension getImageSize(final File file, final Map params) + public final Dimension getImageSize(final File file, final ImagingParameters params) throws ImageReadException, IOException { if (!canAcceptExtension(file)) { @@ -662,7 +662,7 @@ public final Dimension getImageSize(final File file, final Map p * parser implementation. * @throws IOException In the event of unsuccessful read or access operation. */ - public abstract Dimension getImageSize(ByteSource byteSource, Map params) + public abstract Dimension getImageSize(ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException; /** @@ -682,7 +682,7 @@ public abstract Dimension getImageSize(ByteSource byteSource, Map params) + public abstract String getXmpXml(ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException; /** @@ -715,7 +715,7 @@ public final byte[] getICCProfileBytes(final byte[] bytes) throws ImageReadExcep * parser implementation. * @throws IOException In the event of unsuccessful read or access operation. */ - public final byte[] getICCProfileBytes(final byte[] bytes, final Map params) + public final byte[] getICCProfileBytes(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { return getICCProfileBytes(new ByteSourceArray(bytes), params); } @@ -750,7 +750,7 @@ public final byte[] getICCProfileBytes(final File file) throws ImageReadExceptio * parser implementation. * @throws IOException In the event of unsuccessful read or access operation. */ - public final byte[] getICCProfileBytes(final File file, final Map params) + public final byte[] getICCProfileBytes(final File file, final ImagingParameters params) throws ImageReadException, IOException { if (!canAcceptExtension(file)) { return null; @@ -777,7 +777,7 @@ public final byte[] getICCProfileBytes(final File file, final Map params) + public abstract byte[] getICCProfileBytes(ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException; /** @@ -954,13 +954,12 @@ protected final boolean canAcceptExtension(final String filename) { * @param params A valid Map object, or a null. * @return A valid instance of an implementation of a IBufferedImageFactory. */ - protected BufferedImageFactory getBufferedImageFactory(final Map params) { + protected BufferedImageFactory getBufferedImageFactory(final ImagingParameters params) { if (params == null) { return new SimpleBufferedImageFactory(); } - final BufferedImageFactory result = (BufferedImageFactory) params - .get(ImagingConstants.BUFFERED_IMAGE_FACTORY); + final BufferedImageFactory result = params.getBufferedImageFactory(); if (null != result) { return result; @@ -970,19 +969,18 @@ protected BufferedImageFactory getBufferedImageFactory(final Map } /** - * A utility method to search a params specification and determine - * whether it contains the ImagingConstants.PARAM_KEY_STRICT - * specification. Intended - * for internal use by ImageParser implementations. + * A utility method to whether we have a parameter object and if the STRICT + * flag is set or not. + * Intended for internal use by ImageParser implementations. * - * @param params A valid Map object (or a null). + * @param params A valid parameter object (or a null). * @return If the params specify strict format compliance, true; * otherwise, false. */ - public static boolean isStrict(final Map params) { - if (params == null || !params.containsKey(ImagingConstants.PARAM_KEY_STRICT)) { + public static boolean isStrict(final ImagingParameters params) { + if (params == null) { return false; } - return ((Boolean) params.get(ImagingConstants.PARAM_KEY_STRICT)).booleanValue(); + return params.isStrict(); } } From 95f01b617ccb0925b8d4febf75a7035a3388eb2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 6 Feb 2015 22:15:11 +0100 Subject: [PATCH 029/179] fixed missing param tag --- src/main/java/org/apache/commons/imaging/ImageParser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/apache/commons/imaging/ImageParser.java b/src/main/java/org/apache/commons/imaging/ImageParser.java index be625960de..582b1b4ee9 100644 --- a/src/main/java/org/apache/commons/imaging/ImageParser.java +++ b/src/main/java/org/apache/commons/imaging/ImageParser.java @@ -846,6 +846,7 @@ public final String dumpImageFile(final ByteSource byteSource) * Write the ImageInfo and format-specific information for the image * content of the specified byte source to a PrintWriter * + * @param pw * @param byteSource A valid byte source. * @return A valid PrintWriter. * @throws ImageReadException In the event that the the specified content From 9bf64f377eb2082cc7364e00fcdc968d170989d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 6 Feb 2015 22:16:16 +0100 Subject: [PATCH 030/179] removed unused import --- src/main/java/org/apache/commons/imaging/ImageParser.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImageParser.java b/src/main/java/org/apache/commons/imaging/ImageParser.java index 582b1b4ee9..5ea2616766 100644 --- a/src/main/java/org/apache/commons/imaging/ImageParser.java +++ b/src/main/java/org/apache/commons/imaging/ImageParser.java @@ -26,7 +26,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; -import java.util.Map; import org.apache.commons.imaging.common.BinaryFileParser; import org.apache.commons.imaging.common.BufferedImageFactory; From ab48433e69bd1fe555bf3228782bff2d0fe9e865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 6 Feb 2015 22:17:04 +0100 Subject: [PATCH 031/179] Replaced parameter Map by ImagingParameters --- .../org/apache/commons/imaging/Imaging.java | 158 +++++++++--------- 1 file changed, 78 insertions(+), 80 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/Imaging.java b/src/main/java/org/apache/commons/imaging/Imaging.java index e811888593..0c42ca3142 100644 --- a/src/main/java/org/apache/commons/imaging/Imaging.java +++ b/src/main/java/org/apache/commons/imaging/Imaging.java @@ -26,10 +26,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.HashMap; import java.util.List; import java.util.Locale; -import java.util.Map; import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.common.bytesource.ByteSource; @@ -40,8 +38,6 @@ import org.apache.commons.imaging.icc.IccProfileParser; import org.apache.commons.imaging.util.IoUtils; -import static org.apache.commons.imaging.ImagingConstants.*; - /** * The primary application programming interface (API) to the Imaging library. * @@ -92,11 +88,9 @@ *

* *

- * Optional parameters are specified using a Map object (typically, - * a Java HashMap) to specify a set of keys and values for input. - * The specification for support keys is provided by the ImagingConstants - * interface as well as by format-specific interfaces such as - * JpegContants or TiffConstants. + * Optional parameters are specified using a parameter object, ImagingParameters. + * This class is overridden by format-specific parameter object classes such as + * ImagingParametersJpeg or ImagingParametersTiff. *

* *

Example code

@@ -375,11 +369,11 @@ public static ICC_Profile getICCProfile(final byte[] bytes) * @param bytes * Byte array containing an image file. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. */ - public static ICC_Profile getICCProfile(final byte[] bytes, final Map params) + public static ICC_Profile getICCProfile(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { return getICCProfile(new ByteSourceArray(bytes), params); } @@ -411,12 +405,12 @@ public static ICC_Profile getICCProfile(final InputStream is, final String filen * @param filename * Filename associated with image data (optional). * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. */ public static ICC_Profile getICCProfile(final InputStream is, final String filename, - final Map params) throws ImageReadException, IOException { + final ImagingParameters params) throws ImageReadException, IOException { return getICCProfile(new ByteSourceInputStream(is, filename), params); } @@ -443,16 +437,16 @@ public static ICC_Profile getICCProfile(final File file) * @param file * File containing image data. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. */ - public static ICC_Profile getICCProfile(final File file, final Map params) + public static ICC_Profile getICCProfile(final File file, final ImagingParameters params) throws ImageReadException, IOException { return getICCProfile(new ByteSourceFile(file), params); } - protected static ICC_Profile getICCProfile(final ByteSource byteSource, final Map params) + protected static ICC_Profile getICCProfile(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final byte[] bytes = getICCProfileBytes(byteSource, params); if (bytes == null) { @@ -501,12 +495,12 @@ public static byte[] getICCProfileBytes(final byte[] bytes) * @param bytes * Byte array containing an image file. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return A byte array. * @see IccProfileParser * @see ICC_Profile */ - public static byte[] getICCProfileBytes(final byte[] bytes, final Map params) + public static byte[] getICCProfileBytes(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { return getICCProfileBytes(new ByteSourceArray(bytes), params); } @@ -541,17 +535,17 @@ public static byte[] getICCProfileBytes(final File file) * @param file * File containing image data. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return A byte array. * @see IccProfileParser * @see ICC_Profile */ - public static byte[] getICCProfileBytes(final File file, final Map params) + public static byte[] getICCProfileBytes(final File file, final ImagingParameters params) throws ImageReadException, IOException { return getICCProfileBytes(new ByteSourceFile(file), params); } - private static byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + private static byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final ImageParser imageParser = getImageParser(byteSource); @@ -572,12 +566,12 @@ private static byte[] getICCProfileBytes(final ByteSource byteSource, final Map< * @param bytes * Byte array containing an image file. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return An instance of ImageInfo. * @see ImageInfo */ public static ImageInfo getImageInfo(final String filename, final byte[] bytes, - final Map params) throws ImageReadException, IOException { + final ImagingParameters params) throws ImageReadException, IOException { return getImageInfo(new ByteSourceArray(filename, bytes), params); } @@ -637,12 +631,12 @@ public static ImageInfo getImageInfo(final InputStream is, final String filename * @param filename * Filename associated with image data (optional). * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return An instance of ImageInfo. * @see ImageInfo */ public static ImageInfo getImageInfo(final InputStream is, final String filename, - final Map params) throws ImageReadException, IOException { + final ImagingParameters params) throws ImageReadException, IOException { return getImageInfo(new ByteSourceInputStream(is, filename), params); } @@ -677,11 +671,11 @@ public static ImageInfo getImageInfo(final byte[] bytes) * @param bytes * Byte array containing an image file. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return An instance of ImageInfo. * @see ImageInfo */ - public static ImageInfo getImageInfo(final byte[] bytes, final Map params) + public static ImageInfo getImageInfo(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { return getImageInfo(new ByteSourceArray(bytes), params); } @@ -698,11 +692,11 @@ public static ImageInfo getImageInfo(final byte[] bytes, final Map params) + public static ImageInfo getImageInfo(final File file, final ImagingParameters params) throws ImageReadException, IOException { return getImageInfo(new ByteSourceFile(file), params); } @@ -726,7 +720,7 @@ public static ImageInfo getImageInfo(final File file) throws ImageReadException, return getImageInfo(file, null); } - private static ImageInfo getImageInfo(final ByteSource byteSource, final Map params) + private static ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final ImageParser imageParser = getImageParser(byteSource); @@ -785,11 +779,11 @@ public static Dimension getImageSize(final InputStream is, final String filename * @param filename * Filename associated with image data (optional). * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return The width and height of the image. */ public static Dimension getImageSize(final InputStream is, final String filename, - final Map params) throws ImageReadException, IOException { + final ImagingParameters params) throws ImageReadException, IOException { return getImageSize(new ByteSourceInputStream(is, filename), params); } @@ -813,10 +807,10 @@ public static Dimension getImageSize(final byte[] bytes) * @param bytes * Byte array containing an image file. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return The width and height of the image. */ - public static Dimension getImageSize(final byte[] bytes, final Map params) + public static Dimension getImageSize(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { return getImageSize(new ByteSourceArray(bytes), params); } @@ -841,15 +835,15 @@ public static Dimension getImageSize(final File file) throws ImageReadException, * @param file * File containing image data. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return The width and height of the image. */ - public static Dimension getImageSize(final File file, final Map params) + public static Dimension getImageSize(final File file, final ImagingParameters params) throws ImageReadException, IOException { return getImageSize(new ByteSourceFile(file), params); } - public static Dimension getImageSize(final ByteSource byteSource, final Map params) + public static Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final ImageParser imageParser = getImageParser(byteSource); @@ -880,10 +874,10 @@ public static String getXmpXml(final InputStream is, final String filename) * @param filename * Filename associated with image data (optional). * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return Xmp Xml as String, if present. Otherwise, returns null. */ - public static String getXmpXml(final InputStream is, final String filename, final Map params) + public static String getXmpXml(final InputStream is, final String filename, final ImagingParameters params) throws ImageReadException, IOException { return getXmpXml(new ByteSourceInputStream(is, filename), params); } @@ -908,10 +902,10 @@ public static String getXmpXml(final byte[] bytes) throws ImageReadException, * @param bytes * Byte array containing an image file. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return Xmp Xml as String, if present. Otherwise, returns null. */ - public static String getXmpXml(final byte[] bytes, final Map params) + public static String getXmpXml(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { return getXmpXml(new ByteSourceArray(bytes), params); } @@ -936,10 +930,10 @@ public static String getXmpXml(final File file) throws ImageReadException, * @param file * File containing image data. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return Xmp Xml as String, if present. Otherwise, returns null. */ - public static String getXmpXml(final File file, final Map params) + public static String getXmpXml(final File file, final ImagingParameters params) throws ImageReadException, IOException { return getXmpXml(new ByteSourceFile(file), params); } @@ -951,10 +945,10 @@ public static String getXmpXml(final File file, final Map params * @param byteSource * File containing image data. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return Xmp Xml as String, if present. Otherwise, returns null. */ - public static String getXmpXml(final ByteSource byteSource, final Map params) + public static String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final ImageParser imageParser = getImageParser(byteSource); @@ -1000,11 +994,11 @@ public static ImageMetadata getMetadata(final byte[] bytes) * @param bytes * Byte array containing an image file. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return An instance of IImageMetadata. * @see org.apache.commons.imaging.common.ImageMetadata */ - public static ImageMetadata getMetadata(final byte[] bytes, final Map params) + public static ImageMetadata getMetadata(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { return getMetadata(new ByteSourceArray(bytes), params); } @@ -1052,12 +1046,12 @@ public static ImageMetadata getMetadata(final InputStream is, final String filen * @param filename * Filename associated with image data (optional). * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return An instance of IImageMetadata. * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final InputStream is, final String filename, - final Map params) throws ImageReadException, IOException { + final ImagingParameters params) throws ImageReadException, IOException { return getMetadata(new ByteSourceInputStream(is, filename), params); } @@ -1100,16 +1094,16 @@ public static ImageMetadata getMetadata(final File file) * @param file * File containing image data. * @param params - * Map of optional parameters, defined in ImagingConstants. + * Optional parameters, defined in ImagingParameters. * @return An instance of IImageMetadata. * @see org.apache.commons.imaging.common.ImageMetadata */ - public static ImageMetadata getMetadata(final File file, final Map params) + public static ImageMetadata getMetadata(final File file, final ImagingParameters params) throws ImageReadException, IOException { return getMetadata(new ByteSourceFile(file), params); } - private static ImageMetadata getMetadata(final ByteSource byteSource, final Map params) + private static ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final ImageParser imageParser = getImageParser(byteSource); @@ -1274,8 +1268,8 @@ public static BufferedImage getBufferedImage(final InputStream is) /** * Reads the first image from an InputStream - * using data-processing options specified through a parameters - * map. Options may be configured using the ImagingContants + * using data-processing options specified through a parameter + * object. Options may be configured using the ImagingParameters * interface or the various format-specific implementations provided * by this package. *

@@ -1286,17 +1280,17 @@ public static BufferedImage getBufferedImage(final InputStream is) * image info, metadata and ICC profiles from all image formats that * provide this data. * @param is a valid ImageStream from which to read data. - * @param params an optional parameters map specifying options + * @param params an optional parameter object specifying options * @return if successful, a valid buffered image * @throws ImageReadException in the event of a processing error * while reading an image (i.e. a format violation, etc.). * @throws IOException in the event of an unrecoverable I/O exception. */ - public static BufferedImage getBufferedImage(final InputStream is, final Map params) + public static BufferedImage getBufferedImage(final InputStream is, final ImagingParameters params) throws ImageReadException, IOException { String filename = null; - if (params != null && params.containsKey(PARAM_KEY_FILENAME)) { - filename = (String) params.get(PARAM_KEY_FILENAME); + if (params != null && params.isFileNameHintPresent()) { + filename = params.getFileNameHint(); } return getBufferedImage(new ByteSourceInputStream(is, filename), params); } @@ -1342,7 +1336,7 @@ public static BufferedImage getBufferedImage(final byte[] bytes) * while reading an image (i.e. a format violation, etc.). * @throws IOException in the event of an unrecoverable I/O exception. */ - public static BufferedImage getBufferedImage(final byte[] bytes, final Map params) + public static BufferedImage getBufferedImage(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { return getBufferedImage(new ByteSourceArray(bytes), params); } @@ -1373,8 +1367,8 @@ public static BufferedImage getBufferedImage(final File file) /** * Reads the first image from a file - * using data-processing options specified through a parameters - * map. Options may be configured using the ImagingContants + * using data-processing options specified through a parameter + * object. Options may be configured using the ImagingParameters * interface or the various format-specific implementations provided * by this package. *

@@ -1385,12 +1379,13 @@ public static BufferedImage getBufferedImage(final File file) * image info, metadata and ICC profiles from all image formats that * provide this data. * @param file a valid reference to a file containing image data. + * @param params * @return if successful, a valid buffered image * @throws ImageReadException in the event of a processing error * while reading an image (i.e. a format violation, etc.). * @throws IOException in the event of an unrecoverable I/O exception. */ - public static BufferedImage getBufferedImage(final File file, final Map params) + public static BufferedImage getBufferedImage(final File file, final ImagingParameters params) throws ImageReadException, IOException { return getBufferedImage(new ByteSourceFile(file), params); } @@ -1398,20 +1393,22 @@ public static BufferedImage getBufferedImage(final File file, final Map params) throws ImageReadException, IOException { + final ImagingParameters params) throws ImageReadException, IOException { final ImageParser imageParser = getImageParser(byteSource); - if (null == params) { - params = new HashMap(); + + ImagingParameters parameters = params; + if (null == parameters) { + parameters = new ImagingParameters(); } - return imageParser.getBufferedImage(byteSource, params); + return imageParser.getBufferedImage(byteSource, parameters); } /** * Writes the content of a BufferedImage to a file using the specified * image format. Specifications for storing the file (such as data compression, * color models, metadata tags, etc.) may be specified using an optional - * parameters map. These specifications are defined in the ImagingConstants + * parameter object. These specifications are defined in the ImagingParameters * interface or in various format-specific implementations. *

* Image writing is not supported for all graphics formats. @@ -1428,10 +1425,10 @@ private static BufferedImage getBufferedImage(final ByteSource byteSource, * @throws ImageWriteException in the event of a format violation, * unsupported image format, etc. * @throws IOException in the event of an unrecoverable I/O exception. - * @see ImagingConstants + * @see ImagingParameters */ public static void writeImage(final BufferedImage src, final File file, - final ImageFormat format, final Map params) throws ImageWriteException, + final ImageFormat format, final ImagingParameters params) throws ImageWriteException, IOException { OutputStream os = null; boolean canThrow = false; @@ -1451,7 +1448,7 @@ public static void writeImage(final BufferedImage src, final File file, * Writes the content of a BufferedImage to a byte array using the specified * image format. Specifications for storing the file (such as data compression, * color models, metadata tags, etc.) may be specified using an optional - * parameters map. These specifications are defined in the ImagingConstants + * parameter object. These specifications are defined in the ImagingParameters * interface or in various format-specific implementations. *

* Image writing is not supported for all graphics formats. @@ -1468,10 +1465,10 @@ public static void writeImage(final BufferedImage src, final File file, * @throws ImageWriteException in the event of a format violation, * unsupported image format, etc. * @throws IOException in the event of an unrecoverable I/O exception. - * @see ImagingConstants + * @see ImagingParameters */ public static byte[] writeImageToBytes(final BufferedImage src, - final ImageFormat format, final Map params) throws ImageWriteException, + final ImageFormat format, final ImagingParameters params) throws ImageWriteException, IOException { final ByteArrayOutputStream os = new ByteArrayOutputStream(); @@ -1485,7 +1482,7 @@ public static byte[] writeImageToBytes(final BufferedImage src, * Writes the content of a BufferedImage to an OutputStream using the specified * image format. Specifications for storing the file (such as data compression, * color models, metadata tags, etc.) may be specified using an optional - * parameters map. These specifications are defined in the ImagingConstants + * parameter object. These specifications are defined in the ImagingParameters * interface or in various format-specific implementations. *

* Image writing is not supported for all graphics formats. @@ -1502,19 +1499,20 @@ public static byte[] writeImageToBytes(final BufferedImage src, * @throws ImageWriteException in the event of a format violation, * unsupported image format, etc. * @throws IOException in the event of an unrecoverable I/O exception. - * @see ImagingConstants + * @see ImagingParameters */ public static void writeImage(final BufferedImage src, final OutputStream os, - final ImageFormat format, Map params) throws ImageWriteException, + final ImageFormat format, final ImagingParameters params) throws ImageWriteException, IOException { final ImageParser[] imageParsers = ImageParser.getAllImageParsers(); - // make sure params are non-null - if (params == null) { - params = new HashMap(); + // make sure parameters are non-null + ImagingParameters parameters = params; + if (parameters == null) { + parameters = new ImagingParameters(); } - params.put(PARAM_KEY_FORMAT, format); + parameters.setImageFormat(format); ImageParser imageParser = null; for (final ImageParser imageParser2 : imageParsers) { @@ -1524,7 +1522,7 @@ public static void writeImage(final BufferedImage src, final OutputStream os, } } if (imageParser != null) { - imageParser.writeImage(src, os, params); + imageParser.writeImage(src, os, parameters); } else { throw new ImageWriteException("Unknown Format: " + format); } From 259ae2bd9ec7e1bc4a97def3cd382076364eecbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 6 Feb 2015 22:17:47 +0100 Subject: [PATCH 032/179] added missing param tag --- src/main/java/org/apache/commons/imaging/Imaging.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/Imaging.java b/src/main/java/org/apache/commons/imaging/Imaging.java index 0c42ca3142..0e1fd93c84 100644 --- a/src/main/java/org/apache/commons/imaging/Imaging.java +++ b/src/main/java/org/apache/commons/imaging/Imaging.java @@ -1190,6 +1190,9 @@ private static FormatCompliance getFormatCompliance(final ByteSource byteSource) * Gets all images specified by the InputStream (some * formats may include multiple images within a single data source). * @param is A valid InputStream + * @param filename used to hint the filename when reading from a byte array + * or InputStream. The filename hint can help disambiguate what file the + * image format. * @return A valid (potentially empty) list of BufferedImage objects. * @throws ImageReadException In the event that the the specified * content does not conform to the format of the specific parser From f5db3ba6a0bae2dd9737234cd9940fd3fb9be13b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 6 Feb 2015 22:24:46 +0100 Subject: [PATCH 033/179] added missing @throws tags --- .../org/apache/commons/imaging/Imaging.java | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/Imaging.java b/src/main/java/org/apache/commons/imaging/Imaging.java index 0e1fd93c84..80c0aabe26 100644 --- a/src/main/java/org/apache/commons/imaging/Imaging.java +++ b/src/main/java/org/apache/commons/imaging/Imaging.java @@ -191,6 +191,8 @@ public static boolean hasImageFileExtension(String filename) { * @return An ImageFormat, such as ImageFormat.IMAGE_FORMAT_JPEG. Returns * ImageFormat.IMAGE_FORMAT_UNKNOWN if the image type cannot be * determined. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static ImageFormat guessFormat(final byte[] bytes) throws ImageReadException, IOException { @@ -211,6 +213,8 @@ public static ImageFormat guessFormat(final byte[] bytes) * @return An ImageFormat, such as ImageFormat.IMAGE_FORMAT_JPEG. Returns * ImageFormat.IMAGE_FORMAT_UNKNOWN if the image type cannot be * determined. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static ImageFormat guessFormat(final File file) throws ImageReadException, IOException { @@ -355,6 +359,8 @@ else if (compareBytePair(MAGIC_NUMBERS_PNG, bytePair)) { * Byte array containing an image file. * @return An instance of ICC_Profile or null if the image contains no ICC * profile. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static ICC_Profile getICCProfile(final byte[] bytes) throws ImageReadException, IOException { @@ -372,6 +378,8 @@ public static ICC_Profile getICCProfile(final byte[] bytes) * Optional parameters, defined in ImagingParameters. * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static ICC_Profile getICCProfile(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { @@ -389,6 +397,8 @@ public static ICC_Profile getICCProfile(final byte[] bytes, final ImagingParamet * Filename associated with image data (optional). * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static ICC_Profile getICCProfile(final InputStream is, final String filename) throws ImageReadException, IOException { @@ -408,6 +418,8 @@ public static ICC_Profile getICCProfile(final InputStream is, final String filen * Optional parameters, defined in ImagingParameters. * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static ICC_Profile getICCProfile(final InputStream is, final String filename, final ImagingParameters params) throws ImageReadException, IOException { @@ -423,6 +435,8 @@ public static ICC_Profile getICCProfile(final InputStream is, final String filen * File containing image data. * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static ICC_Profile getICCProfile(final File file) throws ImageReadException, IOException { @@ -440,6 +454,8 @@ public static ICC_Profile getICCProfile(final File file) * Optional parameters, defined in ImagingParameters. * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static ICC_Profile getICCProfile(final File file, final ImagingParameters params) throws ImageReadException, IOException { @@ -476,6 +492,8 @@ protected static ICC_Profile getICCProfile(final ByteSource byteSource, final Im * @param bytes * Byte array containing an image file. * @return A byte array. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see IccProfileParser * @see ICC_Profile */ @@ -497,6 +515,8 @@ public static byte[] getICCProfileBytes(final byte[] bytes) * @param params * Optional parameters, defined in ImagingParameters. * @return A byte array. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see IccProfileParser * @see ICC_Profile */ @@ -516,6 +536,8 @@ public static byte[] getICCProfileBytes(final byte[] bytes, final ImagingParamet * @param file * File containing image data. * @return A byte array. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see IccProfileParser * @see ICC_Profile */ @@ -537,6 +559,8 @@ public static byte[] getICCProfileBytes(final File file) * @param params * Optional parameters, defined in ImagingParameters. * @return A byte array. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see IccProfileParser * @see ICC_Profile */ @@ -568,6 +592,8 @@ private static byte[] getICCProfileBytes(final ByteSource byteSource, final Imag * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of ImageInfo. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final String filename, final byte[] bytes, @@ -589,6 +615,8 @@ public static ImageInfo getImageInfo(final String filename, final byte[] bytes, * @param bytes * Byte array containing an image file. * @return An instance of ImageInfo. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final String filename, final byte[] bytes) @@ -610,6 +638,8 @@ public static ImageInfo getImageInfo(final String filename, final byte[] bytes) * @param filename * Filename associated with image data (optional). * @return An instance of ImageInfo. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final InputStream is, final String filename) @@ -633,6 +663,8 @@ public static ImageInfo getImageInfo(final InputStream is, final String filename * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of ImageInfo. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final InputStream is, final String filename, @@ -652,6 +684,8 @@ public static ImageInfo getImageInfo(final InputStream is, final String filename * @param bytes * Byte array containing an image file. * @return An instance of ImageInfo. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final byte[] bytes) @@ -673,6 +707,8 @@ public static ImageInfo getImageInfo(final byte[] bytes) * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of ImageInfo. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final byte[] bytes, final ImagingParameters params) @@ -694,6 +730,8 @@ public static ImageInfo getImageInfo(final byte[] bytes, final ImagingParameters * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of ImageInfo. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final File file, final ImagingParameters params) @@ -713,6 +751,8 @@ public static ImageInfo getImageInfo(final File file, final ImagingParameters pa * @param file * File containing image data. * @return An instance of ImageInfo. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final File file) throws ImageReadException, @@ -764,6 +804,8 @@ private static ImageParser getImageParser(final ByteSource byteSource) * @param filename * Filename associated with image data (optional). * @return The width and height of the image. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static Dimension getImageSize(final InputStream is, final String filename) throws ImageReadException, IOException { @@ -781,6 +823,8 @@ public static Dimension getImageSize(final InputStream is, final String filename * @param params * Optional parameters, defined in ImagingParameters. * @return The width and height of the image. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static Dimension getImageSize(final InputStream is, final String filename, final ImagingParameters params) throws ImageReadException, IOException { @@ -794,6 +838,8 @@ public static Dimension getImageSize(final InputStream is, final String filename * @param bytes * Byte array containing an image file. * @return The width and height of the image. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static Dimension getImageSize(final byte[] bytes) throws ImageReadException, IOException { @@ -809,6 +855,8 @@ public static Dimension getImageSize(final byte[] bytes) * @param params * Optional parameters, defined in ImagingParameters. * @return The width and height of the image. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static Dimension getImageSize(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { @@ -822,6 +870,8 @@ public static Dimension getImageSize(final byte[] bytes, final ImagingParameters * @param file * File containing image data. * @return The width and height of the image. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static Dimension getImageSize(final File file) throws ImageReadException, IOException { @@ -837,6 +887,8 @@ public static Dimension getImageSize(final File file) throws ImageReadException, * @param params * Optional parameters, defined in ImagingParameters. * @return The width and height of the image. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static Dimension getImageSize(final File file, final ImagingParameters params) throws ImageReadException, IOException { @@ -859,6 +911,8 @@ public static Dimension getImageSize(final ByteSource byteSource, final ImagingP * @param filename * Filename associated with image data (optional). * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static String getXmpXml(final InputStream is, final String filename) throws ImageReadException, IOException { @@ -876,6 +930,8 @@ public static String getXmpXml(final InputStream is, final String filename) * @param params * Optional parameters, defined in ImagingParameters. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static String getXmpXml(final InputStream is, final String filename, final ImagingParameters params) throws ImageReadException, IOException { @@ -889,6 +945,8 @@ public static String getXmpXml(final InputStream is, final String filename, fina * @param bytes * Byte array containing an image file. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static String getXmpXml(final byte[] bytes) throws ImageReadException, IOException { @@ -904,6 +962,8 @@ public static String getXmpXml(final byte[] bytes) throws ImageReadException, * @param params * Optional parameters, defined in ImagingParameters. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static String getXmpXml(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { @@ -917,6 +977,8 @@ public static String getXmpXml(final byte[] bytes, final ImagingParameters param * @param file * File containing image data. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static String getXmpXml(final File file) throws ImageReadException, IOException { @@ -932,6 +994,8 @@ public static String getXmpXml(final File file) throws ImageReadException, * @param params * Optional parameters, defined in ImagingParameters. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static String getXmpXml(final File file, final ImagingParameters params) throws ImageReadException, IOException { @@ -947,6 +1011,8 @@ public static String getXmpXml(final File file, final ImagingParameters params) * @param params * Optional parameters, defined in ImagingParameters. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public static String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { @@ -971,6 +1037,8 @@ public static String getXmpXml(final ByteSource byteSource, final ImagingParamet * @param bytes * Byte array containing an image file. * @return An instance of IImageMetadata. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final byte[] bytes) @@ -996,6 +1064,8 @@ public static ImageMetadata getMetadata(final byte[] bytes) * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of IImageMetadata. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final byte[] bytes, final ImagingParameters params) @@ -1021,6 +1091,8 @@ public static ImageMetadata getMetadata(final byte[] bytes, final ImagingParamet * @param filename * Filename associated with image data (optional). * @return An instance of IImageMetadata. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final InputStream is, final String filename) @@ -1048,6 +1120,8 @@ public static ImageMetadata getMetadata(final InputStream is, final String filen * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of IImageMetadata. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final InputStream is, final String filename, @@ -1071,6 +1145,8 @@ public static ImageMetadata getMetadata(final InputStream is, final String filen * @param file * File containing image data. * @return An instance of IImageMetadata. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final File file) @@ -1096,6 +1172,8 @@ public static ImageMetadata getMetadata(final File file) * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of IImageMetadata. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final File file, final ImagingParameters params) From 4454b821e13a10c4edb7593321fc983ad23a6714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 08:51:49 +0100 Subject: [PATCH 034/179] improved ensuring that the parameter object is not null --- .../java/org/apache/commons/imaging/Imaging.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/Imaging.java b/src/main/java/org/apache/commons/imaging/Imaging.java index 80c0aabe26..8c88452095 100644 --- a/src/main/java/org/apache/commons/imaging/Imaging.java +++ b/src/main/java/org/apache/commons/imaging/Imaging.java @@ -1477,10 +1477,8 @@ private static BufferedImage getBufferedImage(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final ImageParser imageParser = getImageParser(byteSource); - ImagingParameters parameters = params; - if (null == parameters) { - parameters = new ImagingParameters(); - } + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; return imageParser.getBufferedImage(byteSource, parameters); } @@ -1587,12 +1585,9 @@ public static void writeImage(final BufferedImage src, final OutputStream os, IOException { final ImageParser[] imageParsers = ImageParser.getAllImageParsers(); - // make sure parameters are non-null - ImagingParameters parameters = params; - if (parameters == null) { - parameters = new ImagingParameters(); - } - + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; + // add format parameter parameters.setImageFormat(format); ImageParser imageParser = null; From cede4fc47c4bdad18314c16616a6fd0acd3159ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 09:05:19 +0100 Subject: [PATCH 035/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/bmp/BmpImageParser.java | 98 +++++-------------- 1 file changed, 27 insertions(+), 71 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java index 79ec0d93b8..480df7aa58 100644 --- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java @@ -25,9 +25,7 @@ import java.io.PrintWriter; import java.nio.ByteOrder; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.FormatCompliance; import org.apache.commons.imaging.ImageFormat; @@ -45,7 +43,7 @@ import org.apache.commons.imaging.palette.SimplePalette; import org.apache.commons.imaging.util.IoUtils; -import static org.apache.commons.imaging.ImagingConstants.*; +import org.apache.commons.imaging.ImagingParameters; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class BmpImageParser extends ImageParser { @@ -486,27 +484,17 @@ private BmpHeaderInfo readBmpHeaderInfo(final ByteSource byteSource, } @Override - public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @Override - public Dimension getImageSize(final ByteSource byteSource, Map params) + public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { - // make copy of params; we'll clear keys as we consume them. - params = (params == null) ? new HashMap() : new HashMap(params); - - final boolean verbose = Boolean.TRUE.equals(params.get(PARAM_KEY_VERBOSE)); - - if (params.containsKey(PARAM_KEY_VERBOSE)) { - params.remove(PARAM_KEY_VERBOSE); - } - - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageReadException("Unknown parameter: " + firstKey); - } + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; + final boolean verbose = parameters.isVerbose(); final BmpHeaderInfo bhi = readBmpHeaderInfo(byteSource, verbose); @@ -519,7 +507,7 @@ public Dimension getImageSize(final ByteSource byteSource, Map p } @Override - public ImageMetadata getMetadata(final ByteSource byteSource, final Map params) + public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { // TODO this should throw UnsupportedOperationException, but RoundtripTest has to be refactored completely before this can be changed return null; @@ -549,21 +537,13 @@ private String getBmpTypeDescription(final int identifier1, final int identifier } @Override - public ImageInfo getImageInfo(final ByteSource byteSource, Map params) + public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { - // make copy of params; we'll clear keys as we consume them. - params = (params == null) ? new HashMap() : new HashMap(params); - - final boolean verbose = Boolean.TRUE.equals(params.get(PARAM_KEY_VERBOSE)); - - if (params.containsKey(PARAM_KEY_VERBOSE)) { - params.remove(PARAM_KEY_VERBOSE); - } - - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageReadException("Unknown parameter: " + firstKey); - } + + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; + + final boolean verbose = parameters.isVerbose(); InputStream is = null; ImageContents ic = null; @@ -663,7 +643,7 @@ public FormatCompliance getFormatCompliance(final ByteSource byteSource) } @Override - public BufferedImage getBufferedImage(final ByteSource byteSource, final Map params) + public BufferedImage getBufferedImage(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { InputStream is = null; boolean canThrow = false; @@ -677,25 +657,14 @@ public BufferedImage getBufferedImage(final ByteSource byteSource, final Map params) + public BufferedImage getBufferedImage(final InputStream inputStream, final ImagingParameters params) throws ImageReadException, IOException { - // make copy of params; we'll clear keys as we consume them. - params = (params == null) ? new HashMap() : new HashMap(params); - - final boolean verbose = Boolean.TRUE.equals(params.get(PARAM_KEY_VERBOSE)); - - if (params.containsKey(PARAM_KEY_VERBOSE)) { - params.remove(PARAM_KEY_VERBOSE); - } - if (params.containsKey(BUFFERED_IMAGE_FACTORY)) { - params.remove(BUFFERED_IMAGE_FACTORY); - } - - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageReadException("Unknown parameter: " + firstKey); - } - + + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; + + final boolean verbose = parameters.isVerbose(); + final ImageContents ic = readImageContents(inputStream, FormatCompliance.getDefault(), verbose); if (ic == null) { @@ -725,26 +694,13 @@ public BufferedImage getBufferedImage(final InputStream inputStream, Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { - // make copy of params; we'll clear keys as we consume them. - params = (params == null) ? new HashMap() : new HashMap(params); - - PixelDensity pixelDensity = null; - - // clear format key. - if (params.containsKey(PARAM_KEY_FORMAT)) { - params.remove(PARAM_KEY_FORMAT); - } - if (params.containsKey(PARAM_KEY_PIXEL_DENSITY)) { - pixelDensity = (PixelDensity) params - .remove(PARAM_KEY_PIXEL_DENSITY); - } - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageWriteException("Unknown parameter: " + firstKey); - } + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; + final PixelDensity pixelDensity = (parameters.isPixelDensityPresent()) ? parameters.getPixelDensity() : null; + final SimplePalette palette = new PaletteFactory().makeExactRgbPaletteSimple( src, 256); @@ -813,7 +769,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map params) + public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } From a6ac9ea23e24eea6edb77a2499314846212d8bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 09:05:43 +0100 Subject: [PATCH 036/179] added missing @throws tags --- .../org/apache/commons/imaging/formats/bmp/BmpImageParser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java index 480df7aa58..9aaec4f265 100644 --- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java @@ -767,11 +767,12 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima * @param params * Map of optional parameters, defined in ImagingConstants. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ @Override public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } - } From b97e9ca9577bb4d3d85b2e67cf1d6224166c45a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 09:14:33 +0100 Subject: [PATCH 037/179] added note that I changed the file to licence header --- .../org/apache/commons/imaging/formats/bmp/BmpImageParser.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java index 9aaec4f265..5926868322 100644 --- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.bmp; From 996abd1c0ef457fb08f2855a7c7489016e66132d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 09:15:51 +0100 Subject: [PATCH 038/179] added note that I changed the file to licence header --- src/main/java/org/apache/commons/imaging/ImageParser.java | 2 ++ src/main/java/org/apache/commons/imaging/Imaging.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/ImageParser.java b/src/main/java/org/apache/commons/imaging/ImageParser.java index 5ea2616766..d3f561767a 100644 --- a/src/main/java/org/apache/commons/imaging/ImageParser.java +++ b/src/main/java/org/apache/commons/imaging/ImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging; diff --git a/src/main/java/org/apache/commons/imaging/Imaging.java b/src/main/java/org/apache/commons/imaging/Imaging.java index 8c88452095..47021e6301 100644 --- a/src/main/java/org/apache/commons/imaging/Imaging.java +++ b/src/main/java/org/apache/commons/imaging/Imaging.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging; From bfc72c36bacd37b7b0a92f71967e9d583c12bd11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 09:46:42 +0100 Subject: [PATCH 039/179] removed prefix "Tiff" --- .../imaging/ImagingParametersTiff.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index a96b8e7528..7cd67d5309 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -29,23 +29,23 @@ */ public final class ImagingParametersTiff extends ImagingParameters { - private Integer tiffCompressionLevel; // PARAM_KEY_COMPRESSION + private Integer compressionLevel; // PARAM_KEY_COMPRESSION // This is the default value used for the parameter above. // If you need to change the default value for this parameter, do it here. // Please remember to change the javadoc also. - private final Integer tiffCompressionLevelDefault = TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED; + private final Integer compressionLevelDefault = TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED; - private TiffOutputSet tiffOutputSetForMetaData; // PARAM_KEY_EXIF + private TiffOutputSet outputSetForMetaData; // PARAM_KEY_EXIF /** * This gives you a parameter object with default values. */ public ImagingParametersTiff() { - this.tiffCompressionLevel = tiffCompressionLevelDefault; - this.tiffOutputSetForMetaData = null; + this.compressionLevel = compressionLevelDefault; + this.outputSetForMetaData = null; } - //****** tiffCompressionLevel ****** + //****** compressionLevel ****** /** * Parameter used in write operations to indicate desired compression @@ -60,8 +60,8 @@ public ImagingParametersTiff() { * TiffConstants.TIFF_COMPRESSION_LZW, * TiffConstants.TIFF_COMPRESSION_PACKBITS */ - public Integer getTiffCompressionLevel() { - Integer value = this.tiffCompressionLevel; + public Integer getCompressionLevel() { + Integer value = this.compressionLevel; checkIfParameterIsPresent(value); return value; } @@ -77,9 +77,9 @@ public Integer getTiffCompressionLevel() { * TiffConstants.TIFF_COMPRESSION_LZW, * TiffConstants.TIFF_COMPRESSION_PACKBITS */ - public void setTiffCompressionLevel(final Integer value) { + public void setCompressionLevel(final Integer value) { checkIfValueIsNull(value); - this.tiffCompressionLevel = value; + this.compressionLevel = value; } //****** tiffOutputSetForMetaData ****** @@ -92,8 +92,8 @@ public void setTiffCompressionLevel(final Integer value) { * Valid values: TiffOutputSet to write into the image's EXIF metadata. * @return {@code true} if there is a value present, {@false} else. */ - public boolean isTiffOutputSetPresent() { - return this.tiffOutputSetForMetaData == null; + public boolean isOutputSetPresent() { + return this.outputSetForMetaData == null; } /** @@ -102,8 +102,8 @@ public boolean isTiffOutputSetPresent() { * Only used when writing images. * @return Valid values: TiffOutputSet to write into the image's EXIF metadata. */ - public TiffOutputSet getTiffOutputSet() { - TiffOutputSet value = this.tiffOutputSetForMetaData; + public TiffOutputSet getOutputSet() { + TiffOutputSet value = this.outputSetForMetaData; checkIfParameterIsPresent(value); return value; } @@ -114,8 +114,8 @@ public TiffOutputSet getTiffOutputSet() { * Only used when writing images. * @param value Valid values: TiffOutputSet to write into the image's EXIF metadata. */ - public void setTiffOutputSet(final TiffOutputSet value) { + public void setOutputSet(final TiffOutputSet value) { checkIfValueIsNull(value); - this.tiffOutputSetForMetaData = value; + this.outputSetForMetaData = value; } } From 4a124466e8a75385d771dd254bdd3d58129b57f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 09:52:04 +0100 Subject: [PATCH 040/179] added parameters for PCX (triggered by DcxImageParser.writeImage(final BufferedImage src, final OutputStream os, Map params) --- .../commons/imaging/ImagingParametersPcx.java | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java new file mode 100644 index 0000000000..ccfdbd6629 --- /dev/null +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Created 2015 by Michael Gross, mgmechanics@mgmechanics.de + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de + */ + +package org.apache.commons.imaging; + +import org.apache.commons.imaging.formats.pcx.PcxConstants; + +/** + * This class is a POJO holding data for parameters as requested in IMAGING-159. + * It holds additional data needed for the PCX format only. + */ +public final class ImagingParametersPcx extends ImagingParameters { + + private Integer compressionLevel; // PARAM_KEY_COMPRESSION + // This is the default value used for the parameter above. + // If you need to change the default value for this parameter, do it here. + // Please remember to change the javadoc also. + private final Integer compressionLevelDefault = PcxConstants.PCX_COMPRESSION_UNCOMPRESSED; + + /** + * This gives you a parameter object with default values. + */ + public ImagingParametersPcx() { + this.compressionLevel = compressionLevelDefault; + } + + //****** compressionLevel ****** + + /** + * Parameter used in write operations to indicate desired compression + * algorithm. + *

+ * Currently only applies to writing PCX image files. + *

+ * Default value: PcxConstants.PCX_COMPRESSION_UNCOMPRESSED + * @return Valid values: + * PcxConstants.PCX_COMPRESSION_UNCOMPRESSED, + * PcxConstants.PCX_COMPRESSION_RLE + */ + public Integer getCompressionLevel() { + Integer value = this.compressionLevel; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter used in write operations to indicate desired compression + * algorithm. + *

+ * Currently only applies to writing PCX image files. + * @param value Valid values: + * PcxConstants.PCX_COMPRESSION_UNCOMPRESSED, + * PcxConstants.PCX_COMPRESSION_RLE + */ + public void setCompressionLevel(final Integer value) { + checkIfValueIsNull(value); + this.compressionLevel = value; + } +} From 8db737c3b60d5c1b92b6c736dd1675743897a9fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 10:00:49 +0100 Subject: [PATCH 041/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/dcx/DcxImageParser.java | 54 +++++-------------- 1 file changed, 12 insertions(+), 42 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java index 39d1ed0786..6bbfd9ffd5 100644 --- a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.dcx; @@ -26,7 +28,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.ImageFormat; import org.apache.commons.imaging.ImageFormats; @@ -34,16 +35,14 @@ import org.apache.commons.imaging.ImageParser; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.ImageWriteException; -import org.apache.commons.imaging.PixelDensity; import org.apache.commons.imaging.common.BinaryOutputStream; import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.common.bytesource.ByteSource; import org.apache.commons.imaging.common.bytesource.ByteSourceInputStream; -import org.apache.commons.imaging.formats.pcx.PcxConstants; import org.apache.commons.imaging.formats.pcx.PcxImageParser; import org.apache.commons.imaging.util.IoUtils; -import static org.apache.commons.imaging.ImagingConstants.*; +import org.apache.commons.imaging.ImagingParameters; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class DcxImageParser extends ImageParser { @@ -79,28 +78,28 @@ protected ImageFormat[] getAcceptedTypes() { // FIXME should throw UOE @Override - public ImageMetadata getMetadata(final ByteSource byteSource, final Map params) + public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } // FIXME should throw UOE @Override - public ImageInfo getImageInfo(final ByteSource byteSource, final Map params) + public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } // FIXME should throw UOE @Override - public Dimension getImageSize(final ByteSource byteSource, final Map params) + public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } // FIXME should throw UOE @Override - public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @@ -173,7 +172,7 @@ public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource) @Override public final BufferedImage getBufferedImage(final ByteSource byteSource, - final Map params) throws ImageReadException, IOException { + final ImagingParameters params) throws ImageReadException, IOException { final List list = getAllBufferedImages(byteSource); if (list.isEmpty()) { return null; @@ -206,40 +205,11 @@ public List getAllBufferedImages(final ByteSource byteSource) } @Override - public void writeImage(final BufferedImage src, final OutputStream os, Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { - // make copy of params; we'll clear keys as we consume them. - params = (params == null) ? new HashMap() : new HashMap(params); - - final HashMap pcxParams = new HashMap(); - - // clear format key. - if (params.containsKey(PARAM_KEY_FORMAT)) { - params.remove(PARAM_KEY_FORMAT); - } - - if (params.containsKey(PcxConstants.PARAM_KEY_PCX_COMPRESSION)) { - final Object value = params - .remove(PcxConstants.PARAM_KEY_PCX_COMPRESSION); - pcxParams.put(PcxConstants.PARAM_KEY_PCX_COMPRESSION, value); - } - if (params.containsKey(PARAM_KEY_PIXEL_DENSITY)) { - final Object value = params.remove(PARAM_KEY_PIXEL_DENSITY); - if (value != null) { - if (!(value instanceof PixelDensity)) { - throw new ImageWriteException( - "Invalid pixel density parameter"); - } - pcxParams.put(PARAM_KEY_PIXEL_DENSITY, value); - } - } - - - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageWriteException("Unknown parameter: " + firstKey); - } + // ensure that the parameter object is not null + final ImagingParameters pcxParams = (params == null) ? new ImagingParameters() : params; final int headerSize = 4 + 1024 * 4; @@ -266,7 +236,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map params) + public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } From 81d32dbc0acb2c8d6c5effcb97b0c05a39a0bc36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 10:01:37 +0100 Subject: [PATCH 042/179] added missing @throws tags --- .../org/apache/commons/imaging/formats/dcx/DcxImageParser.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java index 6bbfd9ffd5..3229e66856 100644 --- a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java @@ -234,6 +234,8 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima * @param params * Map of optional parameters, defined in ImagingConstants. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ @Override public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) From 3a8e609701bd387b451031b74da4c69d232ed580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 10:29:01 +0100 Subject: [PATCH 043/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/gif/GifImageParser.java | 49 ++++++------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java index 4bfdde3880..f85a6f98be 100644 --- a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.gif; @@ -26,9 +28,7 @@ import java.io.UnsupportedEncodingException; import java.nio.ByteOrder; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.FormatCompliance; import org.apache.commons.imaging.ImageFormat; @@ -47,7 +47,7 @@ import org.apache.commons.imaging.palette.PaletteFactory; import org.apache.commons.imaging.util.IoUtils; -import static org.apache.commons.imaging.ImagingConstants.*; +import org.apache.commons.imaging.ImagingParameters; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class GifImageParser extends ImageParser { @@ -465,13 +465,13 @@ private ImageContents readFile(final ByteSource byteSource, } @Override - public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @Override - public Dimension getImageSize(final ByteSource byteSource, final Map params) + public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final ImageContents blocks = readFile(byteSource, false); @@ -498,7 +498,7 @@ public Dimension getImageSize(final ByteSource byteSource, final Map params) + public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @@ -518,7 +518,7 @@ private List getComments(final List blocks) throws IOException } @Override - public ImageInfo getImageInfo(final ByteSource byteSource, final Map params) + public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final ImageContents blocks = readFile(byteSource, false); @@ -642,7 +642,7 @@ public FormatCompliance getFormatCompliance(final ByteSource byteSource) } @Override - public BufferedImage getBufferedImage(final ByteSource byteSource, final Map params) + public BufferedImage getBufferedImage(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final ImageContents imageContents = readFile(byteSource, false); @@ -755,32 +755,15 @@ private void writeAsSubBlocks(final OutputStream os, final byte[] bytes) throws } @Override - public void writeImage(final BufferedImage src, final OutputStream os, Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { - // make copy of params; we'll clear keys as we consume them. - params = new HashMap(params); - - final boolean verbose = Boolean.TRUE.equals(params.get(PARAM_KEY_VERBOSE)); - - // clear format key. - if (params.containsKey(PARAM_KEY_FORMAT)) { - params.remove(PARAM_KEY_FORMAT); - } - if (params.containsKey(PARAM_KEY_VERBOSE)) { - params.remove(PARAM_KEY_VERBOSE); - } - - String xmpXml = null; - if (params.containsKey(PARAM_KEY_XMP_XML)) { - xmpXml = (String) params.get(PARAM_KEY_XMP_XML); - params.remove(PARAM_KEY_XMP_XML); - } - - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageWriteException("Unknown parameter: " + firstKey); - } + + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; + final boolean verbose = parameters.isVerbose(); + final String xmpXml = (parameters.isXmpXmlAsStringPresent()) ? parameters.getXmpXmlAsString(): null; + final int width = src.getWidth(); final int height = src.getHeight(); @@ -1013,7 +996,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map params) + public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { InputStream is = null; From f8b45e3ad37d84cd020c30b0cc77f1ebbcbc2fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 10:31:02 +0100 Subject: [PATCH 044/179] added missing @throws tags to javadoc --- .../org/apache/commons/imaging/formats/gif/GifImageParser.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java index f85a6f98be..8616a8ec9b 100644 --- a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java @@ -994,6 +994,8 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima * @param params * Map of optional parameters, defined in ImagingConstants. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ @Override public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) From 03ff8c7bbad3fffd0c0d675b6e6d38553d4e6325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 10:57:11 +0100 Subject: [PATCH 045/179] Replaced parameter Map by ImagingParameters For this class it means to remove all code dealing with parameters because no parameter is used --- .../imaging/formats/icns/IcnsImageParser.java | 55 ++++--------------- 1 file changed, 11 insertions(+), 44 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java index 4a0a9223c3..5aa67d8290 100644 --- a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.icns; @@ -26,7 +28,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.ImageFormat; import org.apache.commons.imaging.ImageFormats; @@ -39,7 +40,7 @@ import org.apache.commons.imaging.common.bytesource.ByteSource; import org.apache.commons.imaging.util.IoUtils; -import static org.apache.commons.imaging.ImagingConstants.*; +import org.apache.commons.imaging.ImagingParameters; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class IcnsImageParser extends ImageParser { @@ -73,25 +74,14 @@ protected ImageFormat[] getAcceptedTypes() { // FIXME should throw UOE @Override - public ImageMetadata getMetadata(final ByteSource byteSource, final Map params) + public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @Override - public ImageInfo getImageInfo(final ByteSource byteSource, Map params) + public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { - // make copy of params; we'll clear keys as we consume them. - params = (params == null) ? new HashMap() : new HashMap(params); - - if (params.containsKey(PARAM_KEY_VERBOSE)) { - params.remove(PARAM_KEY_VERBOSE); - } - - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageReadException("Unknown parameter: " + firstKey); - } final IcnsContents contents = readImage(byteSource); final List images = IcnsDecoder @@ -109,20 +99,9 @@ public ImageInfo getImageInfo(final ByteSource byteSource, Map p } @Override - public Dimension getImageSize(final ByteSource byteSource, Map params) + public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { - // make copy of params; we'll clear keys as we consume them. - params = (params == null) ? new HashMap() : new HashMap(params); - - if (params.containsKey(PARAM_KEY_VERBOSE)) { - params.remove(PARAM_KEY_VERBOSE); - } - - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageReadException("Unknown parameter: " + firstKey); - } - + final IcnsContents contents = readImage(byteSource); final List images = IcnsDecoder .decodeAllImages(contents.icnsElements); @@ -134,7 +113,7 @@ public Dimension getImageSize(final ByteSource byteSource, Map p } @Override - public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @@ -267,7 +246,7 @@ public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource) @Override public final BufferedImage getBufferedImage(final ByteSource byteSource, - final Map params) throws ImageReadException, IOException { + final ImagingParameters params) throws ImageReadException, IOException { final IcnsContents icnsContents = readImage(byteSource); final List result = IcnsDecoder .decodeAllImages(icnsContents.icnsElements); @@ -285,20 +264,8 @@ public List getAllBufferedImages(final ByteSource byteSource) } @Override - public void writeImage(final BufferedImage src, final OutputStream os, Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { - // make copy of params; we'll clear keys as we consume them. - params = (params == null) ? new HashMap() : new HashMap(params); - - // clear format key. - if (params.containsKey(PARAM_KEY_FORMAT)) { - params.remove(PARAM_KEY_FORMAT); - } - - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageWriteException("Unknown parameter: " + firstKey); - } IcnsType imageType; if (src.getWidth() == 16 && src.getHeight() == 16) { @@ -357,7 +324,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map params) + public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } From 3b8392b5d6b5eaf2e308640d868324d8c498c339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 11:18:23 +0100 Subject: [PATCH 046/179] added missing @throws tags to javadoc --- .../apache/commons/imaging/formats/icns/IcnsImageParser.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java index 5aa67d8290..682fd3a655 100644 --- a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java @@ -322,6 +322,8 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima * @param params * Map of optional parameters, defined in ImagingConstants. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ @Override public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) From c51a6e6f16b7828a822803c68cf458d572a00019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 11:18:40 +0100 Subject: [PATCH 047/179] removed unused import --- .../org/apache/commons/imaging/formats/icns/IcnsImageParser.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java index 682fd3a655..42eed2da2c 100644 --- a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java @@ -26,7 +26,6 @@ import java.io.PrintWriter; import java.nio.ByteOrder; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import org.apache.commons.imaging.ImageFormat; From a32f119b8ac6e16a382c598f075be8961502cf54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 11:46:01 +0100 Subject: [PATCH 048/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/ico/IcoImageParser.java | 37 +++++++------------ 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java index 8e2f74289c..b8022f2412 100644 --- a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.ico; @@ -26,9 +28,7 @@ import java.io.PrintWriter; import java.nio.ByteOrder; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.ImageFormat; import org.apache.commons.imaging.ImageFormats; @@ -46,7 +46,7 @@ import org.apache.commons.imaging.palette.SimplePalette; import org.apache.commons.imaging.util.IoUtils; -import static org.apache.commons.imaging.ImagingConstants.*; +import org.apache.commons.imaging.ImagingParameters; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class IcoImageParser extends ImageParser { @@ -80,28 +80,28 @@ protected ImageFormat[] getAcceptedTypes() { // TODO should throw UOE @Override - public ImageMetadata getMetadata(final ByteSource byteSource, final Map params) + public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } // TODO should throw UOE @Override - public ImageInfo getImageInfo(final ByteSource byteSource, final Map params) + public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } // TODO should throw UOE @Override - public Dimension getImageSize(final ByteSource byteSource, final Map params) + public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } // TODO should throw UOE @Override - public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @@ -586,7 +586,7 @@ public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource) @Override public final BufferedImage getBufferedImage(final ByteSource byteSource, - final Map params) throws ImageReadException, IOException { + final ImagingParameters params) throws ImageReadException, IOException { final ImageContents contents = readImage(byteSource); final FileHeader fileHeader = contents.fileHeader; if (fileHeader.iconCount > 0) { @@ -638,22 +638,13 @@ public List getAllBufferedImages(final ByteSource byteSource) // } @Override - public void writeImage(final BufferedImage src, final OutputStream os, Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { - // make copy of params; we'll clear keys as we consume them. - params = (params == null) ? new HashMap() : new HashMap(params); - - // clear format key. - if (params.containsKey(PARAM_KEY_FORMAT)) { - params.remove(PARAM_KEY_FORMAT); - } - final PixelDensity pixelDensity = (PixelDensity) params.remove(PARAM_KEY_PIXEL_DENSITY); - - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageWriteException("Unknown parameter: " + firstKey); - } + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; + + final PixelDensity pixelDensity = (parameters.isPixelDensityPresent()) ? parameters.getPixelDensity(): null; final PaletteFactory paletteFactory = new PaletteFactory(); final SimplePalette palette = paletteFactory @@ -828,7 +819,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map params) + public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } From 0c6a0c1ddb6a084256cee4b1759665947fb2d418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 11:46:29 +0100 Subject: [PATCH 049/179] added missing @throws tags to javadoc --- .../org/apache/commons/imaging/formats/ico/IcoImageParser.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java index b8022f2412..345f3da7e9 100644 --- a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java @@ -817,6 +817,8 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima * @param params * Map of optional parameters, defined in ImagingConstants. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ @Override public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) From e082094349d5501cde5ac00302bc166083124127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 13:14:32 +0100 Subject: [PATCH 050/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/jpeg/JpegImageParser.java | 40 +++++++++++-------- .../imaging/formats/jpeg/iptc/IptcParser.java | 15 ++++--- .../formats/jpeg/segments/App13Segment.java | 6 ++- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java index a3bd557e22..eec53350bf 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg; @@ -26,15 +28,15 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.ImageFormat; import org.apache.commons.imaging.ImageFormats; import org.apache.commons.imaging.ImageInfo; import org.apache.commons.imaging.ImageParser; import org.apache.commons.imaging.ImageReadException; +import org.apache.commons.imaging.ImagingParameters; +import org.apache.commons.imaging.ImagingParametersJpeg; import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.common.bytesource.ByteSource; import org.apache.commons.imaging.formats.jpeg.decoder.JpegDecoder; @@ -57,7 +59,6 @@ import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants; import org.apache.commons.imaging.util.Debug; -import static org.apache.commons.imaging.ImagingConstants.*; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class JpegImageParser extends ImageParser { @@ -93,7 +94,7 @@ protected String[] getAcceptedExtensions() { @Override public final BufferedImage getBufferedImage(final ByteSource byteSource, - final Map params) throws ImageReadException, IOException { + final ImagingParameters params) throws ImageReadException, IOException { final JpegDecoder jpegDecoder = new JpegDecoder(); return jpegDecoder.decode(byteSource); } @@ -273,7 +274,7 @@ public List readSegments(final ByteSource byteSource, final int[] marke } @Override - public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final List segments = readSegments(byteSource, new int[] { JpegConstants.JPEG_APP2_MARKER, }, false); @@ -307,7 +308,7 @@ public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final TiffImageMetadata exif = getExifMetadata(byteSource, params); @@ -338,22 +339,27 @@ private List filterAPP1Segments(final List segments) { return result; } - public TiffImageMetadata getExifMetadata(final ByteSource byteSource, Map params) + public TiffImageMetadata getExifMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final byte[] bytes = getExifRawData(byteSource); if (null == bytes) { return null; } - + + // if no parameters were given we assume that thumbnails should be read + // to transport this decision we need a parameter object specific for JPEGs + final ImagingParameters parameters; if (params == null) { - params = new HashMap(); + ImagingParametersJpeg jpegParameters; + jpegParameters = new ImagingParametersJpeg(); + jpegParameters.enableReadThumbnails(); + parameters = jpegParameters; } - if (!params.containsKey(PARAM_KEY_READ_THUMBNAILS)) { - params.put(PARAM_KEY_READ_THUMBNAILS, Boolean.TRUE); + else { + parameters = params; } - return (TiffImageMetadata) new TiffImageParser().getMetadata(bytes, - params); + return (TiffImageMetadata) new TiffImageParser().getMetadata(bytes, parameters); } public byte[] getExifRawData(final ByteSource byteSource) @@ -521,7 +527,7 @@ public boolean visitSegment(final int marker, final byte[] markerBytes, * @return Xmp Xml as String, if present. Otherwise, returns null. */ @Override - public String getXmpXml(final ByteSource byteSource, final Map params) + public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final List result = new ArrayList(); @@ -569,7 +575,7 @@ public boolean visitSegment(final int marker, final byte[] markerBytes, } public JpegPhotoshopMetadata getPhotoshopMetadata(final ByteSource byteSource, - final Map params) throws ImageReadException, IOException { + final ImagingParameters params) throws ImageReadException, IOException { final List segments = readSegments(byteSource, new int[] { JpegConstants.JPEG_APP13_MARKER, }, false); @@ -598,7 +604,7 @@ public JpegPhotoshopMetadata getPhotoshopMetadata(final ByteSource byteSource, } @Override - public Dimension getImageSize(final ByteSource byteSource, final Map params) + public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final List segments = readSegments(byteSource, new int[] { // kJFIFMarker, @@ -632,7 +638,7 @@ public Dimension getImageSize(final ByteSource byteSource, final Map params) + public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { // List allSegments = readSegments(byteSource, null, false); diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java index 17698a0673..ddd39929b1 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.iptc; @@ -26,11 +28,10 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.ImageWriteException; -import org.apache.commons.imaging.ImagingConstants; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.common.BinaryFileParser; import org.apache.commons.imaging.common.BinaryOutputStream; import org.apache.commons.imaging.common.ByteConversions; @@ -95,10 +96,14 @@ public boolean isPhotoshopJpegSegment(final byte[] segmentData) { * Some IPTC blocks are missing this first "record version" record, so we * don't require it. */ - public PhotoshopApp13Data parsePhotoshopSegment(final byte[] bytes, final Map params) + public PhotoshopApp13Data parsePhotoshopSegment(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { - final boolean strict = params != null && Boolean.TRUE.equals(params.get(ImagingConstants.PARAM_KEY_STRICT)); - final boolean verbose = params != null && Boolean.TRUE.equals(params.get(ImagingConstants.PARAM_KEY_VERBOSE)); + + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; + + final boolean strict = parameters.isStrict(); + final boolean verbose = parameters.isVerbose(); return parsePhotoshopSegment(bytes, verbose, strict); } diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App13Segment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App13Segment.java index 18c63f4013..9f18e43823 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App13Segment.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App13Segment.java @@ -13,15 +13,17 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.segments; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import java.util.Map; import org.apache.commons.imaging.ImageReadException; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.formats.jpeg.JpegImageParser; import org.apache.commons.imaging.formats.jpeg.iptc.IptcParser; import org.apache.commons.imaging.formats.jpeg.iptc.PhotoshopApp13Data; @@ -62,7 +64,7 @@ public boolean isPhotoshopJpegSegment() { return new IptcParser().isPhotoshopJpegSegment(getSegmentData()); } - public PhotoshopApp13Data parsePhotoshopSegment(final Map params) + public PhotoshopApp13Data parsePhotoshopSegment(final ImagingParameters params) throws ImageReadException, IOException { /* * In practice, App13 segments are only used for Photoshop/IPTC From 4a1bf67e030f949c6470a3897e16a7b47e9d424b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 13:15:01 +0100 Subject: [PATCH 051/179] added missing @throws tags to javadoc --- .../apache/commons/imaging/formats/jpeg/JpegImageParser.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java index eec53350bf..00e40ab69b 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java @@ -525,6 +525,8 @@ public boolean visitSegment(final int marker, final byte[] markerBytes, * @param params * Map of optional parameters, defined in ImagingConstants. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ @Override public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) From 13442b7110b047e1a6063f80370a9d0bf18692f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 13:19:03 +0100 Subject: [PATCH 052/179] moved import for ImagingParameters on proper position --- .../org/apache/commons/imaging/formats/bmp/BmpImageParser.java | 2 +- .../org/apache/commons/imaging/formats/dcx/DcxImageParser.java | 2 +- .../org/apache/commons/imaging/formats/gif/GifImageParser.java | 2 +- .../apache/commons/imaging/formats/icns/IcnsImageParser.java | 2 +- .../org/apache/commons/imaging/formats/ico/IcoImageParser.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java index 5926868322..31bcd39ebb 100644 --- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java @@ -36,6 +36,7 @@ import org.apache.commons.imaging.ImageParser; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.PixelDensity; import org.apache.commons.imaging.common.BinaryOutputStream; import org.apache.commons.imaging.common.ImageMetadata; @@ -45,7 +46,6 @@ import org.apache.commons.imaging.palette.SimplePalette; import org.apache.commons.imaging.util.IoUtils; -import org.apache.commons.imaging.ImagingParameters; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class BmpImageParser extends ImageParser { diff --git a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java index 3229e66856..ffadce5e44 100644 --- a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java @@ -35,6 +35,7 @@ import org.apache.commons.imaging.ImageParser; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.common.BinaryOutputStream; import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.common.bytesource.ByteSource; @@ -42,7 +43,6 @@ import org.apache.commons.imaging.formats.pcx.PcxImageParser; import org.apache.commons.imaging.util.IoUtils; -import org.apache.commons.imaging.ImagingParameters; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class DcxImageParser extends ImageParser { diff --git a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java index 8616a8ec9b..8a93ddeabf 100644 --- a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java @@ -37,6 +37,7 @@ import org.apache.commons.imaging.ImageParser; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.common.BinaryOutputStream; import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.common.ImageBuilder; @@ -47,7 +48,6 @@ import org.apache.commons.imaging.palette.PaletteFactory; import org.apache.commons.imaging.util.IoUtils; -import org.apache.commons.imaging.ImagingParameters; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class GifImageParser extends ImageParser { diff --git a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java index 42eed2da2c..3d63694530 100644 --- a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java @@ -34,12 +34,12 @@ import org.apache.commons.imaging.ImageParser; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.common.BinaryOutputStream; import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.common.bytesource.ByteSource; import org.apache.commons.imaging.util.IoUtils; -import org.apache.commons.imaging.ImagingParameters; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class IcnsImageParser extends ImageParser { diff --git a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java index 345f3da7e9..924f3d2f2a 100644 --- a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java @@ -37,6 +37,7 @@ import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.ImageWriteException; import org.apache.commons.imaging.Imaging; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.PixelDensity; import org.apache.commons.imaging.common.BinaryOutputStream; import org.apache.commons.imaging.common.ImageMetadata; @@ -46,7 +47,6 @@ import org.apache.commons.imaging.palette.SimplePalette; import org.apache.commons.imaging.util.IoUtils; -import org.apache.commons.imaging.ImagingParameters; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class IcoImageParser extends ImageParser { From 8122d352ece730dc63131b274bc6db34ab999296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 13:22:26 +0100 Subject: [PATCH 053/179] added missing @throws tags to javadoc --- .../formats/jpeg/iptc/JpegIptcRewriter.java | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java index 78c3dc47a8..2a82739d15 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.iptc; @@ -22,12 +24,11 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.common.bytesource.ByteSource; import org.apache.commons.imaging.common.bytesource.ByteSourceArray; import org.apache.commons.imaging.common.bytesource.ByteSourceFile; @@ -50,6 +51,9 @@ public class JpegIptcRewriter extends JpegRewriter { * Image file. * @param os * OutputStream to write the image to. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException + * @throws org.apache.commons.imaging.ImageWriteException * * @see java.io.File * @see java.io.OutputStream @@ -70,6 +74,9 @@ public void removeIPTC(final File src, final OutputStream os) * Byte array containing Jpeg image data. * @param os * OutputStream to write the image to. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException + * @throws org.apache.commons.imaging.ImageWriteException */ public void removeIPTC(final byte[] src, final OutputStream os) throws ImageReadException, IOException, ImageWriteException { @@ -87,6 +94,9 @@ public void removeIPTC(final byte[] src, final OutputStream os) * InputStream containing Jpeg image data. * @param os * OutputStream to write the image to. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException + * @throws org.apache.commons.imaging.ImageWriteException */ public void removeIPTC(final InputStream src, final OutputStream os) throws ImageReadException, IOException, ImageWriteException { @@ -104,6 +114,9 @@ public void removeIPTC(final InputStream src, final OutputStream os) * ByteSource containing Jpeg image data. * @param os * OutputStream to write the image to. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException + * @throws org.apache.commons.imaging.ImageWriteException */ public void removeIPTC(final ByteSource byteSource, final OutputStream os) throws ImageReadException, IOException, ImageWriteException { @@ -119,7 +132,7 @@ public void removeIPTC(final ByteSource byteSource, final OutputStream os) if (photoshopApp13Segments.size() == 1) { final JFIFPieceSegment oldSegment = (JFIFPieceSegment) photoshopApp13Segments .get(0); - final Map params = new HashMap(); + final ImagingParameters params = new ImagingParameters(); final PhotoshopApp13Data oldData = new IptcParser() .parsePhotoshopSegment(oldSegment.segmentData, params); final List newBlocks = oldData.getNonIptcBlocks(); @@ -146,6 +159,9 @@ public void removeIPTC(final ByteSource byteSource, final OutputStream os) * OutputStream to write the image to. * @param newData * structure containing IPTC data. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException + * @throws org.apache.commons.imaging.ImageWriteException */ public void writeIPTC(final byte[] src, final OutputStream os, final PhotoshopApp13Data newData) throws ImageReadException, IOException, @@ -165,6 +181,9 @@ public void writeIPTC(final byte[] src, final OutputStream os, * OutputStream to write the image to. * @param newData * structure containing IPTC data. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException + * @throws org.apache.commons.imaging.ImageWriteException */ public void writeIPTC(final InputStream src, final OutputStream os, final PhotoshopApp13Data newData) throws ImageReadException, IOException, @@ -184,6 +203,9 @@ public void writeIPTC(final InputStream src, final OutputStream os, * OutputStream to write the image to. * @param newData * structure containing IPTC data. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException + * @throws org.apache.commons.imaging.ImageWriteException */ public void writeIPTC(final File src, final OutputStream os, final PhotoshopApp13Data newData) throws ImageReadException, IOException, ImageWriteException { @@ -202,6 +224,9 @@ public void writeIPTC(final File src, final OutputStream os, final PhotoshopApp1 * OutputStream to write the image to. * @param newData * structure containing IPTC data. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException + * @throws org.apache.commons.imaging.ImageWriteException */ public void writeIPTC(final ByteSource byteSource, final OutputStream os, PhotoshopApp13Data newData) throws ImageReadException, IOException, From 83998e4336b7016a2ee561b01a07a2b51c2c96f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 15:31:15 +0100 Subject: [PATCH 054/179] added bit depth --- .../commons/imaging/ImagingParametersPcx.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java index ccfdbd6629..836d44ea30 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java @@ -34,11 +34,14 @@ public final class ImagingParametersPcx extends ImagingParameters { // Please remember to change the javadoc also. private final Integer compressionLevelDefault = PcxConstants.PCX_COMPRESSION_UNCOMPRESSED; + private Integer bitDepth; + /** * This gives you a parameter object with default values. */ public ImagingParametersPcx() { this.compressionLevel = compressionLevelDefault; + this.bitDepth = null; } //****** compressionLevel ****** @@ -73,4 +76,33 @@ public void setCompressionLevel(final Integer value) { checkIfValueIsNull(value); this.compressionLevel = value; } + + //****** bitDepth ****** + + /** + * Returns {@code true} if the parameter bit depth was set, {@code false} else. + * @return + */ + public boolean isBitDepthPresent() { + return this.bitDepth == null; + } + + /** + * Returns a Integer for the bit depth of a PCX image. + * @return + */ + public Integer getBitDepth() { + Integer value = this.bitDepth; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Sets the bit depth of a PCX image. + * @param value + */ + public void setBitDepth(final Integer value) { + checkIfValueIsNull(value); + this.bitDepth = value; + } } From 3c58f66a5a233e284f3342fcbc269ae7e3945fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 15:33:41 +0100 Subject: [PATCH 055/179] removed default value for compression level --- .../commons/imaging/ImagingParametersPcx.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java index 836d44ea30..a2c347163f 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java @@ -20,32 +20,33 @@ package org.apache.commons.imaging; -import org.apache.commons.imaging.formats.pcx.PcxConstants; - /** * This class is a POJO holding data for parameters as requested in IMAGING-159. * It holds additional data needed for the PCX format only. */ public final class ImagingParametersPcx extends ImagingParameters { - private Integer compressionLevel; // PARAM_KEY_COMPRESSION - // This is the default value used for the parameter above. - // If you need to change the default value for this parameter, do it here. - // Please remember to change the javadoc also. - private final Integer compressionLevelDefault = PcxConstants.PCX_COMPRESSION_UNCOMPRESSED; - + private Integer compressionLevel; private Integer bitDepth; /** * This gives you a parameter object with default values. */ public ImagingParametersPcx() { - this.compressionLevel = compressionLevelDefault; + this.compressionLevel = null; this.bitDepth = null; } //****** compressionLevel ****** + /** + * Returns {@code true} if the parameter compression level was set, {@code false} else. + * @return + */ + public boolean isCompressionLevelPresent() { + return this.compressionLevel == null; + } + /** * Parameter used in write operations to indicate desired compression * algorithm. From b203d5a1e65a2e99493ded450505afa54d6f1f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 15:45:48 +0100 Subject: [PATCH 056/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/pcx/PcxImageParser.java | 32 ++++--- .../imaging/formats/pcx/PcxWriter.java | 88 +++++++------------ 2 files changed, 47 insertions(+), 73 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java index c605eef81a..aae762dabd 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pcx; @@ -34,8 +36,6 @@ import java.nio.ByteOrder; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; import java.util.Properties; import org.apache.commons.imaging.ImageFormat; @@ -43,12 +43,12 @@ import org.apache.commons.imaging.ImageInfo; import org.apache.commons.imaging.ImageParser; import org.apache.commons.imaging.ImageReadException; -import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.common.bytesource.ByteSource; import org.apache.commons.imaging.util.IoUtils; -import static org.apache.commons.imaging.ImagingConstants.*; import static org.apache.commons.imaging.common.BinaryFunctions.*; import static org.apache.commons.imaging.common.ByteConversions.*; @@ -94,13 +94,13 @@ protected ImageFormat[] getAcceptedTypes() { } @Override - public ImageMetadata getMetadata(final ByteSource byteSource, final Map params) + public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @Override - public ImageInfo getImageInfo(final ByteSource byteSource, final Map params) + public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final PcxHeader pcxHeader = readPcxHeader(byteSource); final Dimension size = getImageSize(byteSource, params); @@ -127,7 +127,7 @@ public ImageInfo getImageInfo(final ByteSource byteSource, final Map params) + public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final PcxHeader pcxHeader = readPcxHeader(byteSource); final int xSize = pcxHeader.xMax - pcxHeader.xMin + 1; @@ -142,7 +142,7 @@ public Dimension getImageSize(final ByteSource byteSource, final Map params) + public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @@ -514,13 +514,11 @@ private BufferedImage readImage(final PcxHeader pcxHeader, final InputStream is, @Override public final BufferedImage getBufferedImage(final ByteSource byteSource, - Map params) throws ImageReadException, IOException { - params = (params == null) ? new HashMap() : new HashMap(params); - boolean isStrict = false; - final Object strictness = params.get(PARAM_KEY_STRICT); - if (strictness != null) { - isStrict = ((Boolean) strictness).booleanValue(); - } + final ImagingParameters params) throws ImageReadException, IOException { + + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; + boolean isStrict = parameters.isStrict(); InputStream is = null; boolean canThrow = false; @@ -536,7 +534,7 @@ public final BufferedImage getBufferedImage(final ByteSource byteSource, } @Override - public void writeImage(final BufferedImage src, final OutputStream os, final Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { new PcxWriter(params).writeImage(src, os); } @@ -552,7 +550,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Map * @return Xmp Xml as String, if present. Otherwise, returns null. */ @Override - public String getXmpXml(final ByteSource byteSource, final Map params) + public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java index 05a3406987..4c695955ef 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java @@ -10,7 +10,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pcx; @@ -20,77 +21,52 @@ import java.io.OutputStream; import java.nio.ByteOrder; import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; import org.apache.commons.imaging.ImageWriteException; -import org.apache.commons.imaging.ImagingConstants; +import org.apache.commons.imaging.ImagingParameters; +import org.apache.commons.imaging.ImagingParametersPcx; import org.apache.commons.imaging.PixelDensity; import org.apache.commons.imaging.common.BinaryOutputStream; import org.apache.commons.imaging.palette.PaletteFactory; import org.apache.commons.imaging.palette.SimplePalette; class PcxWriter { - private int encoding; + private int encoding = PcxImageParser.PcxHeader.ENCODING_RLE; private int bitDepth = -1; - private PixelDensity pixelDensity; + private final PixelDensity pixelDensity; - public PcxWriter(Map params) throws ImageWriteException { - // make copy of params; we'll clear keys as we consume them. - params = (params == null) ? new HashMap() : new HashMap(params); - - // clear format key. - if (params.containsKey(ImagingConstants.PARAM_KEY_FORMAT)) { - params.remove(ImagingConstants.PARAM_KEY_FORMAT); + public PcxWriter(final ImagingParameters params) throws ImageWriteException { + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; + + // getting properties which are not specific for PCF format + if (parameters.isPixelDensityPresent()) { + this.pixelDensity = parameters.getPixelDensity(); } - - // uncompressed PCX files are not even documented in ZSoft's spec, - // let alone supported by most image viewers - encoding = PcxImageParser.PcxHeader.ENCODING_RLE; - if (params.containsKey(PcxConstants.PARAM_KEY_PCX_COMPRESSION)) { - final Object value = params.remove(PcxConstants.PARAM_KEY_PCX_COMPRESSION); - if (value != null) { - if (!(value instanceof Number)) { - throw new ImageWriteException( - "Invalid compression parameter: " + value); - } - final int compression = ((Number) value).intValue(); - if (compression == PcxConstants.PCX_COMPRESSION_UNCOMPRESSED) { - encoding = PcxImageParser.PcxHeader.ENCODING_UNCOMPRESSED; - } - } + else { + // DPI is mandatory, so we have to invent something + this.pixelDensity = PixelDensity.createFromPixelsPerInch(72, 72); } - - if (params.containsKey(PcxConstants.PARAM_KEY_PCX_BIT_DEPTH)) { - final Object value = params.remove(PcxConstants.PARAM_KEY_PCX_BIT_DEPTH); - if (value != null) { - if (!(value instanceof Number)) { - throw new ImageWriteException( - "Invalid bit depth parameter: " + value); + + // getting properties which are specific for PCF format if provided + // if we can cast the generic parameter object to a PCX-specific one they are + if (parameters instanceof ImagingParametersPcx) { + final ImagingParametersPcx parametersPcx = (ImagingParametersPcx) parameters; + + // get the compression level for PCX + // uncompressed PCX files are not even documented in ZSoft's spec, + // let alone supported by most image viewers + if (parametersPcx.isCompressionLevelPresent()) { + if (parametersPcx.getCompressionLevel() == PcxConstants.PCX_COMPRESSION_UNCOMPRESSED) { + this.encoding = PcxImageParser.PcxHeader.ENCODING_UNCOMPRESSED; } - bitDepth = ((Number) value).intValue(); } - } - - if (params.containsKey(ImagingConstants.PARAM_KEY_PIXEL_DENSITY)) { - final Object value = params.remove(ImagingConstants.PARAM_KEY_PIXEL_DENSITY); - if (value != null) { - if (!(value instanceof PixelDensity)) { - throw new ImageWriteException( - "Invalid pixel density parameter"); - } - pixelDensity = (PixelDensity) value; + + // get the bit depth for PCX + if (parametersPcx.isCompressionLevelPresent()) { + this.bitDepth = parametersPcx.getBitDepth(); } } - if (pixelDensity == null) { - // DPI is mandatory, so we have to invent something - pixelDensity = PixelDensity.createFromPixelsPerInch(72, 72); - } - - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageWriteException("Unknown parameter: " + firstKey); - } } private void writeScanLine(final BinaryOutputStream bos, final byte[] scanline) From 8e26d53d65c109073256772dbd3f24232f2bc23b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 15:46:23 +0100 Subject: [PATCH 057/179] added missing @throws tags to javadoc --- .../org/apache/commons/imaging/formats/pcx/PcxImageParser.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java index aae762dabd..d768f436a4 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java @@ -548,6 +548,8 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima * @param params * Map of optional parameters, defined in ImagingConstants. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ @Override public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) From 7bd251a7678c1a679b1df9cf9aa9843294281ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 15:47:56 +0100 Subject: [PATCH 058/179] Replaced parameter Map by ImagingParameters --- .../org/apache/commons/imaging/formats/dcx/DcxImageParser.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java index ffadce5e44..c5ecac24b9 100644 --- a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java @@ -26,7 +26,6 @@ import java.io.PrintWriter; import java.nio.ByteOrder; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import org.apache.commons.imaging.ImageFormat; @@ -194,7 +193,7 @@ public List getAllBufferedImages(final ByteSource byteSource) final ByteSourceInputStream pcxSource = new ByteSourceInputStream( stream, null); final BufferedImage image = pcxImageParser.getBufferedImage( - pcxSource, new HashMap()); + pcxSource, new ImagingParameters()); images.add(image); canThrow = true; } finally { From 479fee8a34870055f39fae89411d54e18297805b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 15:55:38 +0100 Subject: [PATCH 059/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/png/PngImageParser.java | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java index c7c1b6685f..e3358f2fff 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.png; @@ -29,9 +31,7 @@ import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.zip.InflaterInputStream; import org.apache.commons.imaging.ColorTools; @@ -41,6 +41,7 @@ import org.apache.commons.imaging.ImageParser; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.common.GenericImageMetadata; import org.apache.commons.imaging.common.bytesource.ByteSource; @@ -62,7 +63,6 @@ import org.apache.commons.imaging.icc.IccProfileParser; import org.apache.commons.imaging.util.IoUtils; -import static org.apache.commons.imaging.ImagingConstants.*; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class PngImageParser extends ImageParser { @@ -241,7 +241,7 @@ private List readChunks(final ByteSource byteSource, final ChunkType[] } @Override - public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final List chunks = readChunks(byteSource, new ChunkType[] { ChunkType.iCCP }, true); @@ -263,7 +263,7 @@ public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final List chunks = readChunks(byteSource, new ChunkType[] { ChunkType.IHDR, }, true); @@ -281,7 +281,7 @@ public Dimension getImageSize(final ByteSource byteSource, final Map params) + public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final List chunks = readChunks(byteSource, new ChunkType[] { ChunkType.tEXt, ChunkType.zTXt, }, true); @@ -333,7 +333,7 @@ private TransparencyFilter getTransparencyFilter(PngColorType pngColorType, PngC } @Override - public ImageInfo getImageInfo(final ByteSource byteSource, final Map params) + public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final List chunks = readChunks(byteSource, new ChunkType[] { ChunkType.IHDR, @@ -469,18 +469,8 @@ public ImageInfo getImageInfo(final ByteSource byteSource, final Map params) + public BufferedImage getBufferedImage(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { - params = (params == null) ? new HashMap() : new HashMap(params); - - if (params.containsKey(PARAM_KEY_VERBOSE)) { - params.remove(PARAM_KEY_VERBOSE); - } - - // if (params.size() > 0) { - // Object firstKey = params.keySet().iterator().next(); - // throw new ImageWriteException("Unknown parameter: " + firstKey); - // } final List chunks = readChunks(byteSource, new ChunkType[] { ChunkType.IHDR, @@ -692,13 +682,13 @@ public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource) } @Override - public void writeImage(final BufferedImage src, final OutputStream os, final Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { new PngWriter(params).writeImage(src, os, params); } @Override - public String getXmpXml(final ByteSource byteSource, final Map params) + public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final List chunks = readChunks(byteSource, new ChunkType[] { ChunkType.iTXt }, false); From 7eb3b2132737c8dc8794508facd20fc6554e1641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 15:56:35 +0100 Subject: [PATCH 060/179] added missing @throws tags to javadoc --- .../org/apache/commons/imaging/formats/png/PngImageParser.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java index e3358f2fff..87d7fc3f70 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java @@ -102,7 +102,10 @@ public static String getChunkTypeName(final int chunkType) { } /** + * @param is * @return List of String-formatted chunk types, ie. "tRNs". + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ public List getChuckTypes(final InputStream is) throws ImageReadException, IOException { From e2c8d0927f125ae6701198e51f05f2acdb63d55a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 17:10:06 +0100 Subject: [PATCH 061/179] added bit depth --- .../commons/imaging/ImagingParametersPng.java | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/main/java/org/apache/commons/imaging/ImagingParametersPng.java diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java new file mode 100644 index 0000000000..ea396bfe1f --- /dev/null +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Created 2015 by Michael Gross, mgmechanics@mgmechanics.de + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de + */ + +package org.apache.commons.imaging; + +/** + * This class is a POJO holding data for parameters as requested in IMAGING-159. + * It holds additional data needed for the PNG format only. + */ +public final class ImagingParametersPng extends ImagingParameters { + + private Byte bitDepth; + + /** + * This gives you a parameter object with default values. + */ + public ImagingParametersPng() { + this.bitDepth = null; + } + + //****** bitDepth ****** + + /** + * Returns {@code true} if the parameter bit depth was set, {@code false} else. + * @return + */ + public boolean isBitDepthPresent() { + return this.bitDepth == null; + } + + /** + * Returns a Byte for the bit depth of a PNG image. + * @return + */ + public Byte getBitDepth() { + Byte value = this.bitDepth; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Sets the bit depth of a PNG image. + * @param value + */ + public void setBitDepth(final Byte value) { + checkIfValueIsNull(value); + this.bitDepth = value; + } +} From e4e151d36e234507e2493c42425c6036fb015ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 17:13:13 +0100 Subject: [PATCH 062/179] set default values in constructor rather than in class --- .../org/apache/commons/imaging/formats/pcx/PcxWriter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java index 4c695955ef..2f2d3b3ce3 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java @@ -31,11 +31,15 @@ import org.apache.commons.imaging.palette.SimplePalette; class PcxWriter { - private int encoding = PcxImageParser.PcxHeader.ENCODING_RLE; - private int bitDepth = -1; + private int encoding; + private int bitDepth; private final PixelDensity pixelDensity; public PcxWriter(final ImagingParameters params) throws ImageWriteException { + // set default values + this.encoding = PcxImageParser.PcxHeader.ENCODING_RLE; + this.bitDepth = -1; + // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; From 5f063ee3e329b18c29deaec18f6b24d64d9da538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 17:26:45 +0100 Subject: [PATCH 063/179] added force indexed color and true color --- .../commons/imaging/ImagingParametersPng.java | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java index ea396bfe1f..b9b080773a 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java @@ -27,12 +27,16 @@ public final class ImagingParametersPng extends ImagingParameters { private Byte bitDepth; + private boolean forceIndexedColor; + private boolean forceTrueColor; /** * This gives you a parameter object with default values. */ public ImagingParametersPng() { this.bitDepth = null; + this.forceIndexedColor = false; + this.forceTrueColor = false; } //****** bitDepth ****** @@ -63,4 +67,52 @@ public void setBitDepth(final Byte value) { checkIfValueIsNull(value); this.bitDepth = value; } + + // ****** forceIndexedColor ****** + + /** + * force indexed color + */ + public void enableForceIndexedColor() { + this.forceIndexedColor = true; + } + + /** + * don't force indexed color + */ + public void disableForceIndexedColor() { + this.forceIndexedColor = false; + } + + /** + * {@code true} = force indexed color; {@code false} = don't force indexed color + * @return + */ + public boolean forceIndexedColor() { + return this.forceIndexedColor; + } + + // ****** forceTrueColor ****** + + /** + * force indexed color + */ + public void enableForceTrueColor() { + this.forceTrueColor = true; + } + + /** + * don't force indexed color + */ + public void disableForceTrueColor() { + this.forceTrueColor = false; + } + + /** + * {@code true} = force true color; {@code false} = don't force true color + * @return + */ + public boolean forceTrueColor() { + return this.forceTrueColor; + } } From 61b96ea7dfba21ace522bcd1a7f7cea032a6c413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 17:31:55 +0100 Subject: [PATCH 064/179] change types to native types were possible --- .../org/apache/commons/imaging/ImagingParametersPng.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java index b9b080773a..1d38ef76ba 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java @@ -50,10 +50,10 @@ public boolean isBitDepthPresent() { } /** - * Returns a Byte for the bit depth of a PNG image. + * Returns the bit depth of a PNG image. * @return */ - public Byte getBitDepth() { + public byte getBitDepth() { Byte value = this.bitDepth; checkIfParameterIsPresent(value); return value; @@ -63,7 +63,7 @@ public Byte getBitDepth() { * Sets the bit depth of a PNG image. * @param value */ - public void setBitDepth(final Byte value) { + public void setBitDepth(final byte value) { checkIfValueIsNull(value); this.bitDepth = value; } From c1a697936dc9ec32db89f27cf3210014e9e348a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 17:34:58 +0100 Subject: [PATCH 065/179] change types to native types were possible --- .../commons/imaging/ImagingParameters.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index d0718d9ca4..a17d396c81 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -40,9 +40,9 @@ */ public class ImagingParameters { - private Boolean verbose; //PARAM_KEY_VERBOSE + private boolean verbose; //PARAM_KEY_VERBOSE - private Boolean strict; // PARAM_KEY_STRICT + private boolean strict; // PARAM_KEY_STRICT private String fileNameHint; // PARAM_KEY_FILENAME @@ -58,8 +58,8 @@ public class ImagingParameters { * This gives you a parameter object with default values. */ public ImagingParameters() { - this.verbose = Boolean.FALSE; - this.strict = Boolean.FALSE; + this.verbose = false; + this.strict = false; this.fileNameHint = null; this.xmpXmlAsString = null; this.imageFormat = null; @@ -74,10 +74,10 @@ public ImagingParameters() { * Parameter applies to read and write operations. *

* Default value: verbose mode disabled. - * @return Valid values: {@code Boolean.TRUE} means {@literal "verbose mode enabled"} + * @return Valid values: {@code true} means {@literal "verbose mode enabled"} * and {@code Boolean.FALSE} means {@literal "verbose mode disabled"}. */ - public Boolean isVerbose() { + public boolean isVerbose() { return this.verbose; } @@ -86,7 +86,7 @@ public Boolean isVerbose() { * Parameter applies to read and write operations. */ public void enableVerbose() { - this.verbose = Boolean.TRUE; + this.verbose = true; } /** @@ -94,7 +94,7 @@ public void enableVerbose() { * Parameter applies to read and write operations. */ public void disableVerbose() { - this.verbose = Boolean.FALSE; + this.verbose = false; } //****** strict ****** @@ -104,11 +104,11 @@ public void disableVerbose() { * files, or whether to tolerate small problems. *

* Default value: tolerate small problems. - * @return Valid values: {@code Boolean.TRUE} causes it to throw exceptions - * when parsing invalid files and {@code Boolean.FALSE} let it tolerate small problems. + * @return Valid values: {@code true} causes it to throw exceptions + * when parsing invalid files and {@code false} let it tolerate small problems. * @see org.apache.commons.imaging.formats.tiff.constants.TiffConstants */ - public Boolean isStrict() { + public boolean isStrict() { return this.strict; } @@ -119,7 +119,7 @@ public Boolean isStrict() { * parsing invalid files. */ public void enableStrict() { - this.strict = Boolean.TRUE; + this.strict = true; } /** @@ -129,7 +129,7 @@ public void enableStrict() { * */ public void disableStrict() { - this.strict = Boolean.FALSE; + this.strict = false; } //****** fileNameHint ****** From 2d0d773845e483223dda438dc9dcea39457d3413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 17:37:12 +0100 Subject: [PATCH 066/179] change types to native types were possible --- .../apache/commons/imaging/ImagingParametersPcx.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java index a2c347163f..942d32c625 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java @@ -58,7 +58,7 @@ public boolean isCompressionLevelPresent() { * PcxConstants.PCX_COMPRESSION_UNCOMPRESSED, * PcxConstants.PCX_COMPRESSION_RLE */ - public Integer getCompressionLevel() { + public int getCompressionLevel() { Integer value = this.compressionLevel; checkIfParameterIsPresent(value); return value; @@ -73,8 +73,7 @@ public Integer getCompressionLevel() { * PcxConstants.PCX_COMPRESSION_UNCOMPRESSED, * PcxConstants.PCX_COMPRESSION_RLE */ - public void setCompressionLevel(final Integer value) { - checkIfValueIsNull(value); + public void setCompressionLevel(final int value) { this.compressionLevel = value; } @@ -89,10 +88,10 @@ public boolean isBitDepthPresent() { } /** - * Returns a Integer for the bit depth of a PCX image. + * Returns a value for the bit depth of a PCX image. * @return */ - public Integer getBitDepth() { + public int getBitDepth() { Integer value = this.bitDepth; checkIfParameterIsPresent(value); return value; @@ -102,8 +101,7 @@ public Integer getBitDepth() { * Sets the bit depth of a PCX image. * @param value */ - public void setBitDepth(final Integer value) { - checkIfValueIsNull(value); + public void setBitDepth(final int value) { this.bitDepth = value; } } From eb3ddfb6924456caf5cd5c4efd8b5b4305e291d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 17:39:10 +0100 Subject: [PATCH 067/179] change types to native types were possible --- .../org/apache/commons/imaging/ImagingParametersTiff.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 7cd67d5309..89e0b814ad 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -60,7 +60,7 @@ public ImagingParametersTiff() { * TiffConstants.TIFF_COMPRESSION_LZW, * TiffConstants.TIFF_COMPRESSION_PACKBITS */ - public Integer getCompressionLevel() { + public int getCompressionLevel() { Integer value = this.compressionLevel; checkIfParameterIsPresent(value); return value; @@ -77,8 +77,7 @@ public Integer getCompressionLevel() { * TiffConstants.TIFF_COMPRESSION_LZW, * TiffConstants.TIFF_COMPRESSION_PACKBITS */ - public void setCompressionLevel(final Integer value) { - checkIfValueIsNull(value); + public void setCompressionLevel(final int value) { this.compressionLevel = value; } From bf067ac36c2fb5edb05b972b7b592153c612057a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 17:40:15 +0100 Subject: [PATCH 068/179] change types to native types were possible --- .../commons/imaging/ImagingParametersJpeg.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index 422bfce15e..7fcaf54121 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -32,7 +32,7 @@ public final class ImagingParametersJpeg extends ImagingParameters { * This gives you a parameter object with default values. */ public ImagingParametersJpeg() { - this.readThumbnailsValue = Boolean.FALSE; + this.readThumbnailsValue = false; } //****** readThumbnails ****** @@ -42,10 +42,10 @@ public ImagingParametersJpeg() { * Only applies to read EXIF metadata from JPEG/JFIF files. *

* Default value: don't read embedded thumbnails - * @return Valid values:{@code Boolean.TRUE} (causes it to read embedded thumbnails - * and {@code Boolean.FALSE} (don't read embedded thumbnails). + * @return Valid values:{@code true} (causes it to read embedded thumbnails + * and {@code false} (don't read embedded thumbnails). */ - public Boolean readThumbnails() { + public boolean readThumbnails() { return this.readThumbnailsValue; } @@ -55,7 +55,7 @@ public Boolean readThumbnails() { * Only applies to read EXIF metadata from JPEG/JFIF files. */ public void enableReadThumbnails() { - this.readThumbnailsValue = Boolean.TRUE; + this.readThumbnailsValue = true; } /** @@ -64,6 +64,6 @@ public void enableReadThumbnails() { * Only applies to read EXIF metadata from JPEG/JFIF files. */ public void disableReadThumbnails() { - this.readThumbnailsValue = Boolean.FALSE; + this.readThumbnailsValue = false; } } From 9722ce10d86914acc8f9c0bc10bec73db25fbb5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 17:43:05 +0100 Subject: [PATCH 069/179] removed default value for compression level --- .../commons/imaging/ImagingParametersTiff.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 89e0b814ad..31b4b7bf2c 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -20,7 +20,6 @@ package org.apache.commons.imaging; -import org.apache.commons.imaging.formats.tiff.constants.TiffConstants; import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet; /** @@ -30,10 +29,6 @@ public final class ImagingParametersTiff extends ImagingParameters { private Integer compressionLevel; // PARAM_KEY_COMPRESSION - // This is the default value used for the parameter above. - // If you need to change the default value for this parameter, do it here. - // Please remember to change the javadoc also. - private final Integer compressionLevelDefault = TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED; private TiffOutputSet outputSetForMetaData; // PARAM_KEY_EXIF @@ -41,12 +36,20 @@ public final class ImagingParametersTiff extends ImagingParameters { * This gives you a parameter object with default values. */ public ImagingParametersTiff() { - this.compressionLevel = compressionLevelDefault; + this.compressionLevel = null; this.outputSetForMetaData = null; } //****** compressionLevel ****** + /** + * Returns {@code true} if there is a value present, {@false} else. + * @return + */ + public boolean isCompressionLevelPresent() { + return this.compressionLevel == null; + } + /** * Parameter used in write operations to indicate desired compression * algorithm. From fc9bb64fdaa22dd8a802a9a5c163b86c4d43a6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 18:14:44 +0100 Subject: [PATCH 070/179] added textChunks --- .../commons/imaging/ImagingParametersPng.java | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java index 1d38ef76ba..bc32a51893 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java @@ -29,6 +29,7 @@ public final class ImagingParametersPng extends ImagingParameters { private Byte bitDepth; private boolean forceIndexedColor; private boolean forceTrueColor; + private String textChunks; /** * This gives you a parameter object with default values. @@ -37,6 +38,7 @@ public ImagingParametersPng() { this.bitDepth = null; this.forceIndexedColor = false; this.forceTrueColor = false; + this.textChunks = null; } //****** bitDepth ****** @@ -51,7 +53,7 @@ public boolean isBitDepthPresent() { /** * Returns the bit depth of a PNG image. - * @return + * @return the bit depth */ public byte getBitDepth() { Byte value = this.bitDepth; @@ -61,10 +63,9 @@ public byte getBitDepth() { /** * Sets the bit depth of a PNG image. - * @param value + * @param value the bit depth */ public void setBitDepth(final byte value) { - checkIfValueIsNull(value); this.bitDepth = value; } @@ -115,4 +116,33 @@ public void disableForceTrueColor() { public boolean forceTrueColor() { return this.forceTrueColor; } + + //****** textChunks ****** + + /** + * Returns {@code true} if text chunks are present, {@code false} else. + * @return + */ + public boolean areTextChunksPresent() { + return this.textChunks == null; + } + + /** + * Returns the text chunks for a PNG image. + * @return the text chunks + */ + public String getTextChunks() { + String value = this.textChunks; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Sets the text chunks for a PNG image. + * @param value the text chunks + */ + public void setTextChunks(final String value) { + checkIfValueIsNull(value); + this.textChunks = value; + } } From 3f43350517fd3ff88b7d40cf1518e568f99a7f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 18:35:30 +0100 Subject: [PATCH 071/179] added textChunks as List --- .../commons/imaging/ImagingParametersPng.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java index bc32a51893..304fcb1f12 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java @@ -20,6 +20,9 @@ package org.apache.commons.imaging; +import java.util.List; +import org.apache.commons.imaging.formats.png.PngText; + /** * This class is a POJO holding data for parameters as requested in IMAGING-159. * It holds additional data needed for the PNG format only. @@ -29,7 +32,7 @@ public final class ImagingParametersPng extends ImagingParameters { private Byte bitDepth; private boolean forceIndexedColor; private boolean forceTrueColor; - private String textChunks; + private List textChunks; /** * This gives you a parameter object with default values. @@ -123,7 +126,7 @@ public boolean forceTrueColor() { * Returns {@code true} if text chunks are present, {@code false} else. * @return */ - public boolean areTextChunksPresent() { + public boolean hasTextChunks() { return this.textChunks == null; } @@ -131,18 +134,18 @@ public boolean areTextChunksPresent() { * Returns the text chunks for a PNG image. * @return the text chunks */ - public String getTextChunks() { - String value = this.textChunks; + public List getTextChunks() { + List value = this.textChunks; checkIfParameterIsPresent(value); return value; } /** * Sets the text chunks for a PNG image. - * @param value the text chunks + * @param textChunks the text chunks */ - public void setTextChunks(final String value) { - checkIfValueIsNull(value); - this.textChunks = value; + public void setTextChunks(final List textChunks) { + checkIfValueIsNull(textChunks); + this.textChunks = textChunks; } } From 50601ae74acbfbdbf34fe5318ddebb844628185b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 18:35:46 +0100 Subject: [PATCH 072/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/png/PngWriter.java | 133 +++++++++--------- 1 file changed, 65 insertions(+), 68 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java index 7b0be7e6fe..9aaf7318be 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.png; @@ -21,13 +23,12 @@ import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.zip.DeflaterOutputStream; import org.apache.commons.imaging.ImageWriteException; -import org.apache.commons.imaging.ImagingConstants; +import org.apache.commons.imaging.ImagingParameters; +import org.apache.commons.imaging.ImagingParametersPng; import org.apache.commons.imaging.PixelDensity; import org.apache.commons.imaging.palette.Palette; import org.apache.commons.imaging.palette.PaletteFactory; @@ -42,8 +43,8 @@ public PngWriter(final boolean verbose) { this.verbose = verbose; } - public PngWriter(final Map params) { - this.verbose = params != null && Boolean.TRUE.equals(params.get(ImagingConstants.PARAM_KEY_VERBOSE)); + public PngWriter(final ImagingParameters params) { + this.verbose = params != null && Boolean.TRUE.equals(params.isVerbose()); } /* @@ -297,12 +298,14 @@ private void writeChunkPHYS(final OutputStream os, final int xPPU, final int yPP writeChunk(os, ChunkType.pHYs, bytes); } - private byte getBitDepth(final PngColorType pngColorType, final Map params) { + private byte getBitDepth(final PngColorType pngColorType, final ImagingParameters params) { byte depth = 8; - - Object o = params.get(PngConstants.PARAM_KEY_PNG_BIT_DEPTH); - if (o instanceof Number) { - depth = ((Number) o).byteValue(); + + if (params instanceof ImagingParametersPng) { + final ImagingParametersPng parameters = (ImagingParametersPng) params; + if (parameters.isBitDepthPresent()) { + depth = parameters.getBitDepth(); + } } return pngColorType.isBitDepthAllowed(depth) ? depth : 8; @@ -366,42 +369,10 @@ public int getPaletteIndex(final int rgb) throws ImageWriteException { tEXt Yes None zTXt Yes None */ - public void writeImage(final BufferedImage src, final OutputStream os, Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { - // make copy of params; we'll clear keys as we consume them. - params = new HashMap(params); - - // clear format key. - if (params.containsKey(ImagingConstants.PARAM_KEY_FORMAT)) { - params.remove(ImagingConstants.PARAM_KEY_FORMAT); - } - // clear verbose key. - if (params.containsKey(ImagingConstants.PARAM_KEY_VERBOSE)) { - params.remove(ImagingConstants.PARAM_KEY_VERBOSE); - } - - final Map rawParams = new HashMap(params); - if (params.containsKey(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR)) { - params.remove(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR); - } - if (params.containsKey(PngConstants.PARAM_KEY_PNG_FORCE_INDEXED_COLOR)) { - params.remove(PngConstants.PARAM_KEY_PNG_FORCE_INDEXED_COLOR); - } - if (params.containsKey(PngConstants.PARAM_KEY_PNG_BIT_DEPTH)) { - params.remove(PngConstants.PARAM_KEY_PNG_BIT_DEPTH); - } - if (params.containsKey(ImagingConstants.PARAM_KEY_XMP_XML)) { - params.remove(ImagingConstants.PARAM_KEY_XMP_XML); - } - if (params.containsKey(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS)) { - params.remove(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS); - } - params.remove(ImagingConstants.PARAM_KEY_PIXEL_DENSITY); - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageWriteException("Unknown parameter: " + firstKey); - } - params = rawParams; + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; final int width = src.getWidth(); final int height = src.getHeight(); @@ -419,8 +390,22 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map outputTexts = (List) params.get(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS); - for (Object outputText : outputTexts) { - final PngText text = (PngText) outputText; - if (text instanceof PngText.Text) { - writeChunktEXt(os, (PngText.Text) text); - } else if (text instanceof PngText.Ztxt) { - writeChunkzTXt(os, (PngText.Ztxt) text); - } else if (text instanceof PngText.Itxt) { - writeChunkiTXt(os, (PngText.Itxt) text); - } else { - throw new ImageWriteException( - "Unknown text to embed in PNG: " + text); + + // text chunks are parameters specific for PNG images + // so we need to ask first if parameters specific for PNG images are provided + // than ask for text chunks + if (parameters instanceof ImagingParametersPng) { + final ImagingParametersPng parametersPng = (ImagingParametersPng) parameters; + if (parametersPng.hasTextChunks()) { + final List outputTexts = parametersPng.getTextChunks(); + for (PngText text : outputTexts) { + // there are different kind of png texts + // each one requires a different action + if (text instanceof PngText.Text) { + writeChunktEXt(os, (PngText.Text) text); + } + else if (text instanceof PngText.Ztxt) { + writeChunkzTXt(os, (PngText.Ztxt) text); + } + else if (text instanceof PngText.Itxt) { + writeChunkiTXt(os, (PngText.Itxt) text); + } + else { + throw new ImageWriteException( + "Unknown text to embed in PNG: " + text); + } } } } From a1d01d4ec1a9ec331fef88386725b081a6d98129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 7 Feb 2015 19:45:31 +0100 Subject: [PATCH 073/179] added parameters for PNM --- .../commons/imaging/ImagingParametersPnm.java | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java new file mode 100644 index 0000000000..2cac81bad9 --- /dev/null +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Created 2015 by Michael Gross, mgmechanics@mgmechanics.de + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de + */ + +package org.apache.commons.imaging; + +/** + * This class is a POJO holding data for parameters as requested in IMAGING-159. + * It holds additional data needed for the PNM format only. + */ +public final class ImagingParametersPnm extends ImagingParameters { + + private boolean useRawbits; + + /** + * This gives you a parameter object with default values. + */ + public ImagingParametersPnm() { + this.useRawbits = true; + } + + // ****** useRawbits ****** + + /** + * use raw bits + */ + public void enableUseRawbits() { + this.useRawbits = true; + } + + /** + * don't use raw bits + */ + public void disableUseRawbits() { + this.useRawbits = false; + } + + /** + * {@code true} = use raw bits; {@code false} = don't use raw bits + * @return + */ + public boolean useRawbits() { + return this.useRawbits; + } +} From 51a7b3cad8d2ee84d0cad800a61a8fb242b0b57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 15:30:45 +0100 Subject: [PATCH 074/179] renamed method --- .../java/org/apache/commons/imaging/ImagingParametersPnm.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java index 2cac81bad9..7cc2f3290d 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java @@ -35,7 +35,7 @@ public ImagingParametersPnm() { this.useRawbits = true; } - // ****** useRawbits ****** + // ****** getUseRawbits ****** /** * use raw bits @@ -55,7 +55,7 @@ public void disableUseRawbits() { * {@code true} = use raw bits; {@code false} = don't use raw bits * @return */ - public boolean useRawbits() { + public boolean getUseRawbits() { return this.useRawbits; } } From 5de82ae234cbd7c24913329126d38c7d478ef5d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 15:33:21 +0100 Subject: [PATCH 075/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/pnm/PnmImageParser.java | 55 +++++++------------ 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java index c333d02f5e..7e79f26d3a 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pnm; @@ -26,7 +28,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.StringTokenizer; import org.apache.commons.imaging.ImageFormat; @@ -35,13 +36,14 @@ import org.apache.commons.imaging.ImageParser; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; +import org.apache.commons.imaging.ImagingParametersPnm; import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.common.ImageBuilder; import org.apache.commons.imaging.common.bytesource.ByteSource; import org.apache.commons.imaging.palette.PaletteFactory; import org.apache.commons.imaging.util.IoUtils; -import static org.apache.commons.imaging.ImagingConstants.*; import static org.apache.commons.imaging.common.BinaryFunctions.*; public class PnmImageParser extends ImageParser { @@ -201,13 +203,13 @@ private FileInfo readHeader(final ByteSource byteSource) } @Override - public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @Override - public Dimension getImageSize(final ByteSource byteSource, final Map params) + public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final FileInfo info = readHeader(byteSource); @@ -219,13 +221,13 @@ public Dimension getImageSize(final ByteSource byteSource, final Map params) + public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @Override - public ImageInfo getImageInfo(final ByteSource byteSource, final Map params) + public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final FileInfo info = readHeader(byteSource); @@ -282,7 +284,7 @@ public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource) } @Override - public BufferedImage getBufferedImage(final ByteSource byteSource, final Map params) + public BufferedImage getBufferedImage(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { InputStream is = null; boolean canThrow = false; @@ -308,22 +310,16 @@ public BufferedImage getBufferedImage(final ByteSource byteSource, final Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { PnmWriter writer = null; boolean useRawbits = true; final boolean hasAlpha = new PaletteFactory().hasTransparency(src); if (params != null) { - final Object useRawbitsParam = params.get(PARAM_KEY_PNM_RAWBITS); - if (useRawbitsParam != null) { - if (useRawbitsParam.equals(PARAM_VALUE_PNM_RAWBITS_NO)) { - useRawbits = false; - } - } - - final Object subtype = params.get(PARAM_KEY_FORMAT); - if (subtype != null) { + // read generic parameters + if (params.isImageFormatPresent()) { + final ImageFormat subtype = params.getImageFormat(); if (subtype.equals(ImageFormats.PBM)) { writer = new PbmWriter(useRawbits); } else if (subtype.equals(ImageFormats.PGM)) { @@ -334,6 +330,12 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map(params); - } else { - params = new HashMap(); - } - - // clear format key. - if (params.containsKey(PARAM_KEY_FORMAT)) { - params.remove(PARAM_KEY_FORMAT); - } - - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageWriteException("Unknown parameter: " + firstKey); - } - writer.writeImage(src, os, params); } @@ -375,7 +360,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map params) + public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } From 3697cd9068b2cf9fadb0b4b2193f62043d0e60fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 15:34:08 +0100 Subject: [PATCH 076/179] removed unused import, added missing @throws tags to javadoc --- .../org/apache/commons/imaging/formats/pnm/PnmImageParser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java index 7e79f26d3a..66a2b88f8f 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java @@ -26,7 +26,6 @@ import java.io.PrintWriter; import java.nio.ByteOrder; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.StringTokenizer; @@ -358,6 +357,8 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima * @param params * Map of optional parameters, defined in ImagingConstants. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ @Override public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) From 93085b5d83feeb7339e9bf5b5482284b9850ea7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 15:34:18 +0100 Subject: [PATCH 077/179] Replaced parameter Map by ImagingParameters --- .../org/apache/commons/imaging/formats/pnm/PnmWriter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java index 5a73362bbe..dadbb7d922 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java @@ -19,13 +19,13 @@ import java.awt.image.BufferedImage; import java.io.IOException; import java.io.OutputStream; -import java.util.Map; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; interface PnmWriter { void writeImage(BufferedImage src, OutputStream os, - Map params) throws ImageWriteException, IOException; + final ImagingParameters params) throws ImageWriteException, IOException; } From 8d8c81645de97fabea51064ecc06d0db31ce4d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 15:36:00 +0100 Subject: [PATCH 078/179] added note that I changed the file to licence header --- .../java/org/apache/commons/imaging/formats/pnm/PnmWriter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java index dadbb7d922..4e7536e52a 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pnm; From 05621786629bf66da2daedc3c4b635c168fed5d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 15:41:43 +0100 Subject: [PATCH 079/179] Replaced parameter Map by ImagingParameters --- .../org/apache/commons/imaging/formats/pnm/PamWriter.java | 8 +++++--- .../org/apache/commons/imaging/formats/pnm/PbmWriter.java | 8 +++++--- .../org/apache/commons/imaging/formats/pnm/PgmWriter.java | 8 +++++--- .../org/apache/commons/imaging/formats/pnm/PpmWriter.java | 8 +++++--- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java index 61ecf5d396..9365c27807 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pnm; @@ -20,14 +22,14 @@ import java.awt.image.BufferedImage; import java.io.IOException; import java.io.OutputStream; -import java.util.Map; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; class PamWriter implements PnmWriter { - public void writeImage(final BufferedImage src, final OutputStream os, - final Map params) throws ImageWriteException, IOException { + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) + throws ImageWriteException, IOException { os.write(PnmConstants.PNM_PREFIX_BYTE); os.write(PnmConstants.PAM_RAW_CODE); diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java index 19a6740770..642c3609c5 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java @@ -13,25 +13,27 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pnm; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.OutputStream; -import java.util.Map; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; class PbmWriter implements PnmWriter { - private boolean rawbits; + private final boolean rawbits; public PbmWriter(final boolean rawbits) { this.rawbits = rawbits; } - public void writeImage(final BufferedImage src, final OutputStream os, final Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { os.write(PnmConstants.PNM_PREFIX_BYTE); os.write(rawbits ? PnmConstants.PBM_RAW_CODE : PnmConstants.PBM_TEXT_CODE); diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java index be4a54ab0c..7ac474a1eb 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java @@ -13,25 +13,27 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pnm; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.OutputStream; -import java.util.Map; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; class PgmWriter implements PnmWriter { - private boolean rawbits; + private final boolean rawbits; public PgmWriter(boolean rawbits) { this.rawbits = rawbits; } - public void writeImage(final BufferedImage src, final OutputStream os, final Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { // System.out.println // (b1 == 0x50 && b2 == 0x36) diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java index d4577ae78c..44d112ddc9 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java @@ -13,25 +13,27 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pnm; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.OutputStream; -import java.util.Map; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; class PpmWriter implements PnmWriter { - private boolean rawbits; + private final boolean rawbits; public PpmWriter(boolean rawbits) { this.rawbits = rawbits; } - public void writeImage(final BufferedImage src, final OutputStream os, final Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { // System.out.println // (b1 == 0x50 && b2 == 0x36) From 748f64fd66d24b8af98929700329d418facc1b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 15:43:52 +0100 Subject: [PATCH 080/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/psd/PsdImageParser.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java index 9f1a3505f9..704daef352 100644 --- a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.psd; @@ -26,13 +28,13 @@ import java.nio.ByteOrder; import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.ImageFormat; import org.apache.commons.imaging.ImageFormats; import org.apache.commons.imaging.ImageInfo; import org.apache.commons.imaging.ImageParser; import org.apache.commons.imaging.ImageReadException; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.common.bytesource.ByteSource; import org.apache.commons.imaging.formats.psd.dataparsers.DataParser; @@ -412,7 +414,7 @@ private ImageContents readImageContents(final ByteSource byteSource) } @Override - public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final List blocks = readImageResourceBlocks(byteSource, new int[] { IMAGE_RESOURCE_ID_ICC_PROFILE, }, 1); @@ -430,7 +432,7 @@ public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final PsdHeaderInfo bhi = readHeader(byteSource); if (bhi == null) { @@ -442,7 +444,7 @@ public Dimension getImageSize(final ByteSource byteSource, final Map params) + public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @@ -472,7 +474,7 @@ private int getChannelsPerMode(final int mode) { } @Override - public ImageInfo getImageInfo(final ByteSource byteSource, final Map params) + public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final ImageContents imageContents = readImageContents(byteSource); // ImageContents imageContents = readImage(byteSource, false); @@ -596,7 +598,7 @@ public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource) } @Override - public BufferedImage getBufferedImage(final ByteSource byteSource, final Map params) + public BufferedImage getBufferedImage(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final ImageContents imageContents = readImageContents(byteSource); // ImageContents imageContents = readImage(byteSource, false); @@ -720,7 +722,7 @@ public BufferedImage getBufferedImage(final ByteSource byteSource, final Map params) + public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final ImageContents imageContents = readImageContents(byteSource); From 8e1b2721320c02972e0b88c626db09e1534a768c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 15:44:17 +0100 Subject: [PATCH 081/179] added missing @throws tags to javadoc --- .../org/apache/commons/imaging/formats/psd/PsdImageParser.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java index 704daef352..58157a12bf 100644 --- a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java @@ -720,6 +720,8 @@ public BufferedImage getBufferedImage(final ByteSource byteSource, final Imaging * @param params * Map of optional parameters, defined in ImagingConstants. * @return Xmp Xml as String, if present. Otherwise, returns null. + * @throws org.apache.commons.imaging.ImageReadException + * @throws java.io.IOException */ @Override public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) From ec03c5aae65b85ce72bfeee2ccfd3d650cd5fcac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 15:45:52 +0100 Subject: [PATCH 082/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/rgbe/RgbeImageParser.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java b/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java index 6ad05c37b8..9086d026d5 100644 --- a/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.rgbe; @@ -29,13 +31,13 @@ import java.io.IOException; import java.nio.ByteOrder; import java.util.ArrayList; -import java.util.Map; import org.apache.commons.imaging.ImageFormat; import org.apache.commons.imaging.ImageFormats; import org.apache.commons.imaging.ImageInfo; import org.apache.commons.imaging.ImageParser; import org.apache.commons.imaging.ImageReadException; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.common.bytesource.ByteSource; import org.apache.commons.imaging.util.IoUtils; @@ -72,7 +74,7 @@ protected ImageFormat[] getAcceptedTypes() { } @Override - public ImageMetadata getMetadata(final ByteSource byteSource, final Map params) + public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final RgbeInfo info = new RgbeInfo(byteSource); boolean canThrow = false; @@ -86,7 +88,7 @@ public ImageMetadata getMetadata(final ByteSource byteSource, final Map params) + public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final RgbeInfo info = new RgbeInfo(byteSource); boolean canThrow = false; @@ -106,7 +108,7 @@ public ImageInfo getImageInfo(final ByteSource byteSource, final Map params) + public BufferedImage getBufferedImage(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final RgbeInfo info = new RgbeInfo(byteSource); boolean canThrow = false; @@ -132,7 +134,7 @@ public BufferedImage getBufferedImage(final ByteSource byteSource, final Map params) + public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final RgbeInfo info = new RgbeInfo(byteSource); boolean canThrow = false; @@ -146,13 +148,13 @@ public Dimension getImageSize(final ByteSource byteSource, final Map params) + public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } @Override - public String getXmpXml(final ByteSource byteSource, final Map params) + public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { return null; } From 05d111d11bfc866a75779b282b06fb8d26135bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 15:47:09 +0100 Subject: [PATCH 083/179] removed unused import --- .../commons/imaging/formats/tiff/constants/TiffConstants.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java index c12a66b8b9..76e3b35885 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java @@ -18,8 +18,6 @@ import java.nio.ByteOrder; -import org.apache.commons.imaging.ImagingConstants; - public final class TiffConstants { public static final ByteOrder DEFAULT_TIFF_BYTE_ORDER = ByteOrder.LITTLE_ENDIAN; From 60bb733ef55e6f793780ec411be9324ab1213db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 15:47:41 +0100 Subject: [PATCH 084/179] added note that I changed the file to licence header --- .../commons/imaging/formats/tiff/constants/TiffConstants.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java index 76e3b35885..7468ecca92 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff.constants; From 342ddf56f192643597e4573289424ddb26a60091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 15:58:03 +0100 Subject: [PATCH 085/179] change types to native types were possible --- .../java/org/apache/commons/imaging/ImagingParametersJpeg.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index 7fcaf54121..d98e300a6b 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -26,7 +26,7 @@ */ public final class ImagingParametersJpeg extends ImagingParameters { - private Boolean readThumbnailsValue; // PARAM_KEY_READ_THUMBNAILS + private boolean readThumbnailsValue; // PARAM_KEY_READ_THUMBNAILS /** * This gives you a parameter object with default values. From ede24e3c4a96d536b37d61adf6f3df5b682abfb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 16:01:26 +0100 Subject: [PATCH 086/179] renamed method --- .../imaging/ImagingParametersTiff.java | 28 +++++++++++++++++++ .../imaging/formats/tiff/TiffImageParser.java | 2 ++ .../imaging/formats/tiff/TiffReader.java | 13 +++++---- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 31b4b7bf2c..8dc03702ff 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -32,6 +32,8 @@ public final class ImagingParametersTiff extends ImagingParameters { private TiffOutputSet outputSetForMetaData; // PARAM_KEY_EXIF + private boolean readThumbnailsValue; // PARAM_KEY_READ_THUMBNAILS + /** * This gives you a parameter object with default values. */ @@ -120,4 +122,30 @@ public void setOutputSet(final TiffOutputSet value) { checkIfValueIsNull(value); this.outputSetForMetaData = value; } + + //****** getReadThumbnails ****** + /** + * Parameter key. Indicates whether to read embedded thumbnails. + *

+ * Default value: don't read embedded thumbnails + * @return Valid values:{@code true} (causes it to read embedded thumbnails + * and {@code false} (don't read embedded thumbnails). + */ + public boolean getReadThumbnails() { + return this.readThumbnailsValue; + } + + /** + * Call this method to indicate to read embedded thumbnails. + */ + public void enableReadThumbnails() { + this.readThumbnailsValue = true; + } + + /** + * Call this method to indicate not to read embedded thumbnails. + */ + public void disableReadThumbnails() { + this.readThumbnailsValue = false; + } } diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java index 9224833baf..712a871905 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java index 3d8c348a4c..4a84faee3c 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; @@ -21,11 +23,10 @@ import java.nio.ByteOrder; import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.FormatCompliance; import org.apache.commons.imaging.ImageReadException; -import org.apache.commons.imaging.ImagingConstants; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.common.BinaryFileParser; import org.apache.commons.imaging.common.ByteConversions; import org.apache.commons.imaging.common.bytesource.ByteSource; @@ -309,7 +310,7 @@ public Collector() { this(null); } - public Collector(final Map params) { + public Collector(final ImagingParameters params) { boolean tmpReadThumbnails = true; if (params != null && params.containsKey(ImagingConstants.PARAM_KEY_READ_THUMBNAILS)) { tmpReadThumbnails = Boolean.TRUE.equals(params @@ -385,7 +386,7 @@ public boolean readImageData() { // } // } - public TiffContents readFirstDirectory(final ByteSource byteSource, final Map params, + public TiffContents readFirstDirectory(final ByteSource byteSource, final ImagingParameters params, final boolean readImageData, final FormatCompliance formatCompliance) throws ImageReadException, IOException { final Collector collector = new FirstDirectoryCollector(readImageData); @@ -411,7 +412,7 @@ public TiffContents readDirectories(final ByteSource byteSource, return contents; } - public TiffContents readContents(final ByteSource byteSource, final Map params, + public TiffContents readContents(final ByteSource byteSource, final ImagingParameters params, final FormatCompliance formatCompliance) throws ImageReadException, IOException { @@ -420,7 +421,7 @@ public TiffContents readContents(final ByteSource byteSource, final Map params, + public void read(final ByteSource byteSource, final ImagingParameters params, final FormatCompliance formatCompliance, final Listener listener) throws ImageReadException, IOException { // TiffContents contents = From 44d89fe47013cc92ecd449515ab8599925a04e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 16:02:15 +0100 Subject: [PATCH 087/179] Revert "renamed method" This reverts commit ede24e3c4a96d536b37d61adf6f3df5b682abfb5. --- .../imaging/ImagingParametersTiff.java | 28 ------------------- .../imaging/formats/tiff/TiffImageParser.java | 2 -- .../imaging/formats/tiff/TiffReader.java | 13 ++++----- 3 files changed, 6 insertions(+), 37 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 8dc03702ff..31b4b7bf2c 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -32,8 +32,6 @@ public final class ImagingParametersTiff extends ImagingParameters { private TiffOutputSet outputSetForMetaData; // PARAM_KEY_EXIF - private boolean readThumbnailsValue; // PARAM_KEY_READ_THUMBNAILS - /** * This gives you a parameter object with default values. */ @@ -122,30 +120,4 @@ public void setOutputSet(final TiffOutputSet value) { checkIfValueIsNull(value); this.outputSetForMetaData = value; } - - //****** getReadThumbnails ****** - /** - * Parameter key. Indicates whether to read embedded thumbnails. - *

- * Default value: don't read embedded thumbnails - * @return Valid values:{@code true} (causes it to read embedded thumbnails - * and {@code false} (don't read embedded thumbnails). - */ - public boolean getReadThumbnails() { - return this.readThumbnailsValue; - } - - /** - * Call this method to indicate to read embedded thumbnails. - */ - public void enableReadThumbnails() { - this.readThumbnailsValue = true; - } - - /** - * Call this method to indicate not to read embedded thumbnails. - */ - public void disableReadThumbnails() { - this.readThumbnailsValue = false; - } } diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java index 712a871905..9224833baf 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java index 4a84faee3c..3d8c348a4c 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; @@ -23,10 +21,11 @@ import java.nio.ByteOrder; import java.util.ArrayList; import java.util.List; +import java.util.Map; import org.apache.commons.imaging.FormatCompliance; import org.apache.commons.imaging.ImageReadException; -import org.apache.commons.imaging.ImagingParameters; +import org.apache.commons.imaging.ImagingConstants; import org.apache.commons.imaging.common.BinaryFileParser; import org.apache.commons.imaging.common.ByteConversions; import org.apache.commons.imaging.common.bytesource.ByteSource; @@ -310,7 +309,7 @@ public Collector() { this(null); } - public Collector(final ImagingParameters params) { + public Collector(final Map params) { boolean tmpReadThumbnails = true; if (params != null && params.containsKey(ImagingConstants.PARAM_KEY_READ_THUMBNAILS)) { tmpReadThumbnails = Boolean.TRUE.equals(params @@ -386,7 +385,7 @@ public boolean readImageData() { // } // } - public TiffContents readFirstDirectory(final ByteSource byteSource, final ImagingParameters params, + public TiffContents readFirstDirectory(final ByteSource byteSource, final Map params, final boolean readImageData, final FormatCompliance formatCompliance) throws ImageReadException, IOException { final Collector collector = new FirstDirectoryCollector(readImageData); @@ -412,7 +411,7 @@ public TiffContents readDirectories(final ByteSource byteSource, return contents; } - public TiffContents readContents(final ByteSource byteSource, final ImagingParameters params, + public TiffContents readContents(final ByteSource byteSource, final Map params, final FormatCompliance formatCompliance) throws ImageReadException, IOException { @@ -421,7 +420,7 @@ public TiffContents readContents(final ByteSource byteSource, final ImagingParam return collector.getContents(); } - public void read(final ByteSource byteSource, final ImagingParameters params, + public void read(final ByteSource byteSource, final Map params, final FormatCompliance formatCompliance, final Listener listener) throws ImageReadException, IOException { // TiffContents contents = From 3f30ef9952814fc884e811ff463266a753fcb278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 16:02:47 +0100 Subject: [PATCH 088/179] renamed method --- .../org/apache/commons/imaging/ImagingParametersJpeg.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index d98e300a6b..7bc911d35d 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -35,7 +35,7 @@ public ImagingParametersJpeg() { this.readThumbnailsValue = false; } - //****** readThumbnails ****** + //****** getReadThumbnails ****** /** * Parameter key. Indicates whether to read embedded thumbnails. *

@@ -45,12 +45,12 @@ public ImagingParametersJpeg() { * @return Valid values:{@code true} (causes it to read embedded thumbnails * and {@code false} (don't read embedded thumbnails). */ - public boolean readThumbnails() { + public boolean getReadThumbnails() { return this.readThumbnailsValue; } /** - * Parameter key. Indicates to read embedded thumbnails. + * Call this method to indicate to read embedded thumbnails. *

* Only applies to read EXIF metadata from JPEG/JFIF files. */ @@ -59,7 +59,7 @@ public void enableReadThumbnails() { } /** - * Parameter key. Indicates not to read embedded thumbnails. + * Call this method to indicate not to read embedded thumbnails. *

* Only applies to read EXIF metadata from JPEG/JFIF files. */ From 9911252d49fc8547262c3456ddce0fc78e7a521c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 16:04:55 +0100 Subject: [PATCH 089/179] typo --- .../java/org/apache/commons/imaging/ImagingParametersJpeg.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index 7bc911d35d..1b2894be97 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -35,7 +35,8 @@ public ImagingParametersJpeg() { this.readThumbnailsValue = false; } - //****** getReadThumbnails ****** + //****** readThumbnails ****** + /** * Parameter key. Indicates whether to read embedded thumbnails. *

From 92607ad0346d149e21355163a647d96eb5518f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 16:05:03 +0100 Subject: [PATCH 090/179] added readThumbnails --- .../imaging/ImagingParametersTiff.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 31b4b7bf2c..8ade1371e3 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -32,6 +32,8 @@ public final class ImagingParametersTiff extends ImagingParameters { private TiffOutputSet outputSetForMetaData; // PARAM_KEY_EXIF + private boolean readThumbnailsValue; // PARAM_KEY_READ_THUMBNAILS + /** * This gives you a parameter object with default values. */ @@ -120,4 +122,30 @@ public void setOutputSet(final TiffOutputSet value) { checkIfValueIsNull(value); this.outputSetForMetaData = value; } + + //****** readThumbnails ****** + + /** + * Parameter key. Indicates whether to read embedded thumbnails. + * Default value: don't read embedded thumbnails + * @return Valid values:{@code true} (causes it to read embedded thumbnails + * and {@code false} (don't read embedded thumbnails). + */ + public boolean getReadThumbnails() { + return this.readThumbnailsValue; + } + + /** + * Call this method to indicate to read embedded thumbnails. + */ + public void enableReadThumbnails() { + this.readThumbnailsValue = true; + } + + /** + * Call this method to indicate not to read embedded thumbnails. + */ + public void disableReadThumbnails() { + this.readThumbnailsValue = false; + } } From 215afc8a86b7bd41234915400bc565c38782ec48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 16:11:50 +0100 Subject: [PATCH 091/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/tiff/TiffReader.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java index 3d8c348a4c..3e97838f3f 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; @@ -21,11 +23,11 @@ import java.nio.ByteOrder; import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.FormatCompliance; import org.apache.commons.imaging.ImageReadException; -import org.apache.commons.imaging.ImagingConstants; +import org.apache.commons.imaging.ImagingParameters; +import org.apache.commons.imaging.ImagingParametersTiff; import org.apache.commons.imaging.common.BinaryFileParser; import org.apache.commons.imaging.common.ByteConversions; import org.apache.commons.imaging.common.bytesource.ByteSource; @@ -309,11 +311,13 @@ public Collector() { this(null); } - public Collector(final Map params) { + public Collector(final ImagingParameters params) { boolean tmpReadThumbnails = true; - if (params != null && params.containsKey(ImagingConstants.PARAM_KEY_READ_THUMBNAILS)) { - tmpReadThumbnails = Boolean.TRUE.equals(params - .get(ImagingConstants.PARAM_KEY_READ_THUMBNAILS)); + if (params != null) { + if (params instanceof ImagingParametersTiff) { + final ImagingParametersTiff paramsTiff = (ImagingParametersTiff) params; + tmpReadThumbnails = paramsTiff.getReadThumbnails(); + } } this.readThumbnails = tmpReadThumbnails; } @@ -385,7 +389,7 @@ public boolean readImageData() { // } // } - public TiffContents readFirstDirectory(final ByteSource byteSource, final Map params, + public TiffContents readFirstDirectory(final ByteSource byteSource, final ImagingParameters params, final boolean readImageData, final FormatCompliance formatCompliance) throws ImageReadException, IOException { final Collector collector = new FirstDirectoryCollector(readImageData); @@ -411,7 +415,7 @@ public TiffContents readDirectories(final ByteSource byteSource, return contents; } - public TiffContents readContents(final ByteSource byteSource, final Map params, + public TiffContents readContents(final ByteSource byteSource, final ImagingParameters params, final FormatCompliance formatCompliance) throws ImageReadException, IOException { @@ -420,7 +424,7 @@ public TiffContents readContents(final ByteSource byteSource, final Map params, + public void read(final ByteSource byteSource, final ImagingParameters params, final FormatCompliance formatCompliance, final Listener listener) throws ImageReadException, IOException { // TiffContents contents = From a818a9400262712441579d4dee3049740c7e76a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 16:15:54 +0100 Subject: [PATCH 092/179] Replaced parameter Map by ImagingParameters --- .../commons/imaging/formats/tiff/TiffDirectory.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java index 34f37e723b..8b6d8a950a 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; @@ -22,9 +24,9 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.ImageReadException; +import org.apache.commons.imaging.ImagingParameters; import org.apache.commons.imaging.common.ByteConversions; import org.apache.commons.imaging.common.RationalNumber; import org.apache.commons.imaging.formats.tiff.constants.TiffConstants; @@ -144,11 +146,11 @@ public boolean hasTiffImageData() throws ImageReadException { public BufferedImage getTiffImage(final ByteOrder byteOrder) throws ImageReadException, IOException { - final Map params = null; + final ImagingParameters params = null; return getTiffImage(byteOrder, params); } - public BufferedImage getTiffImage(final ByteOrder byteOrder, final Map params) + public BufferedImage getTiffImage(final ByteOrder byteOrder, final ImagingParameters params) throws ImageReadException, IOException { if (null == tiffImageData) { return null; From ee1f1a33044fb006c334681b50a072784b40f530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 17:35:37 +0100 Subject: [PATCH 093/179] added compressionBlockSize --- .../imaging/ImagingParametersTiff.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 8ade1371e3..f9c58332a0 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -30,6 +30,8 @@ public final class ImagingParametersTiff extends ImagingParameters { private Integer compressionLevel; // PARAM_KEY_COMPRESSION + private Integer compressionBlockSize; // PARAM_KEY_LZW_COMPRESSION_BLOCK_SIZE + private TiffOutputSet outputSetForMetaData; // PARAM_KEY_EXIF private boolean readThumbnailsValue; // PARAM_KEY_READ_THUMBNAILS @@ -39,6 +41,7 @@ public final class ImagingParametersTiff extends ImagingParameters { */ public ImagingParametersTiff() { this.compressionLevel = null; + this.compressionBlockSize = null; this.outputSetForMetaData = null; } @@ -86,6 +89,50 @@ public void setCompressionLevel(final int value) { this.compressionLevel = value; } + //****** compressionBlockSize ****** + + /** + * Returns {@code true} if there is a value present, {@false} else. + * @return + */ + public boolean isCompressionBlockSizePresent() { + return this.compressionBlockSize == null; + } + + /** + * Parameter used in write operations to indicate desired compression + * block size. + *

+ * Currently only applies to writing TIFF image files. + *

+ * Default value: TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED + * @return Valid values: + * TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED, + * TiffConstants.TIFF_COMPRESSION_CCITT_1D, + * TiffConstants.TIFF_COMPRESSION_LZW, + * TiffConstants.TIFF_COMPRESSION_PACKBITS + */ + public int getCompressionBlockSize() { + Integer value = this.compressionBlockSize; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter used in write operations to indicate desired compression + * block size. + *

+ * Currently only applies to writing TIFF image files. + * @param value Valid values: + * TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED, + * TiffConstants.TIFF_COMPRESSION_CCITT_1D, + * TiffConstants.TIFF_COMPRESSION_LZW, + * TiffConstants.TIFF_COMPRESSION_PACKBITS + */ + public void setCompressionBlockSize(final int value) { + this.compressionBlockSize = value; + } + //****** tiffOutputSetForMetaData ****** /** From 331e3f2f1156ac512efc7be9574e6cece492755d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 17:55:16 +0100 Subject: [PATCH 094/179] added t4 and t6 options for Tiff --- .../imaging/ImagingParametersTiff.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index f9c58332a0..6e3e7f9bac 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -36,6 +36,10 @@ public final class ImagingParametersTiff extends ImagingParameters { private boolean readThumbnailsValue; // PARAM_KEY_READ_THUMBNAILS + private Integer t4options; // PARAM_KEY_T4_OPTIONS + + private Integer t6options; // PARAM_KEY_T6_OPTIONS + /** * This gives you a parameter object with default values. */ @@ -195,4 +199,68 @@ public void enableReadThumbnails() { public void disableReadThumbnails() { this.readThumbnailsValue = false; } + + //****** t4 options ****** + + /** + * Returns {@code true} if there is a value present, {@false} else. + * @return + */ + public boolean isT4OptionsPresent() { + return this.t4options == null; + } + + /** + * Parameter used in write operations to indicate desired t4 options. + *

+ * Currently only applies to writing TIFF image files. + * @return desired t4 options + */ + public int getT4Options() { + Integer value = this.t4options; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter used in write operations to indicate desired t4 options. + *

+ * Currently only applies to writing TIFF image files. + * @param value desired t4 options + */ + public void setT4Options(final int value) { + this.t4options = value; + } + + //****** t6 options ****** + + /** + * Returns {@code true} if there is a value present, {@false} else. + * @return + */ + public boolean isT6OptionsPresent() { + return this.t6options == null; + } + + /** + * Parameter used in write operations to indicate desired t6 options. + *

+ * Currently only applies to writing TIFF image files. + * @return desired t6 options + */ + public int getT6Options() { + Integer value = this.t6options; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter used in write operations to indicate desired t6 options. + *

+ * Currently only applies to writing TIFF image files. + * @param value desired t6 options + */ + public void setT6Options(final int value) { + this.t6options = value; + } } From 016fdfda90d17d43bf1b59e3419dcf9ce6b6f09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 18:05:24 +0100 Subject: [PATCH 095/179] improved readability of t4/t6 method names --- .../commons/imaging/ImagingParametersTiff.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 6e3e7f9bac..ee3cf46e39 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -206,7 +206,7 @@ public void disableReadThumbnails() { * Returns {@code true} if there is a value present, {@false} else. * @return */ - public boolean isT4OptionsPresent() { + public boolean isT4optionsPresent() { return this.t4options == null; } @@ -216,7 +216,7 @@ public boolean isT4OptionsPresent() { * Currently only applies to writing TIFF image files. * @return desired t4 options */ - public int getT4Options() { + public int getT4options() { Integer value = this.t4options; checkIfParameterIsPresent(value); return value; @@ -228,7 +228,7 @@ public int getT4Options() { * Currently only applies to writing TIFF image files. * @param value desired t4 options */ - public void setT4Options(final int value) { + public void setT4options(final int value) { this.t4options = value; } @@ -238,7 +238,7 @@ public void setT4Options(final int value) { * Returns {@code true} if there is a value present, {@false} else. * @return */ - public boolean isT6OptionsPresent() { + public boolean isT6optionsPresent() { return this.t6options == null; } @@ -248,7 +248,7 @@ public boolean isT6OptionsPresent() { * Currently only applies to writing TIFF image files. * @return desired t6 options */ - public int getT6Options() { + public int getT6options() { Integer value = this.t6options; checkIfParameterIsPresent(value); return value; @@ -260,7 +260,7 @@ public int getT6Options() { * Currently only applies to writing TIFF image files. * @param value desired t6 options */ - public void setT6Options(final int value) { + public void setT6options(final int value) { this.t6options = value; } } From 2c96cf5fbb0c9de4cb16117a08172eff6bd852bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 18:09:59 +0100 Subject: [PATCH 096/179] Replaced parameter Map by ImagingParameters --- .../tiff/write/TiffImageWriterBase.java | 119 +++++++++--------- 1 file changed, 58 insertions(+), 61 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java index b1a4c6a046..ded0c43a7b 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff.write; @@ -28,7 +30,8 @@ import java.util.Map; import org.apache.commons.imaging.ImageWriteException; -import org.apache.commons.imaging.ImagingConstants; +import org.apache.commons.imaging.ImagingParameters; +import org.apache.commons.imaging.ImagingParametersTiff; import org.apache.commons.imaging.PixelDensity; import org.apache.commons.imaging.common.BinaryOutputStream; import org.apache.commons.imaging.common.PackBits; @@ -243,74 +246,67 @@ protected TiffOutputSummary validateDirectories(final TiffOutputSet outputSet) // Debug.debug(); } - public void writeImage(final BufferedImage src, final OutputStream os, Map params) + public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) throws ImageWriteException, IOException { - // make copy of params; we'll clear keys as we consume them. - params = new HashMap(params); - - // clear format key. - if (params.containsKey(ImagingConstants.PARAM_KEY_FORMAT)) { - params.remove(ImagingConstants.PARAM_KEY_FORMAT); - } - - TiffOutputSet userExif = null; - if (params.containsKey(ImagingConstants.PARAM_KEY_EXIF)) { - userExif = (TiffOutputSet) params.remove(ImagingConstants.PARAM_KEY_EXIF); - } - + + // ensure that the parameter object is not null + final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; + + // get generic options String xmpXml = null; - if (params.containsKey(ImagingConstants.PARAM_KEY_XMP_XML)) { - xmpXml = (String) params.get(ImagingConstants.PARAM_KEY_XMP_XML); - params.remove(ImagingConstants.PARAM_KEY_XMP_XML); + if (parameters.isXmpXmlAsStringPresent()) { + xmpXml = parameters.getXmpXmlAsString(); } - PixelDensity pixelDensity = (PixelDensity) params - .remove(ImagingConstants.PARAM_KEY_PIXEL_DENSITY); - if (pixelDensity == null) { + PixelDensity pixelDensity; + if (parameters.isPixelDensityPresent()) { + pixelDensity = parameters.getPixelDensity(); + } + else { pixelDensity = PixelDensity.createFromPixelsPerInch(72, 72); } - - final int width = src.getWidth(); - final int height = src.getHeight(); - + + // get TIFF specific options + TiffOutputSet userExif = null; int compression = TIFF_COMPRESSION_LZW; // LZW is default int stripSizeInBits = 64000; // the default from legacy implementation - if (params.containsKey(ImagingConstants.PARAM_KEY_COMPRESSION)) { - final Object value = params.get(ImagingConstants.PARAM_KEY_COMPRESSION); - if (value != null) { - if (!(value instanceof Number)) { - throw new ImageWriteException( - "Invalid compression parameter, must be numeric: " - + value); - } - compression = ((Number) value).intValue(); + // t4 and t6 options are only used for some kinds of compression + // we try to get them in case they are set regardless of the kind of compression + // just because we get all other TIFF specific parameters here + // so we have everything in one place + Integer t4Parameter = null; + Integer t6Parameter = null; + + if (parameters instanceof ImagingParametersTiff) { + final ImagingParametersTiff parametersTiff = (ImagingParametersTiff) parameters; + + if (parametersTiff.isOutputSetPresent()) { + userExif = parametersTiff.getOutputSet(); } - params.remove(ImagingConstants.PARAM_KEY_COMPRESSION); - if (params.containsKey(PARAM_KEY_LZW_COMPRESSION_BLOCK_SIZE)) { - final Object bValue = - params.get(PARAM_KEY_LZW_COMPRESSION_BLOCK_SIZE); - if (!(bValue instanceof Number)) { - throw new ImageWriteException( - "Invalid compression block-size parameter: " + value); - } - final int stripSizeInBytes = ((Number) bValue).intValue(); - if (stripSizeInBytes < 8000) { - throw new ImageWriteException( - "Block size parameter " + stripSizeInBytes - + " is less than 8000 minimum"); + + if (parametersTiff.isCompressionLevelPresent()) { + compression = parametersTiff.getCompressionLevel(); + + if (parametersTiff.isCompressionBlockSizePresent()) { + final int stripSizeInBytes = parametersTiff.getCompressionBlockSize(); + if (stripSizeInBytes < 8000) { + throw new ImageWriteException( + "Block size parameter " + stripSizeInBytes + + " is less than 8000 minimum"); + } + stripSizeInBits = stripSizeInBytes*8; } - stripSizeInBits = stripSizeInBytes*8; - params.remove(PARAM_KEY_LZW_COMPRESSION_BLOCK_SIZE); + } + + if (parametersTiff.isT4optionsPresent()) { + t4Parameter = parametersTiff.getT4options(); + } + + if (parametersTiff.isT6optionsPresent()) { + t6Parameter = parametersTiff.getT6options(); } } - final HashMap rawParams = new HashMap(params); - params.remove(PARAM_KEY_T4_OPTIONS); - params.remove(PARAM_KEY_T6_OPTIONS); - if (!params.isEmpty()) { - final Object firstKey = params.keySet().iterator().next(); - throw new ImageWriteException("Unknown parameter: " + firstKey); - } - + int samplesPerPixel; int bitsPerSample; int photometricInterpretation; @@ -325,6 +321,9 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map Date: Sun, 8 Feb 2015 18:55:51 +0100 Subject: [PATCH 097/179] added subimage x, y, width and height --- .../imaging/ImagingParametersTiff.java | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index ee3cf46e39..32bb8ce4fa 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -40,6 +40,15 @@ public final class ImagingParametersTiff extends ImagingParameters { private Integer t6options; // PARAM_KEY_T6_OPTIONS + private Integer subImageX; // PARAM_KEY_SUBIMAGE_X + + private Integer subImageY; // PARAM_KEY_SUBIMAGE_Y + + private Integer subImageWidth; // PARAM_KEY_SUBIMAGE_WIDTH + + private Integer subImageHeight; // PARAM_KEY_SUBIMAGE_HEIGHT + + /** * This gives you a parameter object with default values. */ @@ -263,4 +272,132 @@ public int getT6options() { public void setT6options(final int value) { this.t6options = value; } + + //****** subImageX ****** + + /** + * Returns {@code true} if there is a value present, {@false} else. + * @return + */ + public boolean isSubImageX_Present() { + return this.subImageX == null; + } + + /** + * Parameter used in read operations to indicate the X coordinate of the sub-image. + *

+ * Currently only applies to read TIFF image files. + * @return the x coordinate of the sub-image + */ + public int getSubImageX() { + Integer value = this.subImageX; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter used in read operations to indicate the X coordinate of the sub-image. + *

+ * Currently only applies to read TIFF image files. + * @param value the x coordinate of the sub-image + */ + public void setSubImageX(final int value) { + this.subImageX = value; + } + + //****** subImageY ****** + + /** + * Returns {@code true} if there is a value present, {@false} else. + * @return + */ + public boolean isSubImageY_Present() { + return this.subImageY == null; + } + + /** + * Parameter used in read operations to indicate the Y coordinate of the sub-image. + *

+ * Currently only applies to read TIFF image files. + * @return the y coordinate of the sub-image + */ + public int getSubImageY() { + Integer value = this.subImageY; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter used in read operations to indicate the Y coordinate of the sub-image. + *

+ * Currently only applies to read TIFF image files. + * @param value the y coordinate of the sub-image + */ + public void setSubImageY(final int value) { + this.subImageY = value; + } + + //****** subImageWidth ****** + + /** + * Returns {@code true} if there is a value present, {@false} else. + * @return + */ + public boolean isSubImageWidth_Present() { + return this.subImageWidth == null; + } + + /** + * Parameter used in read operations to indicate the width of the sub-image. + *

+ * Currently only applies to read TIFF image files. + * @return the width of the sub-image + */ + public int getSubImageWidth() { + Integer value = this.subImageWidth; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter used in read operations to indicate the width of the sub-image. + *

+ * Currently only applies to read TIFF image files. + * @param value the width of the sub-image + */ + public void setSubImageWidth(final int value) { + this.subImageWidth = value; + } + + //****** subImageHeight ****** + + /** + * Returns {@code true} if there is a value present, {@false} else. + * @return + */ + public boolean isSubImageHeight_Present() { + return this.subImageHeight == null; + } + + /** + * Parameter used in read operations to indicate the height of the sub-image. + *

+ * Currently only applies to read TIFF image files. + * @return the height of the sub-image + */ + public int getSubImageHeight() { + Integer value = this.subImageHeight; + checkIfParameterIsPresent(value); + return value; + } + + /** + * Parameter used in read operations to indicate the height of the sub-image. + *

+ * Currently only applies to read TIFF image files. + * @param value the height of the sub-image + */ + public void setSubImageHeight(final int value) { + this.subImageHeight = value; + } } From 52a0c2b555cea041afd906c8f6e69eaaa89a4940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sun, 8 Feb 2015 19:15:44 +0100 Subject: [PATCH 098/179] Replaced parameter Map by ImagingParameters --- .../imaging/formats/tiff/TiffImageParser.java | 93 ++++++++++--------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java index 9224833baf..cf5bfa19eb 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; @@ -26,7 +28,6 @@ import java.nio.ByteOrder; import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.FormatCompliance; import org.apache.commons.imaging.ImageFormat; @@ -35,11 +36,12 @@ import org.apache.commons.imaging.ImageParser; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.ImageWriteException; +import org.apache.commons.imaging.ImagingParameters; +import org.apache.commons.imaging.ImagingParametersTiff; import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.common.ImageBuilder; import org.apache.commons.imaging.common.bytesource.ByteSource; import org.apache.commons.imaging.formats.tiff.TiffDirectory.ImageDataElement; -import org.apache.commons.imaging.formats.tiff.constants.TiffConstants; import org.apache.commons.imaging.formats.tiff.constants.TiffEpTagConstants; import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants; import org.apache.commons.imaging.formats.tiff.datareaders.DataReader; @@ -81,7 +83,7 @@ protected ImageFormat[] getAcceptedTypes() { } @Override - public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final FormatCompliance formatCompliance = FormatCompliance.getDefault(); final TiffContents contents = new TiffReader(isStrict(params)) @@ -93,7 +95,7 @@ public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params) + public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final FormatCompliance formatCompliance = FormatCompliance.getDefault(); final TiffContents contents = new TiffReader(isStrict(params)) @@ -116,7 +118,7 @@ public Dimension getImageSize(final ByteSource byteSource, final Map params) + public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final FormatCompliance formatCompliance = FormatCompliance.getDefault(); final TiffReader tiffReader = new TiffReader(isStrict(params)); @@ -144,7 +146,7 @@ public ImageMetadata getMetadata(final ByteSource byteSource, final Map params) + public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final FormatCompliance formatCompliance = FormatCompliance.getDefault(); final TiffContents contents = new TiffReader(isStrict(params)) @@ -303,7 +305,7 @@ public ImageInfo getImageInfo(final ByteSource byteSource, final Map params) + public String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final FormatCompliance formatCompliance = FormatCompliance.getDefault(); final TiffContents contents = new TiffReader(isStrict(params)) @@ -346,7 +348,7 @@ public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource) { final FormatCompliance formatCompliance = FormatCompliance .getDefault(); - final Map params = null; + final ImagingParameters params = null; final TiffContents contents = new TiffReader(true).readContents( byteSource, params, formatCompliance); @@ -391,13 +393,13 @@ public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource) public FormatCompliance getFormatCompliance(final ByteSource byteSource) throws ImageReadException, IOException { final FormatCompliance formatCompliance = FormatCompliance.getDefault(); - final Map params = null; + final ImagingParameters params = null; new TiffReader(isStrict(params)).readContents(byteSource, params, formatCompliance); return formatCompliance; } - public List collectRawImageData(final ByteSource byteSource, final Map params) + public List collectRawImageData(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { final FormatCompliance formatCompliance = FormatCompliance.getDefault(); final TiffContents contents = new TiffReader(isStrict(params)) @@ -431,7 +433,7 @@ public List collectRawImageData(final ByteSource byteSource, final Map

-     *   HashMap params = new HashMap();
+     *   Hashfinal ImagingParameters params = new HashMap();
      *   params.put(TiffConstants.PARAM_KEY_SUBIMAGE_X, new Integer(x));
      *   params.put(TiffConstants.PARAM_KEY_SUBIMAGE_Y, new Integer(y));
      *   params.put(TiffConstants.PARAM_KEY_SUBIMAGE_WIDTH, new Integer(width));
@@ -452,7 +454,7 @@ public List collectRawImageData(final ByteSource byteSource, final Map params)
+    public BufferedImage getBufferedImage(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         final FormatCompliance formatCompliance = FormatCompliance.getDefault();
         final TiffReader reader = new TiffReader(isStrict(params));
@@ -485,40 +487,45 @@ public List getAllBufferedImages(final ByteSource byteSource)
         }
         return results;
     }
-
-    private Integer getIntegerParameter(
-            final String key, final Mapparams)
-            throws ImageReadException
-    {
-        if (params == null) {
-            return null;
-        }
-
-        if (!params.containsKey(key)) {
-            return null;
-        }
-
-        final Object obj = params.get(key);
-
-        if (obj instanceof Integer) {
-            return (Integer) obj;
-        }
-        throw new ImageReadException("Non-Integer parameter " + key);
-    }
     
-    private Rectangle checkForSubImage(
-            final Map params)
-            throws ImageReadException
-    {
-        Integer ix0 = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_X, params);
-        Integer iy0 = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_Y, params);
-        Integer iwidth = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_WIDTH, params);
-        Integer iheight = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_HEIGHT, params);
+    private Rectangle checkForSubImage(final ImagingParameters params) throws ImageReadException {
+        Integer ix0 = null;
+        Integer iy0 = null;
+        Integer iwidth = null;
+        Integer iheight = null;
         
+        // we got parameters
+        if (params != null) {
+            // we got even TIFF specific parameters
+            if (params instanceof ImagingParametersTiff) {
+                final ImagingParametersTiff parametersTiff = (ImagingParametersTiff) params;
+                
+                if (parametersTiff.isSubImageX_Present()) {
+                    ix0 = parametersTiff.getSubImageX();
+                }
+                
+                if (parametersTiff.isSubImageY_Present()) {
+                    iy0 = parametersTiff.getSubImageY();
+                }
+                
+                if (parametersTiff.isSubImageWidth_Present()) {
+                    iwidth = parametersTiff.getSubImageWidth();
+                }
+                
+                if (parametersTiff.isSubImageHeight_Present()) {
+                    iheight = parametersTiff.getSubImageHeight();
+                }
+            }
+        }
+        
+        // we either got no parameters, got parameters but these are not TIFF specific
+        // or if neither x, y, width nor height was set
         if (ix0 == null && iy0 == null && iwidth == null && iheight == null) {
             return null;
         }
-
+        
+        // if we got at lease one of theseparameters: x, y, width or height
+        // at least one of these is missing
         final StringBuilder sb = new StringBuilder(32);
         if (ix0 == null) {
             sb.append(" x0,");
@@ -541,7 +548,7 @@ private Rectangle checkForSubImage(
     }
     
     protected BufferedImage getBufferedImage(final TiffDirectory directory,
-            final ByteOrder byteOrder, final Map params) 
+            final ByteOrder byteOrder, final ImagingParameters params) 
             throws ImageReadException, IOException
     {
         final List entries = directory.entries;
@@ -729,7 +736,7 @@ private PhotometricInterpreter getPhotometricInterpreter(
     }
 
     @Override
-    public void writeImage(final BufferedImage src, final OutputStream os, final Map params)
+    public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params)
             throws ImageWriteException, IOException {
         new TiffImageWriterLossy().writeImage(src, os, params);
     }

From d8d628e4ecb4a5c6772d347b885c681dc52e8e90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Sun, 8 Feb 2015 19:16:55 +0100
Subject: [PATCH 099/179] removed value which was never used

---
 .../apache/commons/imaging/formats/tiff/TiffImageParser.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
index cf5bfa19eb..42e4c949ef 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
@@ -647,7 +647,7 @@ protected BufferedImage getBufferedImage(final TiffDirectory directory,
                 photometricInterpreter, bitsPerPixel, bitsPerSample, predictor,
                 samplesPerPixel, width, height, compression, byteOrder);
 
-        BufferedImage result = null;
+        BufferedImage result;
         if (subImage != null) {
             result = dataReader.readImageData(subImage);
         } else {

From 13a1684927cf62b1dce8660134c8de360a507c50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Sun, 8 Feb 2015 19:19:15 +0100
Subject: [PATCH 100/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/tiff/write/TiffImageWriterLossless.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
index 57a7ec21ee..99112804c4 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 package org.apache.commons.imaging.formats.tiff.write;
 
@@ -29,6 +31,7 @@
 import org.apache.commons.imaging.FormatCompliance;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.BinaryOutputStream;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.common.bytesource.ByteSourceArray;
@@ -70,7 +73,7 @@ private List analyzeOldTiff(final Map fro
             IOException {
         try {
             final ByteSource byteSource = new ByteSourceArray(exifBytes);
-            final Map params = null;
+            final ImagingParameters params = null;
             final FormatCompliance formatCompliance = FormatCompliance.getDefault();
             final TiffContents contents = new TiffReader(false).readContents(
                     byteSource, params, formatCompliance);

From ce0e2564bf2586d51fa7d8e1670722efd9acd8d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Wed, 11 Feb 2015 20:23:07 +0100
Subject: [PATCH 101/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/wbmp/WbmpImageParser.java | 34 ++++++-------------
 1 file changed, 11 insertions(+), 23 deletions(-)

diff --git a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
index 8709e77a82..d101488923 100644
--- a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
@@ -11,6 +11,8 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *  under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.wbmp;
@@ -27,8 +29,6 @@
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.Properties;
 
 import org.apache.commons.imaging.ImageFormat;
@@ -37,11 +37,11 @@
 import org.apache.commons.imaging.ImageParser;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.util.IoUtils;
 
-import static org.apache.commons.imaging.ImagingConstants.*;
 import static org.apache.commons.imaging.common.BinaryFunctions.*;
 
 public class WbmpImageParser extends ImageParser {
@@ -70,13 +70,13 @@ protected ImageFormat[] getAcceptedTypes() {
     }
 
     @Override
-    public ImageMetadata getMetadata(final ByteSource byteSource, final Map params)
+    public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         return null;
     }
 
     @Override
-    public ImageInfo getImageInfo(final ByteSource byteSource, final Map params)
+    public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         final WbmpHeader wbmpHeader = readWbmpHeader(byteSource);
         return new ImageInfo("WBMP", 1, new ArrayList(),
@@ -88,14 +88,14 @@ public ImageInfo getImageInfo(final ByteSource byteSource, final Map params)
+    public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         final WbmpHeader wbmpHeader = readWbmpHeader(byteSource);
         return new Dimension(wbmpHeader.width, wbmpHeader.height);
     }
 
     @Override
-    public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params)
+    public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         return null;
     }
@@ -216,7 +216,7 @@ private BufferedImage readImage(final WbmpHeader wbmpHeader, final InputStream i
 
     @Override
     public final BufferedImage getBufferedImage(final ByteSource byteSource,
-            final Map params) throws ImageReadException, IOException {
+            final ImagingParameters params) throws ImageReadException, IOException {
         InputStream is = null;
         boolean canThrow = false;
         try {
@@ -231,21 +231,9 @@ public final BufferedImage getBufferedImage(final ByteSource byteSource,
     }
 
     @Override
-    public void writeImage(final BufferedImage src, final OutputStream os, Map params)
+    public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params)
             throws ImageWriteException, IOException {
-        // make copy of params; we'll clear keys as we consume them.
-        params = (params == null) ? new HashMap() : new HashMap(params);
-
-        // clear format key.
-        if (params.containsKey(PARAM_KEY_FORMAT)) {
-            params.remove(PARAM_KEY_FORMAT);
-        }
-
-        if (!params.isEmpty()) {
-            final Object firstKey = params.keySet().iterator().next();
-            throw new ImageWriteException("Unknown parameter: " + firstKey);
-        }
-
+        
         writeMultiByteInteger(os, 0); // typeField
         os.write(0); // fixHeaderField
         writeMultiByteInteger(os, src.getWidth());
@@ -287,7 +275,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map params)
+    public String getXmpXml(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         return null;
     }

From bf29c05d03d878f4fc4eb6e77d0d7a6e9cdf68b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Wed, 11 Feb 2015 20:26:24 +0100
Subject: [PATCH 102/179] added missing @throws tags to javadoc

---
 .../apache/commons/imaging/formats/wbmp/WbmpImageParser.java    | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
index d101488923..6479e5ce83 100644
--- a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
@@ -273,6 +273,8 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima
      * @param params
      *            Map of optional parameters, defined in ImagingConstants.
      * @return Xmp Xml as String, if present. Otherwise, returns null.
+     * @throws org.apache.commons.imaging.ImageReadException
+     * @throws java.io.IOException
      */
     @Override
     public String getXmpXml(final ByteSource byteSource, final ImagingParameters params)

From 2b6c1a29bed8c2b49ce9e29a4855c460dbea7c0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Wed, 11 Feb 2015 20:28:20 +0100
Subject: [PATCH 103/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/xbm/XbmImageParser.java   | 30 +++++++------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
index 39a7229d66..785f05e33b 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
@@ -11,6 +11,8 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *  under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.xbm;
@@ -42,12 +44,12 @@
 import org.apache.commons.imaging.ImageParser;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.BasicCParser;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.util.IoUtils;
 
-import static org.apache.commons.imaging.ImagingConstants.*;
 
 public class XbmImageParser extends ImageParser {
     private static final String DEFAULT_EXTENSION = ".xbm";
@@ -75,13 +77,13 @@ protected ImageFormat[] getAcceptedTypes() {
     }
 
     @Override
-    public ImageMetadata getMetadata(final ByteSource byteSource, final Map params)
+    public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         return null;
     }
 
     @Override
-    public ImageInfo getImageInfo(final ByteSource byteSource, final Map params)
+    public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         final XbmHeader xbmHeader = readXbmHeader(byteSource);
         return new ImageInfo("XBM", 1, new ArrayList(),
@@ -92,14 +94,14 @@ public ImageInfo getImageInfo(final ByteSource byteSource, final Map params)
+    public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         final XbmHeader xbmHeader = readXbmHeader(byteSource);
         return new Dimension(xbmHeader.width, xbmHeader.height);
     }
 
     @Override
-    public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params)
+    public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         return null;
     }
@@ -292,7 +294,7 @@ public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource)
 
     @Override
     public final BufferedImage getBufferedImage(final ByteSource byteSource,
-            final Map params) throws ImageReadException, IOException {
+            final ImagingParameters params) throws ImageReadException, IOException {
         final XbmParseResult result = parseXbmHeader(byteSource);
         return readXbmImage(result.xbmHeader, result.cParser);
     }
@@ -323,20 +325,8 @@ private String toPrettyHex(final int value) {
     }
 
     @Override
-    public void writeImage(final BufferedImage src, final OutputStream os, Map params)
+    public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params)
             throws ImageWriteException, IOException {
-        // make copy of params; we'll clear keys as we consume them.
-        params = (params == null) ? new HashMap() : new HashMap(params);
-
-        // clear format key.
-        if (params.containsKey(PARAM_KEY_FORMAT)) {
-            params.remove(PARAM_KEY_FORMAT);
-        }
-
-        if (!params.isEmpty()) {
-            final Object firstKey = params.keySet().iterator().next();
-            throw new ImageWriteException("Unknown parameter: " + firstKey);
-        }
 
         final String name = randomName();
 
@@ -406,7 +396,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map params)
+    public String getXmpXml(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         return null;
     }

From ddac35013dc12c23901d85c136a8561a86392421 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Wed, 11 Feb 2015 20:28:39 +0100
Subject: [PATCH 104/179] added missing @throws tags to javadoc

---
 .../org/apache/commons/imaging/formats/xbm/XbmImageParser.java  | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
index 785f05e33b..2617a2eed0 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
@@ -394,6 +394,8 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima
      * @param params
      *            Map of optional parameters, defined in ImagingConstants.
      * @return Xmp Xml as String, if present. Otherwise, returns null.
+     * @throws org.apache.commons.imaging.ImageReadException
+     * @throws java.io.IOException
      */
     @Override
     public String getXmpXml(final ByteSource byteSource, final ImagingParameters params)

From 1aa72c4017cf3c24f9a668549f10a489203d2c0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Wed, 11 Feb 2015 20:29:45 +0100
Subject: [PATCH 105/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/xpm/XpmImageParser.java   | 30 +++++++------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
index 820167134a..9ba033bcfd 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
@@ -11,6 +11,8 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *  under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.xpm;
@@ -45,6 +47,7 @@
 import org.apache.commons.imaging.ImageParser;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.BasicCParser;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
@@ -52,7 +55,6 @@
 import org.apache.commons.imaging.palette.SimplePalette;
 import org.apache.commons.imaging.util.IoUtils;
 
-import static org.apache.commons.imaging.ImagingConstants.*;
 
 public class XpmImageParser extends ImageParser {
     private static final String DEFAULT_EXTENSION = ".xpm";
@@ -134,13 +136,13 @@ protected ImageFormat[] getAcceptedTypes() {
     }
 
     @Override
-    public ImageMetadata getMetadata(final ByteSource byteSource, final Map params)
+    public ImageMetadata getMetadata(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         return null;
     }
 
     @Override
-    public ImageInfo getImageInfo(final ByteSource byteSource, final Map params)
+    public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         final XpmHeader xpmHeader = readXpmHeader(byteSource);
         boolean transparent = false;
@@ -166,14 +168,14 @@ public ImageInfo getImageInfo(final ByteSource byteSource, final Map params)
+    public Dimension getImageSize(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         final XpmHeader xpmHeader = readXpmHeader(byteSource);
         return new Dimension(xpmHeader.width, xpmHeader.height);
     }
 
     @Override
-    public byte[] getICCProfileBytes(final ByteSource byteSource, final Map params)
+    public byte[] getICCProfileBytes(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         return null;
     }
@@ -605,7 +607,7 @@ public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource)
 
     @Override
     public final BufferedImage getBufferedImage(final ByteSource byteSource,
-            final Map params) throws ImageReadException, IOException {
+            final ImagingParameters params) throws ImageReadException, IOException {
         final XpmParseResult result = parseXpmHeader(byteSource);
         return readXpmImage(result.xpmHeader, result.cParser);
     }
@@ -651,20 +653,8 @@ private String toColor(final int color) {
     }
 
     @Override
-    public void writeImage(final BufferedImage src, final OutputStream os, Map params)
+    public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params)
             throws ImageWriteException, IOException {
-        // make copy of params; we'll clear keys as we consume them.
-        params = (params == null) ? new HashMap() : new HashMap(params);
-
-        // clear format key.
-        if (params.containsKey(PARAM_KEY_FORMAT)) {
-            params.remove(PARAM_KEY_FORMAT);
-        }
-
-        if (!params.isEmpty()) {
-            final Object firstKey = params.keySet().iterator().next();
-            throw new ImageWriteException("Unknown parameter: " + firstKey);
-        }
 
         final PaletteFactory paletteFactory = new PaletteFactory();
         boolean hasTransparency = false;
@@ -743,7 +733,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, Map params)
+    public String getXmpXml(final ByteSource byteSource, final ImagingParameters params)
             throws ImageReadException, IOException {
         return null;
     }

From 49b3b0acbecf5bd534e253e30723783b3b99b546 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Wed, 11 Feb 2015 20:30:05 +0100
Subject: [PATCH 106/179] added missing @throws tags to javadoc

---
 .../org/apache/commons/imaging/formats/xpm/XpmImageParser.java  | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
index 9ba033bcfd..39a618d883 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
@@ -731,6 +731,8 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima
      * @param params
      *            Map of optional parameters, defined in ImagingConstants.
      * @return Xmp Xml as String, if present. Otherwise, returns null.
+     * @throws org.apache.commons.imaging.ImageReadException
+     * @throws java.io.IOException
      */
     @Override
     public String getXmpXml(final ByteSource byteSource, final ImagingParameters params)

From 9352398ebda72b004526b17420840e24375f40af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Wed, 11 Feb 2015 20:39:56 +0100
Subject: [PATCH 107/179] corrected variable name

---
 .../org/apache/commons/imaging/ImagingParametersTiff.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java
index 32bb8ce4fa..829c18d70e 100644
--- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java
+++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java
@@ -34,7 +34,7 @@ public final class ImagingParametersTiff extends ImagingParameters {
 
     private TiffOutputSet outputSetForMetaData; // PARAM_KEY_EXIF
     
-    private boolean readThumbnailsValue; // PARAM_KEY_READ_THUMBNAILS
+    private boolean readThumbnails; // PARAM_KEY_READ_THUMBNAILS
     
     private Integer t4options; // PARAM_KEY_T4_OPTIONS
     
@@ -192,21 +192,21 @@ public void setOutputSet(final TiffOutputSet value) {
      * and {@code false} (don't read embedded thumbnails).
      */
     public boolean getReadThumbnails() {
-        return this.readThumbnailsValue;
+        return this.readThumbnails;
     }
     
     /**
      * Call this method to indicate to read embedded thumbnails.
      */
     public void enableReadThumbnails() {
-        this.readThumbnailsValue = true;
+        this.readThumbnails = true;
     }
     
     /**
      * Call this method to indicate not to read embedded thumbnails.
      */
     public void disableReadThumbnails() {
-        this.readThumbnailsValue = false;
+        this.readThumbnails = false;
     }
     
     //****** t4 options ******

From 1841900816af77722f66ac02c93ed143d91ac557 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Wed, 11 Feb 2015 20:56:04 +0100
Subject: [PATCH 108/179] Replaced parameter Map by
 ImagingParameters

---
 .../bytesource/ByteSourceImageTest.java       | 36 +++++++++++++++----
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
index eb7c2eeded..6570e1bcf0 100644
--- a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
+++ b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.common.bytesource;
@@ -29,15 +31,15 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageFormat;
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParameters;
+import org.apache.commons.imaging.ImagingParametersJpeg;
+import org.apache.commons.imaging.ImagingParametersTiff;
 import org.apache.commons.imaging.util.Debug;
 import org.apache.commons.io.FileUtils;
 import org.junit.Test;
@@ -169,12 +171,32 @@ public void checkGetICCProfileBytes(final File imageFile, final byte[] imageFile
     public void checkGetImageInfo(final File imageFile, final byte[] imageFileBytes)
             throws IOException, ImageReadException, IllegalAccessException,
             IllegalArgumentException, InvocationTargetException {
-        final Map params = new HashMap();
+        
+        final ImagingParameters params;
         final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
         final ImageFormat imageFormat = Imaging.guessFormat(imageFile);
-        if (imageFormat.equals(ImageFormats.TIFF)
-                || imageFormat.equals(ImageFormats.JPEG)) {
-            params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, new Boolean(!ignoreImageData));
+        if (imageFormat.equals(ImageFormats.TIFF)) {
+            final ImagingParametersTiff paramsTiff = new ImagingParametersTiff();
+            if (ignoreImageData == true) {
+                paramsTiff.disableReadThumbnails();
+            }
+            else {
+                paramsTiff.enableReadThumbnails();
+            }
+            params = paramsTiff;
+        }
+        else if (imageFormat.equals(ImageFormats.JPEG)) {
+            final ImagingParametersJpeg paramsJpeg = new ImagingParametersJpeg();
+            if (ignoreImageData == true) {
+                paramsJpeg.enableReadThumbnails();
+            }
+            else {
+                paramsJpeg.disableReadThumbnails();
+            }
+            params = paramsJpeg;
+        }
+        else {
+            params = new ImagingParameters();
         }
 
         final ImageInfo imageInfoFile = Imaging.getImageInfo(imageFile, params);

From 4eb2a80fab938c7268d15a9b160e336983ed07df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 20:41:04 +0100
Subject: [PATCH 109/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/examples/ApacheImagingSpeedAndMemoryTest.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/examples/ApacheImagingSpeedAndMemoryTest.java b/src/test/java/org/apache/commons/imaging/examples/ApacheImagingSpeedAndMemoryTest.java
index c1234fd0ff..80666b36bc 100644
--- a/src/test/java/org/apache/commons/imaging/examples/ApacheImagingSpeedAndMemoryTest.java
+++ b/src/test/java/org/apache/commons/imaging/examples/ApacheImagingSpeedAndMemoryTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 /****************************************************************
@@ -159,9 +161,9 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.Formatter;
-import java.util.HashMap;
 
 import org.apache.commons.imaging.ImageReadException;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
 import org.apache.commons.imaging.formats.tiff.TiffImageParser;
 
@@ -213,7 +215,7 @@ private void performTest(final String name) {
 
                 // ready the parser (you may modify this code block
                 // to use your parser of choice)
-                HashMap params = new HashMap();
+                ImagingParameters params = new ImagingParameters();
                 TiffImageParser tiffImageParser = new TiffImageParser();
 
                 // load the file and record time needed to do so

From 7ce092b2711bbdad870c8f8a55aa74732abaeb62 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 20:44:17 +0100
Subject: [PATCH 110/179] Replaced parameter Map by
 ImagingParameters

---
 .../commons/imaging/examples/ImageReadExample.java  | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/examples/ImageReadExample.java b/src/test/java/org/apache/commons/imaging/examples/ImageReadExample.java
index 37bb74d9df..232f03daeb 100644
--- a/src/test/java/org/apache/commons/imaging/examples/ImageReadExample.java
+++ b/src/test/java/org/apache/commons/imaging/examples/ImageReadExample.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 package org.apache.commons.imaging.examples;
 
@@ -20,24 +22,21 @@
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.BufferedImageFactory;
 
 public class ImageReadExample {
     public static BufferedImage imageReadExample(final File file)
             throws ImageReadException, IOException {
-        final Map params = new HashMap();
+        final ImagingParameters params = new ImagingParameters();
 
         // set optional parameters if you like
-        params.put(ImagingConstants.BUFFERED_IMAGE_FACTORY,
-                new ManagedImageBufferedImageFactory());
+        params.setBufferedImageFactory(new ManagedImageBufferedImageFactory());
 
-        // params.put(ImagingConstants.PARAM_KEY_VERBOSE, Boolean.TRUE);
+        // params.enableVerbose();
 
         // read image
         final BufferedImage image = Imaging.getBufferedImage(file, params);

From c42bcc9d9589ce94532d663fee75af1442619b39 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 20:46:16 +0100
Subject: [PATCH 111/179] Replaced parameter Map by
 ImagingParameters

---
 .../commons/imaging/examples/ImageWriteExample.java   | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/examples/ImageWriteExample.java b/src/test/java/org/apache/commons/imaging/examples/ImageWriteExample.java
index 0093983df5..b1dbf45c10 100644
--- a/src/test/java/org/apache/commons/imaging/examples/ImageWriteExample.java
+++ b/src/test/java/org/apache/commons/imaging/examples/ImageWriteExample.java
@@ -13,21 +13,21 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 package org.apache.commons.imaging.examples;
 
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageFormat;
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParametersTiff;
 import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
 
 public class ImageWriteExample {
@@ -37,11 +37,10 @@ public static byte[] imageWriteExample(final File file)
         final BufferedImage image = Imaging.getBufferedImage(file);
 
         final ImageFormat format = ImageFormats.TIFF;
-        final Map params = new HashMap();
+        final ImagingParametersTiff params = new ImagingParametersTiff();
 
         // set optional parameters if you like
-        params.put(ImagingConstants.PARAM_KEY_COMPRESSION, new Integer(
-                TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED));
+        params.setCompressionLevel(TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED);
 
         final byte[] bytes = Imaging.writeImageToBytes(image, format, params);
 

From 2904fbe873d12cbc175e2423bd5440a1d3059c3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 20:47:49 +0100
Subject: [PATCH 112/179] Replaced parameter Map by
 ImagingParameters

---
 .../org/apache/commons/imaging/examples/SampleUsage.java   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java b/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java
index 4bb0d20930..80dc35d413 100644
--- a/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java
+++ b/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 package org.apache.commons.imaging.examples;
 
@@ -22,14 +24,13 @@
 import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.apache.commons.imaging.FormatCompliance;
 import org.apache.commons.imaging.ImageFormat;
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.ImageMetadata;
 
 public class SampleUsage {
@@ -67,7 +68,7 @@ public SampleUsage() {
             final BufferedImage image = someImage;
             final File dst = someFile;
             final ImageFormat format = ImageFormats.PNG;
-            final Map optionalParams = new HashMap();
+            final ImagingParameters optionalParams = new ImagingParameters();
             Imaging.writeImage(image, dst, format, optionalParams);
 
             final OutputStream os = someOutputStream;

From d9f198c8d9676fea87afb2f37012c3c2e51ad472 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 20:49:42 +0100
Subject: [PATCH 113/179] Replaced parameter Map by
 ImagingParameters

---
 .../apache/commons/imaging/formats/bmp/BmpReadTest.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
index d17e3af254..c4e4c45139 100644
--- a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.bmp;
@@ -23,12 +25,11 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -50,7 +51,7 @@ public BmpReadTest(File imageFile) {
 
     @Test
     public void testImageInfo() throws ImageReadException, IOException {
-        final Map params = Collections.emptyMap();
+        final ImagingParameters params = new ImagingParameters();
         final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
         assertNotNull(imageInfo);
         // TODO assert more

From 37d7054a4aa560f1f8f7ea44e3eaf408fa3373ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 20:50:08 +0100
Subject: [PATCH 114/179] made field final

---
 .../org/apache/commons/imaging/formats/bmp/BmpReadTest.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
index c4e4c45139..4cf6900422 100644
--- a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
@@ -38,7 +38,7 @@
 @RunWith(Parameterized.class)
 public class BmpReadTest extends BmpBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection data() throws Exception {

From 223fbbfa68fa0f08e09c952f4e23cb739b9c11fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 20:51:52 +0100
Subject: [PATCH 115/179] Replaced parameter Map by
 ImagingParameters

---
 .../commons/imaging/formats/bmp/BmpRoundtripTest.java      | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpRoundtripTest.java b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpRoundtripTest.java
index 6921402c3d..e45f3cc753 100644
--- a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpRoundtripTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpRoundtripTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.bmp;
@@ -23,14 +25,13 @@
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.Random;
 
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.util.Debug;
 import org.apache.commons.io.FileUtils;
 import org.junit.Test;
@@ -140,7 +141,7 @@ private void writeAndReadImageData(final int[][] rawData) throws IOException,
             ImageReadException, ImageWriteException {
         final BufferedImage srcImage = imageDataToBufferedImage(rawData);
 
-        final Map writeParams = new HashMap();
+        final ImagingParameters writeParams = new ImagingParameters();
         // writeParams.put(ImagingConstants.PARAM_KEY_FORMAT,
         // ImageFormat.IMAGE_FORMAT_BMP);
         // writeParams.put(PngConstants.PARAM_KEY_BMP_FORCE_TRUE_COLOR,

From 7a5b3a93ab866eaaf6604dc8ed4c11b0dc27dc86 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 20:53:00 +0100
Subject: [PATCH 116/179] Replaced parameter Map by
 ImagingParameters

---
 .../org/apache/commons/imaging/formats/dcx/DcxReadTest.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java b/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
index bcddec686a..e5dd6aae76 100644
--- a/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.dcx;
@@ -25,6 +27,7 @@
 import java.util.Collections;
 
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -53,7 +56,7 @@ public void testImageMetadata() throws Exception {
     @Ignore(value = "RoundtripTest has to be fixed befor implementation can throw UnsupportedOperationException")
     @Test(expected = UnsupportedOperationException.class)
     public void testImageInfo() throws Exception {
-        Imaging.getImageInfo(imageFile, Collections. emptyMap());
+        Imaging.getImageInfo(imageFile, new ImagingParameters());
     }
 
     @Test

From dd3296984a8132c18731d954fe941470aaec2c7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 20:53:13 +0100
Subject: [PATCH 117/179] made field final

---
 .../org/apache/commons/imaging/formats/dcx/DcxReadTest.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java b/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
index e5dd6aae76..048100a1e6 100644
--- a/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
@@ -36,7 +36,7 @@
 @RunWith(Parameterized.class)
 public class DcxReadTest extends DcxBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection data() throws Exception {

From 183e7a07fecdffed6ef391bd2f0f73ee81702a68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 20:55:06 +0100
Subject: [PATCH 118/179] Replaced parameter Map by
 ImagingParameters

---
 .../commons/imaging/formats/icns/IcnsReadTest.java       | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java b/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
index 9c13dfd927..788cbd0cfd 100644
--- a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.icns;
@@ -22,13 +24,10 @@
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Assert;
@@ -59,7 +58,7 @@ public void testImageMetadata() throws Exception {
 
     @Test
     public void testImageInfo() throws Exception {
-        final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, Collections. emptyMap());
+        final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, new ImagingParameters());
         assertNotNull(imageInfo);
     }
 

From bc349a04e50a81f349ac4ee0c3028a7e737a1a7c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 20:56:28 +0100
Subject: [PATCH 119/179] Replaced parameter Map by
 ImagingParameters

---
 .../commons/imaging/formats/ico/IcoReadTest.java      | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java b/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
index 41e1ffb339..5ae014624a 100644
--- a/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.ico;
@@ -22,13 +24,10 @@
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Assert;
@@ -40,7 +39,7 @@
 @RunWith(Parameterized.class)
 public class IcoReadTest extends IcoBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection data() throws Exception {
@@ -60,7 +59,7 @@ public void testMetadata() throws Exception {
     @Ignore(value = "RoundtripTest has to be fixed befor implementation can throw UnsupportedOperationException")
     @Test(expected = UnsupportedOperationException.class)
     public void testImageInfo() throws Exception {
-        Imaging.getImageInfo(imageFile, Collections. emptyMap());
+        Imaging.getImageInfo(imageFile, new ImagingParameters());
     }
 
     @Test

From ffe3da4caa7a71456033f416a7e646b24f361319 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 20:59:41 +0100
Subject: [PATCH 120/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/jpeg/JpegReadTest.java     | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
index 314d7c3e6f..64b7e80bbc 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.jpeg;
@@ -23,13 +25,11 @@
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParametersJpeg;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Test;
@@ -39,7 +39,7 @@
 @RunWith(Parameterized.class)
 public class JpegReadTest extends JpegBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection data() throws Exception{
@@ -52,9 +52,15 @@ public JpegReadTest(File imageFile) {
 
     @Test
     public void test() throws Exception {
-        final Map params = new HashMap();
+        final ImagingParametersJpeg params = new ImagingParametersJpeg();
         final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-        params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, new Boolean(!ignoreImageData));
+        
+        if (ignoreImageData) {
+            params.disableReadThumbnails();
+        }
+        else {
+            params.enableReadThumbnails();
+        }
 
         final ImageMetadata metadata = Imaging.getMetadata(imageFile, params);
         // TODO only run this tests with images that have metadata...

From 3ac6708063dacc040c7757fa9e8342a7ec0222a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Thu, 12 Feb 2015 21:00:35 +0100
Subject: [PATCH 121/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/jpeg/JpegWithJpegThumbnailTest.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegWithJpegThumbnailTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegWithJpegThumbnailTest.java
index 8b87068081..72de8a0695 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegWithJpegThumbnailTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegWithJpegThumbnailTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.jpeg;
@@ -21,10 +23,9 @@
 
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.ImagingTest;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.junit.Test;
@@ -35,7 +36,7 @@ public class JpegWithJpegThumbnailTest extends ImagingTest {
     public void testSingleImage() throws Exception {
         final File imageFile = getTestImageByName("img_F028c_small.jpg");
 
-        final Map params = new HashMap();
+        final ImagingParameters params = new ImagingParameters();
         final ImageMetadata metadata = Imaging.getMetadata(imageFile, params);
         assertNotNull(metadata);
         final JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata;

From fa250a1f94a0e83653a3caf0738be7b3465f14f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 17:57:43 +0100
Subject: [PATCH 122/179] Replaced parameter Map by
 ImagingParameters

---
 .../commons/imaging/formats/jpeg/exif/AsciiFieldTest.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java
index e2c028a3d0..d26b0c530f 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.jpeg.exif;
@@ -27,6 +29,7 @@
 import java.util.Map;
 
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
 import org.apache.commons.imaging.formats.tiff.TiffField;
@@ -40,7 +43,7 @@ public class AsciiFieldTest extends ExifBaseTest {
     public void testSingleImage() throws Exception {
         final File imageFile = getTestImageByName("Canon Powershot SD750 - 2007.12.26.n.IMG_3704.JPG");
 
-        final Map params = new HashMap();
+        final ImagingParameters params = new ImagingParameters();
 
         final ImageMetadata metadata = Imaging.getMetadata(imageFile, params);
         assertNotNull(metadata);

From 24315f9484698fed888c35862c564fb9ca7ea30b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 17:58:06 +0100
Subject: [PATCH 123/179] Replaced parameter Map by
 ImagingParameters

---
 .../formats/jpeg/exif/ExifDumpTest.java        | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
index 1357a1c481..8d73830fb1 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.jpeg.exif;
@@ -21,12 +23,9 @@
 
 import java.io.File;
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParametersJpeg;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
 import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
@@ -60,10 +59,15 @@ public void testDumpJFIF() throws Exception {
 
     @Test
     public void testMetadata() throws Exception {
-        final Map params = new HashMap();
+        final ImagingParametersJpeg params = new ImagingParametersJpeg();
         final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-        params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, Boolean.valueOf(!ignoreImageData));
-
+        if (ignoreImageData) {
+            params.disableReadThumbnails();
+        }
+        else {
+            params.enableReadThumbnails();
+        }
+        
         final JpegImageMetadata metadata = (JpegImageMetadata) Imaging.getMetadata(imageFile, params);
         assertNotNull(metadata);
         // TODO assert more

From e33f8d2306ed2fbd72a0275edf660a85199586ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 17:58:36 +0100
Subject: [PATCH 124/179] made field final to get told if I broke something

---
 .../apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
index 8d73830fb1..0aaed0b797 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
@@ -38,7 +38,7 @@
 @RunWith(Parameterized.class)
 public class ExifDumpTest extends ExifBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection data() throws Exception {

From 8f86045b9542b551f65560d0877d985760ca20dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:00:08 +0100
Subject: [PATCH 125/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/jpeg/exif/GpsTest.java       | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
index e060c7f1a9..421d5eb7fa 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
@@ -13,18 +13,17 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.jpeg.exif;
 
 import java.io.File;
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParametersJpeg;
 import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
 import org.apache.commons.imaging.formats.tiff.TiffImageMetadata;
 import org.apache.commons.imaging.util.Debug;
@@ -53,9 +52,14 @@ public void test() throws Exception {
             return;
         }
 
-        final Map params = new HashMap();
+        final ImagingParametersJpeg params = new ImagingParametersJpeg();
         final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-        params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, Boolean.valueOf(!ignoreImageData));
+        if (ignoreImageData) {
+            params.disableReadThumbnails();
+        }
+        else {
+            params.enableReadThumbnails();
+        }
 
         final JpegImageMetadata metadata = (JpegImageMetadata) Imaging
                 .getMetadata(imageFile, params);

From f1dfdce5c440e852763e2155969cfac091946a0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:00:33 +0100
Subject: [PATCH 126/179] made field final to get told if I broke something

---
 .../org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
index 421d5eb7fa..207d33ac25 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
@@ -34,7 +34,7 @@
 @RunWith(Parameterized.class)
 public class GpsTest extends ExifBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection data() throws Exception {

From e67a7001ac459a1611c1ab0cba8154d14ea8044a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:08:45 +0100
Subject: [PATCH 127/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/jpeg/exif/MicrosoftTagTest.java | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
index 4c3dd7b0d4..2328777abe 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 package org.apache.commons.imaging.formats.jpeg.exif;
 
@@ -21,17 +23,14 @@
 import java.awt.image.BufferedImage;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.util.Map;
-import java.util.TreeMap;
 
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParametersTiff;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
 import org.apache.commons.imaging.formats.tiff.TiffImageMetadata;
 import org.apache.commons.imaging.formats.tiff.constants.MicrosoftTagConstants;
-import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
 import org.apache.commons.imaging.formats.tiff.write.TiffOutputDirectory;
 import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet;
 import org.junit.Test;
@@ -51,8 +50,10 @@ public void testWrite() throws Exception {
         exif.add(MicrosoftTagConstants.EXIF_TAG_XPCOMMENT, COMMENT);
         exif.add(MicrosoftTagConstants.EXIF_TAG_XPSUBJECT, SUBJECT);
         exif.add(MicrosoftTagConstants.EXIF_TAG_XPTITLE, TITLE);
-        final Map params = new TreeMap();
-        params.put(ImagingConstants.PARAM_KEY_EXIF, exifSet);
+        
+        final ImagingParametersTiff params = new ImagingParametersTiff();
+        params.setOutputSet(exifSet);
+        
         final byte[] bytes = Imaging.writeImageToBytes(image, ImageFormats.TIFF, params);
         checkFields(bytes);
     }

From 11e23ece8bebbb9b7a0f4fd400a3c41284a6b6e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:08:51 +0100
Subject: [PATCH 128/179] Replaced parameter Map by
 ImagingParameters

---
 .../formats/jpeg/exif/SpecificExifTagTest.java    | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
index 270e710cbe..b6a7a6b3be 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.jpeg.exif;
@@ -20,14 +22,12 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParametersJpeg;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
 import org.apache.commons.imaging.formats.tiff.TiffField;
@@ -66,9 +66,14 @@ private void checkImage(final File imageFile) throws IOException,
             ImageReadException, ImageWriteException {
         // Debug.debug("imageFile", imageFile.getAbsoluteFile());
 
-        final Map params = new HashMap();
+        final ImagingParametersJpeg params = new ImagingParametersJpeg();
         final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-        params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, Boolean.valueOf(!ignoreImageData));
+        if (ignoreImageData) {
+            params.disableReadThumbnails();
+        }
+        else {
+            params.enableReadThumbnails();
+        }
 
         // note that metadata might be null if no metadata is found.
         final ImageMetadata metadata = Imaging.getMetadata(imageFile, params);

From fdd1249319d66631b1c77aa4c890f7be71272101 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:09:03 +0100
Subject: [PATCH 129/179] made field final to get told if I broke something

---
 .../commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
index b6a7a6b3be..11ed4708d0 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
@@ -39,7 +39,7 @@
 @RunWith(Parameterized.class)
 public abstract class SpecificExifTagTest extends ExifBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection data() throws Exception {

From 43ee3f1abc978a7ae55f16b3e6dd6e5c5ec7dc0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:13:55 +0100
Subject: [PATCH 130/179] Replaced parameter Map by
 ImagingParameters

---
 .../formats/jpeg/iptc/IptcUpdateTest.java     | 43 +++++++++++++------
 1 file changed, 31 insertions(+), 12 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
index 639c88cf79..cb166529e9 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.jpeg.iptc;
@@ -27,14 +29,11 @@
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
-import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParametersJpeg;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
 import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
@@ -64,9 +63,14 @@ public IptcUpdateTest(File imageFile) {
     public void testRemove() throws Exception {
         final ByteSource byteSource = new ByteSourceFile(imageFile);
 
-        final Map params = new HashMap();
+        final ImagingParametersJpeg params = new ImagingParametersJpeg();
         final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-        params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, Boolean.valueOf(!ignoreImageData));
+        if (ignoreImageData) {
+            params.disableReadThumbnails();
+        }
+        else {
+            params.enableReadThumbnails();
+        }
 
         final JpegPhotoshopMetadata metadata = new JpegImageParser()
                 .getPhotoshopMetadata(byteSource, params);
@@ -97,9 +101,14 @@ public File removeIptc(ByteSource byteSource) throws Exception {
     public void testInsert() throws Exception {
         final ByteSource byteSource = new ByteSourceFile(imageFile);
 
-        final Map params = new HashMap();
+        final ImagingParametersJpeg params = new ImagingParametersJpeg();
         final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-        params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, Boolean.valueOf(!ignoreImageData));
+        if (ignoreImageData) {
+            params.disableReadThumbnails();
+        }
+        else {
+            params.enableReadThumbnails();
+        }
 
         final JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, params);
         assertNotNull(metadata);
@@ -142,9 +151,14 @@ public void testInsert() throws Exception {
     public void testUpdate() throws Exception {
         final ByteSource byteSource = new ByteSourceFile(imageFile);
 
-        final Map params = new HashMap();
+        final ImagingParametersJpeg params = new ImagingParametersJpeg();
         final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-        params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, Boolean.valueOf(!ignoreImageData));
+        if (ignoreImageData) {
+            params.disableReadThumbnails();
+        }
+        else {
+            params.enableReadThumbnails();
+        }
 
         final JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, params);
         assertNotNull(metadata);
@@ -189,9 +203,14 @@ public File writeIptc(ByteSource byteSource, PhotoshopApp13Data newData) throws
     public void testNoChangeUpdate() throws Exception {
         final ByteSource byteSource = new ByteSourceFile(imageFile);
 
-        final Map params = new HashMap();
+        final ImagingParametersJpeg params = new ImagingParametersJpeg();
         final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-        params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, Boolean.valueOf(!ignoreImageData));
+        if (ignoreImageData) {
+            params.disableReadThumbnails();
+        }
+        else {
+            params.enableReadThumbnails();
+        }
 
         final JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, params);
         assertNotNull(metadata);

From cffd5ecd26ed0aa84d69bd8c6f85ed20b309df02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:14:08 +0100
Subject: [PATCH 131/179] made field final to get told if I broke something

---
 .../commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
index cb166529e9..1db46bbf56 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
@@ -45,7 +45,7 @@
 
 @RunWith(Parameterized.class)
 public class IptcUpdateTest extends IptcBaseTest {
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection data() throws Exception {

From 55faed299cf8b887194aecff5c9bbe8173981b29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:15:31 +0100
Subject: [PATCH 132/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java       | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
index 306b460041..68fba6b9f8 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.jpeg.xmp;
@@ -26,8 +28,7 @@
 import java.io.FileOutputStream;
 import java.io.OutputStream;
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
+import org.apache.commons.imaging.ImagingParameters;
 
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
@@ -54,7 +55,7 @@ public JpegXmpRewriteTest(File imageFile) {
     @Test
     public void testRemoveInsertUpdate() throws Exception {
         final ByteSource byteSource = new ByteSourceFile(imageFile);
-        final Map params = new HashMap();
+        final ImagingParameters params = new ImagingParameters();
         final String xmpXml = new JpegImageParser().getXmpXml(byteSource, params);
         assertNotNull(xmpXml);
 

From 8ec13e8d1a5f3001e09e37b7d21190f2b7acfcea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:15:43 +0100
Subject: [PATCH 133/179] made field final to get told if I broke something

---
 .../commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
index 68fba6b9f8..69e7ec4ad3 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
@@ -41,7 +41,7 @@
 @RunWith(Parameterized.class)
 public class JpegXmpRewriteTest extends JpegXmpBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection data() throws Exception {

From 58a3155ba62f81fe706105569f557c7a44153dbb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:16:51 +0100
Subject: [PATCH 134/179] Replaced parameter Map by
 ImagingParameters

---
 .../commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
index 9395c56131..e96af3cece 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.jpeg.xmp;
@@ -21,8 +23,7 @@
 
 import java.io.File;
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
+import org.apache.commons.imaging.ImagingParameters;
 
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
@@ -48,7 +49,7 @@ public JpegXmpDumpTest(File imageFile) {
     @Test
     public void test() throws Exception {
         final ByteSource byteSource = new ByteSourceFile(imageFile);
-        final Map params = new HashMap();
+        final ImagingParameters params = new ImagingParameters();
         final String xmpXml = new JpegImageParser().getXmpXml(byteSource, params);
 
         // TODO assert more

From d90b702a41b49b9c7c84d17c256ab73f5705995b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:17:02 +0100
Subject: [PATCH 135/179] made field final to get told if I broke something

---
 .../commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
index e96af3cece..a59dc32b2b 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
@@ -35,7 +35,7 @@
 @RunWith(Parameterized.class)
 public class JpegXmpDumpTest extends JpegXmpBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection data() throws Exception {

From eb20439ee834ee71ba609ef2416331aa9e63f1a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:18:00 +0100
Subject: [PATCH 136/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/jpeg/iptc/IptcDumpTest.java   | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
index d886b51940..22f9ddd12d 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.jpeg.iptc;
@@ -21,12 +23,10 @@
 
 import java.io.File;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParametersJpeg;
 import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
 import org.apache.commons.imaging.formats.jpeg.JpegPhotoshopMetadata;
 import org.apache.commons.imaging.util.Debug;
@@ -50,9 +50,14 @@ public IptcDumpTest(File imageFile) {
 
     @Test
     public void test() throws Exception {
-        final Map params = new HashMap();
+        final ImagingParametersJpeg params = new ImagingParametersJpeg();
         final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-        params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, Boolean.valueOf(!ignoreImageData));
+        if (ignoreImageData) {
+            params.disableReadThumbnails();
+        }
+        else {
+            params.enableReadThumbnails();
+        }
 
         final JpegImageMetadata metadata = (JpegImageMetadata) Imaging.getMetadata(imageFile, params);
         assertNotNull(metadata);

From 15c16ae27cc9264a5012243ac8141b1111a9360c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:18:17 +0100
Subject: [PATCH 137/179] made field final to get told if I broke something

---
 .../apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
index 22f9ddd12d..13b89b962c 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
@@ -37,7 +37,7 @@
 @RunWith(Parameterized.class)
 public class IptcDumpTest extends IptcBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection data() throws Exception {

From be94d28d4689b7bc5e1e667f2b5ebe969f18e7e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:19:01 +0100
Subject: [PATCH 138/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/jpeg/iptc/IptcAddTest.java   | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
index 5b69aef103..a7ce7b3671 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.jpeg.iptc;
@@ -26,11 +28,8 @@
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParametersJpeg;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
 import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
@@ -62,9 +61,14 @@ public IptcAddTest(File imageFile) {
     public void testAddIptcData() throws Exception {
         final ByteSource byteSource = new ByteSourceFile(imageFile);
 
-        final Map params = new HashMap();
+        final ImagingParametersJpeg params = new ImagingParametersJpeg();
         final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-        params.put(ImagingConstants.PARAM_KEY_READ_THUMBNAILS, Boolean.valueOf(!ignoreImageData));
+        if (ignoreImageData) {
+            params.disableReadThumbnails();
+        }
+        else {
+            params.enableReadThumbnails();
+        }
 
         final JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, params);
         if (metadata == null) {

From d3f735d5af010d7ca72961c45562b1363cd2f32e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:19:11 +0100
Subject: [PATCH 139/179] made field final to get told if I broke something

---
 .../apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
index a7ce7b3671..feb7a053e0 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
@@ -42,7 +42,7 @@
 @RunWith(Parameterized.class)
 public class IptcAddTest extends IptcBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection data() throws Exception {

From 6ad55c8136c59d348a79b5d37d7a2de96c880407 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:30:39 +0100
Subject: [PATCH 140/179] Replaced parameter Map by
 ImagingParameters

---
 .../apache/commons/imaging/formats/pam/PamReadTest.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java b/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java
index 872afe6fb4..f74ea1dbb0 100644
--- a/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.pam;
@@ -21,12 +23,11 @@
 
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Assert;
@@ -47,7 +48,7 @@ public void test() throws Exception {
             final ImageMetadata metadata = Imaging.getMetadata(imageFile);
             Assert.assertFalse(metadata instanceof File); // Dummy check to avoid unused warning (it may be null)
 
-            final Map params = new HashMap();
+            final ImagingParameters params = new ImagingParameters();
             final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
             assertNotNull(imageInfo);
 

From bbb966b3f2cc7f1744b5e86ff675682d6c584c8e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:36:10 +0100
Subject: [PATCH 141/179] Replaced parameter Map by
 ImagingParameters

---
 .../apache/commons/imaging/formats/pcx/PcxReadTest.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java b/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java
index 6fc56dabc2..97b70eafb2 100644
--- a/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.pcx;
@@ -21,12 +23,11 @@
 
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Assert;
@@ -47,7 +48,7 @@ public void test() throws Exception {
             final ImageMetadata metadata = Imaging.getMetadata(imageFile);
             Assert.assertFalse(metadata instanceof File); // Dummy check to avoid unused warning (it may be null)
 
-            final Map params = new HashMap();
+            final ImagingParameters params = new ImagingParameters();
             final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
             assertNotNull(imageInfo);
 

From 9497a46b0a69ccc3c3a29ebf7a9a89f2f6157cde Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:38:12 +0100
Subject: [PATCH 142/179] Replaced parameter Map by
 ImagingParameters

---
 .../commons/imaging/formats/png/ConvertPngToGifTest.java | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java b/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java
index 18e84a90fd..b5226c34e2 100644
--- a/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.png;
@@ -21,12 +23,11 @@
 
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Test;
 
@@ -46,8 +47,8 @@ public void test() throws Exception {
             // Debug.debug();
             }
 
-            final Map params = new HashMap();
-            // params.put(ImagingConstants.PARAM_KEY_VERBOSE, Boolean.TRUE);
+            final ImagingParameters params = new ImagingParameters();
+            // params.enableVerbose();
 
             final BufferedImage image = Imaging.getBufferedImage(imageFile, params);
             assertNotNull(image);

From 9086d93e55613be8ce42ef4de9ef21f861c449e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:40:36 +0100
Subject: [PATCH 143/179] Replaced parameter Map by
 ImagingParameters

---
 .../formats/png/PngMultipleRoundtripTest.java | 21 +++++++++----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java b/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java
index 46541d10c7..514129ffbe 100644
--- a/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.png;
@@ -22,11 +24,10 @@
 
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.util.Debug;
 import org.apache.commons.io.FilenameUtils;
 import org.junit.Test;
@@ -55,20 +56,18 @@ public void test() throws Exception {
 
             File lastFile = imageFile;
             for (int j = 0; j < 10; j++) {
-                final Map readParams = new HashMap();
-                // readParams.put(ImagingConstants.BUFFERED_IMAGE_FACTORY,
-                // new RgbBufferedImageFactory());
-                final BufferedImage image = Imaging.getBufferedImage(lastFile,
-                        readParams);
+                final ImagingParameters readParams = new ImagingParameters();
+                // readParams.setBufferedImageFactory(new RgbBufferedImageFactory());
+                
+                final BufferedImage image = Imaging.getBufferedImage(lastFile, readParams);
                 assertNotNull(image);
 
                 final File tempFile = createTempFile(imageFile.getName() + "." + j
                         + ".", ".png");
                 Debug.debug("tempFile", tempFile);
-
-                final Map writeParams = new HashMap();
-                Imaging.writeImage(image, tempFile,
-                        ImageFormats.PNG, writeParams);
+                
+                final ImagingParameters writeParams = new ImagingParameters();
+                Imaging.writeImage(image, tempFile, ImageFormats.PNG, writeParams);
 
                 lastFile = tempFile;
             }

From eaeddf508747d494a466007cbdd05dac48cd1ded Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:43:53 +0100
Subject: [PATCH 144/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/png/PngTextTest.java      | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java b/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java
index 0c4e93208a..01b6c5c248 100644
--- a/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.png;
@@ -25,12 +27,11 @@
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParametersPng;
 import org.apache.commons.io.FileUtils;
 import org.junit.Test;
 
@@ -40,11 +41,10 @@ public class PngTextTest extends PngBaseTest {
     public void test() throws Exception {
         final int width = 1;
         final int height = 1;
-        final BufferedImage srcImage = new BufferedImage(width, height,
-                BufferedImage.TYPE_INT_ARGB);
+        final BufferedImage srcImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
         srcImage.setRGB(0, 0, Color.red.getRGB());
 
-        final Map writeParams = new HashMap();
+        final ImagingParametersPng writeParams = new ImagingParametersPng();
 
         final List writeTexts = new ArrayList();
         {
@@ -65,11 +65,10 @@ public void test() throws Exception {
             writeTexts.add(new PngText.Itxt(keyword, text, languageTag,
                     translatedKeyword));
         }
-
-        writeParams.put(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS, writeTexts);
-
-        final byte[] bytes = Imaging.writeImageToBytes(srcImage,
-                ImageFormats.PNG, writeParams);
+        
+        writeParams.setTextChunks(writeTexts);
+        
+        final byte[] bytes = Imaging.writeImageToBytes(srcImage, ImageFormats.PNG, writeParams);
 
         final File tempFile = createTempFile("temp", ".png");
         FileUtils.writeByteArrayToFile(tempFile, bytes);

From fc7bc8ebe4403030e54bb0362b19b162d00ed26f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:46:25 +0100
Subject: [PATCH 145/179] Replaced parameter Map by
 ImagingParameters

---
 .../png/PngWriteForceTrueColorText.java       | 20 +++++++++----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java
index fa1176c1a0..dbf6661b95 100644
--- a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java
+++ b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.png;
@@ -21,12 +23,12 @@
 
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
+import org.apache.commons.imaging.ImagingParametersPng;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Test;
 
@@ -49,21 +51,17 @@ public void test() throws Exception {
                 // params.put(ImagingConstants.PARAM_KEY_VERBOSE,
                 // Boolean.TRUE);
 
-                final BufferedImage image = Imaging.getBufferedImage(imageFile,
-                        new HashMap());
+                final BufferedImage image = Imaging.getBufferedImage(imageFile, new ImagingParameters());
                 assertNotNull(image);
 
                 final File outFile = createTempFile(imageFile.getName() + ".", ".gif");
                 // Debug.debug("outFile", outFile);
 
-                final Map params = new HashMap();
-                params.put(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR,
-                        Boolean.TRUE);
-                Imaging.writeImage(image, outFile,
-                        ImageFormats.PNG, params);
+                final ImagingParametersPng params = new ImagingParametersPng();
+                params.enableForceTrueColor();
+                Imaging.writeImage(image, outFile, ImageFormats.PNG, params);
 
-                final BufferedImage image2 = Imaging.getBufferedImage(outFile,
-                        new HashMap());
+                final BufferedImage image2 = Imaging.getBufferedImage(outFile, new ImagingParameters());
                 assertNotNull(image2);
             } catch (final Exception e) {
                 Debug.debug("imageFile", imageFile);

From 34e69d05a6a164daf79928d991e4bfeb9770af9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:51:30 +0100
Subject: [PATCH 146/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/png/PngWriteReadTest.java       | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java
index aed494ae2f..d80f6f19f2 100644
--- a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.png;
@@ -24,14 +26,13 @@
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.Random;
 
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParametersPng;
 import org.apache.commons.imaging.ImagingTest;
 import org.apache.commons.io.FileUtils;
 import org.junit.Test;
@@ -137,11 +138,9 @@ private void writeAndReadImageData(final int[][] rawData) throws IOException,
             ImageReadException, ImageWriteException {
         final BufferedImage srcImage = imageDataToBufferedImage(rawData);
 
-        final Map writeParams = new HashMap();
-        // writeParams.put(ImagingConstants.PARAM_KEY_FORMAT,
-        // ImageFormat.IMAGE_FORMAT_PNG);
-        // writeParams.put(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR,
-        // Boolean.TRUE);
+        final ImagingParametersPng writeParams = new ImagingParametersPng();
+        // writeParams.setImageFormat(ImageFormats.PNG);
+        // writeParams.enableForceTrueColor();
 
         final byte[] bytes = Imaging.writeImageToBytes(srcImage,
                 ImageFormats.PNG, writeParams);

From 4d6ee12831c6ecaabf89922e881290cfab3cd3e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:52:21 +0100
Subject: [PATCH 147/179] Replaced parameter Map by
 ImagingParameters

---
 .../org/apache/commons/imaging/formats/psd/PsdReadTest.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java b/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java
index a1a0851926..b437481d38 100644
--- a/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 package org.apache.commons.imaging.formats.psd;
 
@@ -26,6 +28,7 @@
 
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Assert;
@@ -45,7 +48,7 @@ public void test() throws Exception {
             final ImageMetadata metadata = Imaging.getMetadata(imageFile);
             Assert.assertFalse(metadata instanceof File); // Dummy check to avoid unused warning (it may be null)
 
-            final Map params = new HashMap();
+            final ImagingParameters params = new ImagingParameters();
             final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
             assertNotNull(imageInfo);
 

From 94402c499021a677564340b339046929c5a9705d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 18:55:55 +0100
Subject: [PATCH 148/179] Replaced parameter Map by
 ImagingParameters

---
 .../apache/commons/imaging/formats/tiff/TiffLzwTest.java   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java
index bd87bb382d..ebc77ef5c9 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.tiff;
@@ -25,11 +27,11 @@
 import java.io.InputStream;
 import java.nio.ByteOrder;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
 import org.apache.commons.imaging.common.mylzw.MyLzwCompressor;
@@ -69,8 +71,7 @@ public void testTiffImageData() throws IOException, ImageReadException,
             Debug.debug("imageFile", image);
 
             ByteSource byteSource = new ByteSourceFile(image);
-            List data = new TiffImageParser().collectRawImageData(byteSource,
-                    Collections.emptyMap());
+            List data = new TiffImageParser().collectRawImageData(byteSource, new ImagingParameters());
 
             for (byte[] bytes : data) {
                 decompressRoundtripAndValidate(bytes);

From 59cf8805fee0f4e0cfb317de66d02493309b31a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 19:04:49 +0100
Subject: [PATCH 149/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/tiff/TiffCcittTest.java   | 49 ++++++++++---------
 .../formats/tiff/TiffReadWriteTagsTest.java   |  5 +-
 .../formats/tiff/TiffRoundtripTest.java       | 12 +++--
 .../formats/tiff/TiffSubImageTest.java        | 16 +++---
 4 files changed, 44 insertions(+), 38 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java
index 7eaa3bcbfc..bcbe2c0718 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.tiff;
@@ -22,13 +24,12 @@
 
 import java.awt.image.BufferedImage;
 import java.io.IOException;
-import java.util.HashMap;
 
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParametersTiff;
 import org.apache.commons.imaging.common.itu_t4.T4AndT6Compression;
 import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
 import org.apache.commons.imaging.util.Debug;
@@ -178,9 +179,9 @@ public void testAll5x2Images() {
             }
 
             try {
-                final HashMap params = new HashMap();
-                params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
-                        TiffConstants.TIFF_COMPRESSION_CCITT_1D);
+                final ImagingParametersTiff params = new ImagingParametersTiff();
+                params.setCompressionLevel(TiffConstants.TIFF_COMPRESSION_CCITT_1D);
+                
                 final byte[] compressed = Imaging.writeImageToBytes(image,
                         ImageFormats.TIFF, params);
                 final BufferedImage result = Imaging.getBufferedImage(compressed);
@@ -197,10 +198,10 @@ public void testAll5x2Images() {
             }
 
             try {
-                final HashMap params = new HashMap();
-                params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
-                        TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3);
-                params.put(TiffConstants.PARAM_KEY_T4_OPTIONS, 0);
+                final ImagingParametersTiff params = new ImagingParametersTiff();
+                params.setCompressionLevel(TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3);
+                params.setT4options(0);
+                
                 final byte[] compressed = Imaging.writeImageToBytes(image,
                         ImageFormats.TIFF, params);
                 final BufferedImage result = Imaging.getBufferedImage(compressed);
@@ -217,10 +218,10 @@ public void testAll5x2Images() {
             }
 
             try {
-                final HashMap params = new HashMap();
-                params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
-                        TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3);
-                params.put(TiffConstants.PARAM_KEY_T4_OPTIONS, 4);
+                final ImagingParametersTiff params = new ImagingParametersTiff();
+                params.setCompressionLevel(TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3);
+                params.setT4options(4);
+                
                 final byte[] compressed = Imaging.writeImageToBytes(image,
                         ImageFormats.TIFF, params);
                 final BufferedImage result = Imaging.getBufferedImage(compressed);
@@ -237,10 +238,10 @@ public void testAll5x2Images() {
             }
 
             try {
-                final HashMap params = new HashMap();
-                params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
-                        TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3);
-                params.put(TiffConstants.PARAM_KEY_T4_OPTIONS, 1);
+                final ImagingParametersTiff params = new ImagingParametersTiff();
+                params.setCompressionLevel(TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3);
+                params.setT4options(1);
+                
                 final byte[] compressed = Imaging.writeImageToBytes(image,
                         ImageFormats.TIFF, params);
                 final BufferedImage result = Imaging.getBufferedImage(compressed);
@@ -257,10 +258,10 @@ public void testAll5x2Images() {
             }
 
             try {
-                final HashMap params = new HashMap();
-                params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
-                        TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3);
-                params.put(TiffConstants.PARAM_KEY_T4_OPTIONS, 5);
+                final ImagingParametersTiff params = new ImagingParametersTiff();
+                params.setCompressionLevel(TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3);
+                params.setT4options(5);
+                
                 final byte[] compressed = Imaging.writeImageToBytes(image,
                         ImageFormats.TIFF, params);
                 final BufferedImage result = Imaging.getBufferedImage(compressed);
@@ -277,9 +278,9 @@ public void testAll5x2Images() {
             }
 
             try {
-                final HashMap params = new HashMap();
-                params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
-                        TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_4);
+                final ImagingParametersTiff params = new ImagingParametersTiff();
+                params.setCompressionLevel(TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_4);
+                
                 final byte[] compressed = Imaging.writeImageToBytes(image,
                         ImageFormats.TIFF, params);
                 final BufferedImage result = Imaging.getBufferedImage(compressed);
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java
index 1c85bd8c02..42ccc8d83f 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 package org.apache.commons.imaging.formats.tiff;
 
@@ -26,6 +28,7 @@
 import org.apache.commons.imaging.FormatCompliance;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.RationalNumber;
 import org.apache.commons.imaging.common.bytesource.ByteSourceArray;
 import org.apache.commons.imaging.formats.tiff.constants.GeoTiffTagConstants;
@@ -68,7 +71,7 @@ public void testReadWriteTags() throws ImageWriteException, ImageReadException,
         writer.write(tiff, set);
         
         TiffReader reader = new TiffReader(true);
-        Map params = new TreeMap();
+        final ImagingParameters params = new ImagingParameters();
         FormatCompliance formatCompliance = new FormatCompliance("");
         TiffContents contents = reader.readFirstDirectory(new ByteSourceArray(tiff.toByteArray()), params, true, formatCompliance);
         TiffDirectory rootDir = contents.directories.get(0);
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
index afe8824a71..392185a1a6 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.tiff;
@@ -21,14 +23,12 @@
 
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParametersTiff;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
 import org.apache.commons.imaging.util.Debug;
@@ -59,8 +59,10 @@ public void test() throws Exception {
             };
             for (final int compression : compressions) {
                 final File tempFile = createTempFile(imageFile.getName() + "-" + compression + ".", ".tif");
-                final Map params = new HashMap();
-                params.put(ImagingConstants.PARAM_KEY_COMPRESSION, compression);
+                
+                final ImagingParametersTiff params = new ImagingParametersTiff();
+                params.setCompressionLevel(compression);
+                
                 Imaging.writeImage(image, tempFile, ImageFormats.TIFF,
                         params);
                 final BufferedImage image2 = Imaging.getBufferedImage(tempFile);
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java
index bef9ccc85d..07a11664ed 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 package org.apache.commons.imaging.formats.tiff;
 
@@ -20,14 +22,12 @@
 
 import java.awt.image.BufferedImage;
 import java.io.IOException;
-import java.util.Map;
-import java.util.TreeMap;
 
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
+import org.apache.commons.imaging.ImagingParametersTiff;
 import org.junit.Test;
 
 public class TiffSubImageTest extends TiffBaseTest {
@@ -37,11 +37,11 @@ public void testSubImage() throws ImageReadException, ImageWriteException, IOExc
         BufferedImage src = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
         byte[] imageBytes = Imaging.writeImageToBytes(src, ImageFormats.TIFF, null);
         
-        Map params = new TreeMap();
-        params.put(TiffConstants.PARAM_KEY_SUBIMAGE_X, 0);
-        params.put(TiffConstants.PARAM_KEY_SUBIMAGE_Y, 0);
-        params.put(TiffConstants.PARAM_KEY_SUBIMAGE_WIDTH, 2);
-        params.put(TiffConstants.PARAM_KEY_SUBIMAGE_HEIGHT, 3);
+        final ImagingParametersTiff params = new ImagingParametersTiff();
+        params.setSubImageX(0);
+        params.setSubImageY(0);
+        params.setSubImageWidth(2);
+        params.setSubImageHeight(3);
         BufferedImage image = Imaging.getBufferedImage(imageBytes, params);
         assertEquals(image.getWidth(), 2);
         assertEquals(image.getHeight(), 3);

From 39037ef069ea339e22e10b7135ed7341840fb428 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 19:10:55 +0100
Subject: [PATCH 150/179] Replaced parameter Map by
 ImagingParameters

---
 .../imaging/formats/wbmp/WbmpReadTest.java     |  7 ++++---
 .../imaging/formats/xbm/XbmReadTest.java       |  6 ++++--
 .../imaging/formats/xmp/XmpUpdateTest.java     | 10 +++++-----
 .../imaging/formats/xpm/XpmReadTest.java       |  7 ++++---
 .../imaging/roundtrip/RoundtripTest.java       | 18 +++++++++---------
 5 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java b/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java
index bf2ddb7c70..1c14fd4561 100644
--- a/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java
@@ -11,6 +11,8 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *  under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.wbmp;
@@ -19,12 +21,11 @@
 
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Assert;
@@ -44,7 +45,7 @@ public void test() throws Exception {
             final ImageMetadata metadata = Imaging.getMetadata(imageFile);
             Assert.assertFalse(metadata instanceof File); // Dummy check to avoid unused warning (it may be null)
 
-            final Map params = new HashMap();
+            final ImagingParameters params = new ImagingParameters();
             final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
             assertNotNull(imageInfo);
 
diff --git a/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java b/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java
index 3bd6504da8..f19015e879 100644
--- a/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java
@@ -10,7 +10,8 @@
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
- *  under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.xbm;
@@ -25,6 +26,7 @@
 
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Assert;
@@ -44,7 +46,7 @@ public void test() throws Exception {
             final ImageMetadata metadata = Imaging.getMetadata(imageFile);
             Assert.assertFalse(metadata instanceof File); // Dummy check to avoid unused warning (it may be null)
 
-            final Map params = new HashMap();
+            final ImagingParameters params = new ImagingParameters();
             final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
             assertNotNull(imageInfo);
 
diff --git a/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java b/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java
index 84d8ca8b3b..c5af769f6a 100644
--- a/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.xmp;
@@ -22,14 +24,12 @@
 
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageFormat;
 import org.apache.commons.imaging.ImageFormats;
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.ImagingTest;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Test;
@@ -84,8 +84,8 @@ && isInvalidPNGTestFile(imageFile)) {
 
             // ----
 
-            final Map params = new HashMap();
-            params.put(ImagingConstants.PARAM_KEY_XMP_XML, xmpXml);
+            final ImagingParameters params = new ImagingParameters();
+            params.setXmpXmlAsString(xmpXml);
             Imaging.writeImage(image, tempFile, imageFormat, params);
 
             final String xmpXmlOut = Imaging.getXmpXml(tempFile);
diff --git a/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java b/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java
index 515b6e2117..13d4a03e1e 100644
--- a/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java
@@ -11,6 +11,8 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *  under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.formats.xpm;
@@ -19,12 +21,11 @@
 
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Assert;
@@ -44,7 +45,7 @@ public void test() throws Exception {
             final ImageMetadata metadata = Imaging.getMetadata(imageFile);
             Assert.assertFalse(metadata instanceof File); // Dummy check to avoid unused warning (it may be null)
 
-            final Map params = new HashMap();
+            final ImagingParameters params = new ImagingParameters();
             final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
             assertNotNull(imageInfo);
 
diff --git a/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java b/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java
index 374d6f6e83..d9759eaa58 100644
--- a/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java
+++ b/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java
@@ -13,6 +13,8 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de
  */
 
 package org.apache.commons.imaging.roundtrip;
@@ -24,8 +26,6 @@
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.apache.commons.imaging.ImageFormat;
 import org.apache.commons.imaging.ImageFormats;
@@ -33,7 +33,7 @@
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.ImagingParameters;
 import org.apache.commons.imaging.ImagingTest;
 import org.apache.commons.imaging.PixelDensity;
 import org.apache.commons.imaging.common.RgbBufferedImageFactory;
@@ -416,9 +416,10 @@ public void testPixelDensityRoundtrip() throws IOException,
             final File temp1 = createTempFile("pixeldensity.", "."
                     + formatInfo.format.getExtension());
             
-            final Map params = new HashMap();
+            final ImagingParameters params = new ImagingParameters();
             final PixelDensity pixelDensity = PixelDensity.createFromPixelsPerInch(75, 150);
-            params.put(ImagingConstants.PARAM_KEY_PIXEL_DENSITY, pixelDensity);
+            params.setPixelDensity(pixelDensity);
+            
             Imaging.writeImage(testImage, temp1, formatInfo.format, params);
             
             final ImageInfo imageInfo = Imaging.getImageInfo(temp1);
@@ -465,12 +466,11 @@ private void roundtrip(final FormatInfo formatInfo, final BufferedImage testImag
                 + formatInfo.format.getExtension());
         Debug.debug("tempFile: " + temp1.getName());
 
-        final Map params = new HashMap();
+        final ImagingParameters params = new ImagingParameters();
         Imaging.writeImage(testImage, temp1, formatInfo.format, params);
 
-        final Map readParams = new HashMap();
-        readParams.put(ImagingConstants.BUFFERED_IMAGE_FACTORY,
-                new RgbBufferedImageFactory());
+        final ImagingParameters readParams = new ImagingParameters();
+        readParams.setBufferedImageFactory(new RgbBufferedImageFactory());
         final BufferedImage image2 = Imaging.getBufferedImage(temp1, readParams);
         assertNotNull(image2);
 

From 5c55338c86718b67b7beffa94a787b7d9bf132e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9F?= 
Date: Fri, 13 Feb 2015 19:12:21 +0100
Subject: [PATCH 151/179] Replaced parameter Map by
 ImagingParameters - removed unused class ImagingConstants

---
 .../commons/imaging/ImagingConstants.java     | 137 ------------------
 1 file changed, 137 deletions(-)
 delete mode 100644 src/main/java/org/apache/commons/imaging/ImagingConstants.java

diff --git a/src/main/java/org/apache/commons/imaging/ImagingConstants.java b/src/main/java/org/apache/commons/imaging/ImagingConstants.java
deleted file mode 100644
index 56d7a2e741..0000000000
--- a/src/main/java/org/apache/commons/imaging/ImagingConstants.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.imaging;
-
-/**
- * Defines constants that may be used in passing options to 
- * ImageParser read/write implementations, the utility routines
- * implemented in the Imaging class, and throughout the
- * Apache Commons Imaging package.  Individual ImageParser 
- * implementations may define their own format-specific options.
- */
-public final class ImagingConstants {
-    
-    /**
-     * Parameter key. Applies to read and write operations.
-     * 

- * Valid values: Boolean.TRUE and Boolean.FALSE. - */ - public final static String PARAM_KEY_VERBOSE = "VERBOSE"; - - /** - * Parameter key. Used to hint the filename when reading from a byte array - * or InputStream. The filename hint can help disambiguate what file the - * image format. - *

- * Applies to read operations. - *

- * Valid values: filename as string - *

- * - * @see java.io.InputStream - */ - public final static String PARAM_KEY_FILENAME = "FILENAME"; - - /** - * Parameter key. Used in write operations to indicate desired image format. - *

- * Valid values: Any format defined in ImageFormat, such as - * ImageFormat.IMAGE_FORMAT_PNG. - *

- * - * @see org.apache.commons.imaging.ImageFormats - */ - public final static String PARAM_KEY_FORMAT = "FORMAT"; - - /** - * Parameter key. Used in write operations to indicate desired compression - * algorithm. - *

- * Currently only applies to writing TIFF image files. - *

- * Valid values: TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED, - * TiffConstants.TIFF_COMPRESSION_CCITT_1D, - * TiffConstants.TIFF_COMPRESSION_LZW, - * TiffConstants.TIFF_COMPRESSION_PACKBITS. - *

- * - * @see org.apache.commons.imaging.formats.tiff.constants.TiffConstants - */ - public final static String PARAM_KEY_COMPRESSION = "COMPRESSION"; - - public final static String BUFFERED_IMAGE_FACTORY = "BUFFERED_IMAGE_FACTORY"; - - /** - * Parameter key. Indicates whether to read embedded thumbnails. - *

- * Only applies to read EXIF metadata from JPEG/JFIF files. - *

- * Valid values: Boolean.TRUE and Boolean.FALSE. - *

- * - * @see org.apache.commons.imaging.formats.tiff.constants.TiffConstants - */ - public final static String PARAM_KEY_READ_THUMBNAILS = "READ_THUMBNAILS"; - - /** - * Parameter key. Indicates whether to throw exceptions when parsing invalid - * files, or whether to tolerate small problems. - *

- * Valid values: Boolean.TRUE and Boolean.FALSE. Default value: - * Boolean.FALSE. - *

- * - * @see org.apache.commons.imaging.formats.tiff.constants.TiffConstants - */ - public final static String PARAM_KEY_STRICT = "STRICT"; - - /** - * Parameter key. - * - * Only used when writing images. - *

- * Valid values: TiffOutputSet to write into the image's EXIF metadata. - *

- * - * @see org.apache.commons.imaging.formats.tiff.write.TiffOutputSet - */ - public final static String PARAM_KEY_EXIF = "EXIF"; - - /** - * Parameter key. - * - * Only used when writing images. - *

- * Valid values: String of XMP XML. - *

- */ - public final static String PARAM_KEY_XMP_XML = "XMP_XML"; - - /** - * Parameter key. Used in write operations to indicate the desired pixel - * density (DPI), and/or aspect ratio. - *

- * Valid values: PixelDensity - *

- * - * @see org.apache.commons.imaging.PixelDensity - */ - public final static String PARAM_KEY_PIXEL_DENSITY = "PIXEL_DENSITY"; - - private ImagingConstants() { - } -} From 5a454846351daa15836a6b809d0198ddbaadace5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 13 Feb 2015 19:22:05 +0100 Subject: [PATCH 152/179] took over javadoc from class TiffConstants --- .../imaging/ImagingParametersTiff.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 829c18d70e..9c274892a6 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -220,9 +220,12 @@ public boolean isT4optionsPresent() { } /** - * Parameter used in write operations to indicate desired t4 options. + * Used in write operations to indicate the desired + * T.4 options to use when using TIFF_COMPRESSION_CCITT_GROUP_3. *

- * Currently only applies to writing TIFF image files. + * Valid values: any Integer containing a mixture of the + * TIFF_FLAG_T4_OPTIONS_2D, TIFF_FLAG_T4_OPTIONS_UNCOMPRESSED_MODE, + * and TIFF_FLAG_T4_OPTIONS_FILL flags. * @return desired t4 options */ public int getT4options() { @@ -232,9 +235,12 @@ public int getT4options() { } /** - * Parameter used in write operations to indicate desired t4 options. + * Used in write operations to indicate the desired + * T.4 options to use when using TIFF_COMPRESSION_CCITT_GROUP_3. *

- * Currently only applies to writing TIFF image files. + * Valid values: any Integer containing a mixture of the + * TIFF_FLAG_T4_OPTIONS_2D, TIFF_FLAG_T4_OPTIONS_UNCOMPRESSED_MODE, + * and TIFF_FLAG_T4_OPTIONS_FILL flags. * @param value desired t4 options */ public void setT4options(final int value) { @@ -252,9 +258,11 @@ public boolean isT6optionsPresent() { } /** - * Parameter used in write operations to indicate desired t6 options. + * Used in write operations to indicate the desired + * T.6 options to use when using TIFF_COMPRESSION_CCITT_GROUP_4. *

- * Currently only applies to writing TIFF image files. + * Valid values: any Integer containing either zero or + * TIFF_FLAG_T6_OPTIONS_UNCOMPRESSED_MODE. * @return desired t6 options */ public int getT6options() { @@ -264,9 +272,11 @@ public int getT6options() { } /** - * Parameter used in write operations to indicate desired t6 options. + * Used in write operations to indicate the desired + * T.6 options to use when using TIFF_COMPRESSION_CCITT_GROUP_4. *

- * Currently only applies to writing TIFF image files. + * Valid values: any Integer containing either zero or + * TIFF_FLAG_T6_OPTIONS_UNCOMPRESSED_MODE. * @param value desired t6 options */ public void setT6options(final int value) { From 0a244389629c41985ca7824ed18c60f85921bf79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 13 Feb 2015 19:24:40 +0100 Subject: [PATCH 153/179] took over javadoc from class TiffConstants --- .../imaging/ImagingParametersTiff.java | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 9c274892a6..44ec1cc191 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -113,17 +113,10 @@ public boolean isCompressionBlockSizePresent() { } /** - * Parameter used in write operations to indicate desired compression - * block size. - *

- * Currently only applies to writing TIFF image files. - *

- * Default value: TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED - * @return Valid values: - * TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED, - * TiffConstants.TIFF_COMPRESSION_CCITT_1D, - * TiffConstants.TIFF_COMPRESSION_LZW, - * TiffConstants.TIFF_COMPRESSION_PACKBITS + * Specifies the amount of memory in bytes to be used for a strip + * or tile size when employing LZW compression. The default is + * 8000 (roughly 8K). Minimum value is 8000. + * @return the compression block size */ public int getCompressionBlockSize() { Integer value = this.compressionBlockSize; @@ -132,15 +125,10 @@ public int getCompressionBlockSize() { } /** - * Parameter used in write operations to indicate desired compression - * block size. - *

- * Currently only applies to writing TIFF image files. - * @param value Valid values: - * TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED, - * TiffConstants.TIFF_COMPRESSION_CCITT_1D, - * TiffConstants.TIFF_COMPRESSION_LZW, - * TiffConstants.TIFF_COMPRESSION_PACKBITS + * Specifies the amount of memory in bytes to be used for a strip + * or tile size when employing LZW compression. The default is + * 8000 (roughly 8K). Minimum value is 8000. + * @param value the compression block size */ public void setCompressionBlockSize(final int value) { this.compressionBlockSize = value; From c976b8a5a1b8eb9183d253bbe7f8b42fa499c8ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 13 Feb 2015 19:25:30 +0100 Subject: [PATCH 154/179] removed unused String PARAM_KEY_ fields --- .../formats/tiff/constants/TiffConstants.java | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java index 7468ecca92..7ff91d13b3 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java @@ -40,43 +40,10 @@ public final class TiffConstants { public static final int TIFF_COMPRESSION_UNCOMPRESSED_2 = 32771; public static final int TIFF_COMPRESSION_PACKBITS = 32773; - /** - * Parameter key. Used in write operations to indicate the desired - * T.4 options to use when using TIFF_COMPRESSION_CCITT_GROUP_3. - *

- * Valid values: any Integer containing a mixture of the - * TIFF_FLAG_T4_OPTIONS_2D, TIFF_FLAG_T4_OPTIONS_UNCOMPRESSED_MODE, - * and TIFF_FLAG_T4_OPTIONS_FILL flags. - */ - public static final String PARAM_KEY_T4_OPTIONS = "T4_OPTIONS"; - - /** - * Parameter key. Used in write operations to indicate the desired - * T.6 options to use when using TIFF_COMPRESSION_CCITT_GROUP_4. - *

- * Valid values: any Integer containing either zero or - * TIFF_FLAG_T6_OPTIONS_UNCOMPRESSED_MODE. - */ - public static final String PARAM_KEY_T6_OPTIONS = "T6_OPTIONS"; - public static final int TIFF_FLAG_T4_OPTIONS_2D = 1; public static final int TIFF_FLAG_T4_OPTIONS_UNCOMPRESSED_MODE = 2; public static final int TIFF_FLAG_T4_OPTIONS_FILL = 4; public static final int TIFF_FLAG_T6_OPTIONS_UNCOMPRESSED_MODE = 2; - - - public static final String PARAM_KEY_SUBIMAGE_X = "SUBIMAGE_X"; - public static final String PARAM_KEY_SUBIMAGE_Y = "SUBIMAGE_Y"; - public static final String PARAM_KEY_SUBIMAGE_WIDTH = "SUBIMAGE_WIDTH"; - public static final String PARAM_KEY_SUBIMAGE_HEIGHT = "SUBIMAGE_HEIGHT"; - - /** - * Specifies the amount of memory in bytes to be used for a strip - * or tile size when employing LZW compression. The default is - * 8000 (roughly 8K). Minimum value is 8000. - */ - public static final String PARAM_KEY_LZW_COMPRESSION_BLOCK_SIZE = - "PARAM_KEY_LZW_COMPRESSION_BLOCK_SIZE"; /** * Specifies a larger strip-size to be used for compression. This setting From 749cbb219c996a1bf055b614e4ff82b27aac2cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 13 Feb 2015 19:25:52 +0100 Subject: [PATCH 155/179] removed unused String PARAM_KEY_ fields --- .../apache/commons/imaging/formats/pcx/PcxConstants.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java index 864123a83e..0cef9ab1fc 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java +++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java @@ -10,18 +10,16 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pcx; public final class PcxConstants { - public static final String PARAM_KEY_PCX_COMPRESSION = "PCX_COMPRESSION"; public static final int PCX_COMPRESSION_UNCOMPRESSED = 0; public static final int PCX_COMPRESSION_RLE = 1; - public static final String PARAM_KEY_PCX_BIT_DEPTH = "PCX_BIT_DEPTH"; - private PcxConstants() { } } From 54ed80d3182ef45be9b4cd070433397a67189ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 13 Feb 2015 19:26:27 +0100 Subject: [PATCH 156/179] removed unused String PARAM_KEY_ fields --- .../imaging/formats/png/PngConstants.java | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java b/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java index c712d11723..5c52662549 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java @@ -13,6 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.png; @@ -25,13 +27,6 @@ public final class PngConstants { public static final BinaryConstant PNG_SIGNATURE = new BinaryConstant( new byte[] { (byte) 0x89, 'P', 'N', 'G', '\r', '\n', 0x1A, '\n', }); - public static final String PARAM_KEY_PNG_BIT_DEPTH = "PNG_BIT_DEPTH"; - public static final String PARAM_KEY_PNG_FORCE_INDEXED_COLOR = "PNG_FORCE_INDEXED_COLOR"; - public static final String PARAM_KEY_PNG_FORCE_TRUE_COLOR = "PNG_FORCE_TRUE_COLOR"; - - // public static final Object PARAM_KEY_PNG_BIT_DEPTH_YES = "YES"; - // public static final Object PARAM_KEY_PNG_BIT_DEPTH_NO = "NO"; - public static final byte COMPRESSION_TYPE_INFLATE_DEFLATE = 0; public static final byte FILTER_METHOD_ADAPTIVE = 0; @@ -59,16 +54,6 @@ public final class PngConstants { public static final String XMP_KEYWORD = "XML:com.adobe.xmp"; - /** - * Parameter key. - * - * Only used when writing Png images. - *

- * Valid values: a list of WriteTexts. - *

- */ - public static final String PARAM_KEY_PNG_TEXT_CHUNKS = "PNG_TEXT_CHUNKS"; - private PngConstants() { } } From 819fee5757a3d950a90672da87602b5d967eff4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Fri, 13 Feb 2015 19:27:25 +0100 Subject: [PATCH 157/179] removed unused String PARAM_KEY_ fields --- .../apache/commons/imaging/formats/pnm/PnmImageParser.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java index 66a2b88f8f..0d47aca8fb 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java @@ -47,9 +47,7 @@ public class PnmImageParser extends ImageParser { private static final String DEFAULT_EXTENSION = ".pnm"; - private static final String[] ACCEPTED_EXTENSIONS = { ".pbm", ".pgm", - ".ppm", ".pnm", ".pam" }; - public static final String PARAM_KEY_PNM_RAWBITS = "PNM_RAWBITS"; + private static final String[] ACCEPTED_EXTENSIONS = { ".pbm", ".pgm", ".ppm", ".pnm", ".pam" }; public static final String PARAM_VALUE_PNM_RAWBITS_YES = "YES"; public static final String PARAM_VALUE_PNM_RAWBITS_NO = "NO"; From 6bc68838299ea68a8ed084a59b4fd9d64065a20e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 14 Feb 2015 17:14:25 +0100 Subject: [PATCH 158/179] fixed mistake: true must returned if the value is NOT null --- .../commons/imaging/ImagingParameters.java | 10 +++++----- .../commons/imaging/ImagingParametersPcx.java | 4 ++-- .../commons/imaging/ImagingParametersPng.java | 4 ++-- .../commons/imaging/ImagingParametersTiff.java | 18 +++++++++--------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index a17d396c81..ccbc806362 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -143,7 +143,7 @@ public void disableStrict() { * @return {@code true} if there is a value present, {@false} else. */ public boolean isFileNameHintPresent() { - return this.fileNameHint == null; + return this.fileNameHint != null; } /** @@ -184,7 +184,7 @@ public void setFileNameHint(final String value) { * @return {@code true} if there is a value present, {@false} else. */ public boolean isXmpXmlAsStringPresent() { - return this.xmpXmlAsString == null; + return this.xmpXmlAsString != null; } /** @@ -217,7 +217,7 @@ public void setXmpXmlAsString(final String value) { * @return {@code true} if there is a value present, {@false} else. */ public boolean isImageFormatPresent() { - return this.imageFormat == null; + return this.imageFormat != null; } /** @@ -248,7 +248,7 @@ public void setImageFormat(final ImageFormat value) { * @return {@code true} if there is a value present, {@false} else. */ public boolean isBufferedImageFactoryPresent() { - return this.bufferedImageFactory == null; + return this.bufferedImageFactory != null; } /** @@ -279,7 +279,7 @@ public void setBufferedImageFactory(final BufferedImageFactory value) { * @see org.apache.commons.imaging.PixelDensity */ public boolean isPixelDensityPresent() { - return this.pixelDensity == null; + return this.pixelDensity != null; } /** diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java index 942d32c625..067d1835e6 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java @@ -44,7 +44,7 @@ public ImagingParametersPcx() { * @return */ public boolean isCompressionLevelPresent() { - return this.compressionLevel == null; + return this.compressionLevel != null; } /** @@ -84,7 +84,7 @@ public void setCompressionLevel(final int value) { * @return */ public boolean isBitDepthPresent() { - return this.bitDepth == null; + return this.bitDepth != null; } /** diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java index 304fcb1f12..9dc028be9f 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java @@ -51,7 +51,7 @@ public ImagingParametersPng() { * @return */ public boolean isBitDepthPresent() { - return this.bitDepth == null; + return this.bitDepth != null; } /** @@ -127,7 +127,7 @@ public boolean forceTrueColor() { * @return */ public boolean hasTextChunks() { - return this.textChunks == null; + return this.textChunks != null; } /** diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 44ec1cc191..7adc0abf35 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -65,7 +65,7 @@ public ImagingParametersTiff() { * @return */ public boolean isCompressionLevelPresent() { - return this.compressionLevel == null; + return this.compressionLevel != null; } /** @@ -109,7 +109,7 @@ public void setCompressionLevel(final int value) { * @return */ public boolean isCompressionBlockSizePresent() { - return this.compressionBlockSize == null; + return this.compressionBlockSize != null; } /** @@ -145,7 +145,7 @@ public void setCompressionBlockSize(final int value) { * @return {@code true} if there is a value present, {@false} else. */ public boolean isOutputSetPresent() { - return this.outputSetForMetaData == null; + return this.outputSetForMetaData != null; } /** @@ -204,7 +204,7 @@ public void disableReadThumbnails() { * @return */ public boolean isT4optionsPresent() { - return this.t4options == null; + return this.t4options != null; } /** @@ -242,7 +242,7 @@ public void setT4options(final int value) { * @return */ public boolean isT6optionsPresent() { - return this.t6options == null; + return this.t6options != null; } /** @@ -278,7 +278,7 @@ public void setT6options(final int value) { * @return */ public boolean isSubImageX_Present() { - return this.subImageX == null; + return this.subImageX != null; } /** @@ -310,7 +310,7 @@ public void setSubImageX(final int value) { * @return */ public boolean isSubImageY_Present() { - return this.subImageY == null; + return this.subImageY != null; } /** @@ -342,7 +342,7 @@ public void setSubImageY(final int value) { * @return */ public boolean isSubImageWidth_Present() { - return this.subImageWidth == null; + return this.subImageWidth != null; } /** @@ -374,7 +374,7 @@ public void setSubImageWidth(final int value) { * @return */ public boolean isSubImageHeight_Present() { - return this.subImageHeight == null; + return this.subImageHeight != null; } /** From b8a026643a7b980044c0aa58d0dda380b3882186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 14 Feb 2015 17:17:02 +0100 Subject: [PATCH 159/179] removed unused imports --- .../org/apache/commons/imaging/formats/psd/PsdReadTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java b/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java index b437481d38..7da6b59c1c 100644 --- a/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java @@ -22,9 +22,7 @@ import java.awt.image.BufferedImage; import java.io.File; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.apache.commons.imaging.ImageInfo; import org.apache.commons.imaging.Imaging; From fb80d9fc14d0f4325c42767b0024a90072d06939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 14 Feb 2015 17:22:09 +0100 Subject: [PATCH 160/179] if a parameter object is provided but there is no BufferedImageFactory present it must provide a SimpleBufferedImageFactory --- src/main/java/org/apache/commons/imaging/ImageParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImageParser.java b/src/main/java/org/apache/commons/imaging/ImageParser.java index d3f561767a..bc9ee6dc13 100644 --- a/src/main/java/org/apache/commons/imaging/ImageParser.java +++ b/src/main/java/org/apache/commons/imaging/ImageParser.java @@ -957,7 +957,7 @@ protected final boolean canAcceptExtension(final String filename) { * @return A valid instance of an implementation of a IBufferedImageFactory. */ protected BufferedImageFactory getBufferedImageFactory(final ImagingParameters params) { - if (params == null) { + if (params == null || params.isBufferedImageFactoryPresent() == false) { return new SimpleBufferedImageFactory(); } From 462a943348f29bdf28a69a69f09e964c93cbfe7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 14 Feb 2015 17:51:04 +0100 Subject: [PATCH 161/179] renamed some methods for accessing boolean parameters to have them all in the same naming scheme --- .../apache/commons/imaging/ImageParser.java | 2 +- .../commons/imaging/ImagingParameters.java | 30 +++++++++-------- .../imaging/ImagingParametersJpeg.java | 6 ++-- .../commons/imaging/ImagingParametersPng.java | 32 +++++++++++-------- .../commons/imaging/ImagingParametersPnm.java | 20 ++++++------ .../imaging/formats/bmp/BmpImageParser.java | 6 ++-- .../imaging/formats/gif/GifImageParser.java | 2 +- .../imaging/formats/jpeg/iptc/IptcParser.java | 4 +-- .../imaging/formats/pcx/PcxImageParser.java | 2 +- .../imaging/formats/png/PngWriter.java | 6 ++-- .../imaging/formats/pnm/PnmImageParser.java | 2 +- 11 files changed, 61 insertions(+), 51 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImageParser.java b/src/main/java/org/apache/commons/imaging/ImageParser.java index bc9ee6dc13..2794841441 100644 --- a/src/main/java/org/apache/commons/imaging/ImageParser.java +++ b/src/main/java/org/apache/commons/imaging/ImageParser.java @@ -983,6 +983,6 @@ public static boolean isStrict(final ImagingParameters params) { if (params == null) { return false; } - return params.isStrict(); + return params.isStrictEnabled(); } } diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index ccbc806362..7d775269c6 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -30,13 +30,20 @@ * There are two kinds of parameters: with and without default value. For * parameters without default value it implements lazy initialization: *
- * After getting an instance there is no value present until you set one using - * one the setter methods. Until a value is set, isXPresent() will return - * {@code false}. Accessing the value with getX() in this state will cause a RuntimeException. - * After a value is set with setX() isXPresent() will return {@code true} and you may access the value. + * After getting an instance there is no value present. In this state accessing + * the value with getX() in this state will cause a RuntimeException. + * There is always a isXPresent() method for this parameter which returns + * {@code false} in this state. + *
+ * Once you provided a value using setX() you may access this value with getX(). + * The isXPresent() method will return {@code true} now. *

* Other parameters have a default value. This is told in the javadoc for their * getX() method. They don't have a isXPresent() method. You may access them any time. + *

+ * All boolean parameters have default parameters. Their setter and getter have a different + * naming scheme: enableX() causes isXEnabled() to return {@code true} while + * disableX() causes isXEnabled() to return {@code false}. */ public class ImagingParameters { @@ -69,15 +76,13 @@ public ImagingParameters() { //****** verbose ****** /** - * Turns the verbose mode on/off. + * Tells if the verbose mode is turned on/off. *

* Parameter applies to read and write operations. - *

- * Default value: verbose mode disabled. * @return Valid values: {@code true} means {@literal "verbose mode enabled"} - * and {@code Boolean.FALSE} means {@literal "verbose mode disabled"}. + * and {@code false} means {@literal "verbose mode disabled"} (default value). */ - public boolean isVerbose() { + public boolean isVerboseEnabled() { return this.verbose; } @@ -102,13 +107,12 @@ public void disableVerbose() { /** * Parameter indicates whether to throw exceptions when parsing invalid * files, or whether to tolerate small problems. - *

- * Default value: tolerate small problems. * @return Valid values: {@code true} causes it to throw exceptions - * when parsing invalid files and {@code false} let it tolerate small problems. + * when parsing invalid files and {@code false} let it tolerate small problems + * (default value) * @see org.apache.commons.imaging.formats.tiff.constants.TiffConstants */ - public boolean isStrict() { + public boolean isStrictEnabled() { return this.strict; } diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index 1b2894be97..45dd3441af 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -42,11 +42,11 @@ public ImagingParametersJpeg() { *

* Only applies to read EXIF metadata from JPEG/JFIF files. *

- * Default value: don't read embedded thumbnails + * Default value: {@code false} * @return Valid values:{@code true} (causes it to read embedded thumbnails - * and {@code false} (don't read embedded thumbnails). + * and {@code false} (don't read embedded thumbnails, default value). */ - public boolean getReadThumbnails() { + public boolean isReadThumbnailsEnabled() { return this.readThumbnailsValue; } diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java index 9dc028be9f..bbe9fe6d36 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java @@ -72,7 +72,17 @@ public void setBitDepth(final byte value) { this.bitDepth = value; } - // ****** forceIndexedColor ****** + // ****** isForceIndexedColorEnabled ****** + + /** + * {@code true} = force indexed color; {@code false} = don't force indexed color + *

+ * Default value: {@code false} + * @return + */ + public boolean isForceIndexedColorEnabled() { + return this.forceIndexedColor; + } /** * force indexed color @@ -88,16 +98,18 @@ public void disableForceIndexedColor() { this.forceIndexedColor = false; } + // ****** isForceTrueColorEnabled ****** + /** - * {@code true} = force indexed color; {@code false} = don't force indexed color + * {@code true} = force true color; {@code false} = don't force true color + *

+ * Default value: {@code false} * @return */ - public boolean forceIndexedColor() { - return this.forceIndexedColor; + public boolean isForceTrueColorEnabled() { + return this.forceTrueColor; } - // ****** forceTrueColor ****** - /** * force indexed color */ @@ -112,14 +124,6 @@ public void disableForceTrueColor() { this.forceTrueColor = false; } - /** - * {@code true} = force true color; {@code false} = don't force true color - * @return - */ - public boolean forceTrueColor() { - return this.forceTrueColor; - } - //****** textChunks ****** /** diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java index 7cc2f3290d..0f9f02cb65 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java @@ -35,7 +35,17 @@ public ImagingParametersPnm() { this.useRawbits = true; } - // ****** getUseRawbits ****** + // ****** isUseRawbitsEnabled ****** + + /** + * {@code true} = use raw bits; {@code false} = don't use raw bits + *

+ * Default value: {@code false} + * @return + */ + public boolean isUseRawbitsEnabled() { + return this.useRawbits; + } /** * use raw bits @@ -50,12 +60,4 @@ public void enableUseRawbits() { public void disableUseRawbits() { this.useRawbits = false; } - - /** - * {@code true} = use raw bits; {@code false} = don't use raw bits - * @return - */ - public boolean getUseRawbits() { - return this.useRawbits; - } } diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java index 31bcd39ebb..0e1ccd6b3f 100644 --- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java @@ -496,7 +496,7 @@ public Dimension getImageSize(final ByteSource byteSource, final ImagingParamete throws ImageReadException, IOException { // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; - final boolean verbose = parameters.isVerbose(); + final boolean verbose = parameters.isVerboseEnabled(); final BmpHeaderInfo bhi = readBmpHeaderInfo(byteSource, verbose); @@ -545,7 +545,7 @@ public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParamete // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; - final boolean verbose = parameters.isVerbose(); + final boolean verbose = parameters.isVerboseEnabled(); InputStream is = null; ImageContents ic = null; @@ -665,7 +665,7 @@ public BufferedImage getBufferedImage(final InputStream inputStream, final Imagi // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; - final boolean verbose = parameters.isVerbose(); + final boolean verbose = parameters.isVerboseEnabled(); final ImageContents ic = readImageContents(inputStream, FormatCompliance.getDefault(), verbose); diff --git a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java index 8a93ddeabf..0a926c55e5 100644 --- a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java @@ -761,7 +761,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; - final boolean verbose = parameters.isVerbose(); + final boolean verbose = parameters.isVerboseEnabled(); final String xmpXml = (parameters.isXmpXmlAsStringPresent()) ? parameters.getXmpXmlAsString(): null; final int width = src.getWidth(); diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java index ddd39929b1..5214f7ebae 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java @@ -102,8 +102,8 @@ public PhotoshopApp13Data parsePhotoshopSegment(final byte[] bytes, final Imagin // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; - final boolean strict = parameters.isStrict(); - final boolean verbose = parameters.isVerbose(); + final boolean strict = parameters.isStrictEnabled(); + final boolean verbose = parameters.isVerboseEnabled(); return parsePhotoshopSegment(bytes, verbose, strict); } diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java index d768f436a4..28737ba233 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java @@ -518,7 +518,7 @@ public final BufferedImage getBufferedImage(final ByteSource byteSource, // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; - boolean isStrict = parameters.isStrict(); + boolean isStrict = parameters.isStrictEnabled(); InputStream is = null; boolean canThrow = false; diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java index 9aaf7318be..fa21b4ac56 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java @@ -44,7 +44,7 @@ public PngWriter(final boolean verbose) { } public PngWriter(final ImagingParameters params) { - this.verbose = params != null && Boolean.TRUE.equals(params.isVerbose()); + this.verbose = params != null && Boolean.TRUE.equals(params.isVerboseEnabled()); } /* @@ -397,8 +397,8 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima if (parameters instanceof ImagingParametersPng) { final ImagingParametersPng parametersPng = (ImagingParametersPng) parameters; - forceIndexedColor = parametersPng.forceIndexedColor(); - forceTrueColor = parametersPng.forceTrueColor(); + forceIndexedColor = parametersPng.isForceIndexedColorEnabled(); + forceTrueColor = parametersPng.isForceTrueColorEnabled(); } // only generic parameters are provided so we need to use default values // for PNG format specific parameters diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java index 0d47aca8fb..4d222dc041 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java @@ -331,7 +331,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima // read parameters specific for the PNM format if (params instanceof ImagingParametersPnm) { final ImagingParametersPnm paramsPnm = (ImagingParametersPnm) params; - useRawbits = paramsPnm.getUseRawbits(); + useRawbits = paramsPnm.isUseRawbitsEnabled(); } } From 4b79c82506d998528be39718b10ca1e3e9a1ad71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Sat, 14 Feb 2015 18:34:39 +0100 Subject: [PATCH 162/179] removed comment about "Map params" argument because it was replaced by ImagingParameters --- .../apache/commons/imaging/ImageParser.java | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImageParser.java b/src/main/java/org/apache/commons/imaging/ImageParser.java index 2794841441..6cf2e8279a 100644 --- a/src/main/java/org/apache/commons/imaging/ImageParser.java +++ b/src/main/java/org/apache/commons/imaging/ImageParser.java @@ -77,24 +77,6 @@ * the intentions of the original. Therefore, you should not assume * that the documentation is perfect, especially in the more obscure * and specialized areas of implementation. - * - *

The "Map params" argument

- * - * Many of the methods specified by this class accept an argument of - * type Map giving a list of parameters to be used when processing an - * image. For example, some of the output formats permit the specification - * of different kinds of image compression or color models. Some of the - * reading methods permit the calling application to require strict - * format compliance. In many cases, however, an application will not - * require the use of this argument. While some of the ImageParser - * implementations check for (and ignore) null arguments for this parameter, - * not all of them do (at least not at the time these notes were written). - * Therefore, a prudent programmer will always supply an valid, though - * empty instance of a Map implementation when calling such methods. - * Generally, the java HashMap class is useful for this purpose. - * - *

Additionally, developers creating or enhancing classes derived - * from ImageParser are encouraged to include such checks in their code. */ public abstract class ImageParser extends BinaryFileParser { From afce5bed79ebbe04fafdf0c17f14ba699f0f61da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Wed, 18 Feb 2015 21:17:05 +0100 Subject: [PATCH 163/179] setting read thumbnails param more elegant --- .../bytesource/ByteSourceImageTest.java | 14 ++-------- .../imaging/formats/jpeg/JpegReadTest.java | 8 +----- .../formats/jpeg/exif/ExifDumpTest.java | 7 +---- .../imaging/formats/jpeg/exif/GpsTest.java | 7 +---- .../jpeg/exif/SpecificExifTagTest.java | 7 +---- .../formats/jpeg/iptc/IptcAddTest.java | 7 +---- .../formats/jpeg/iptc/IptcDumpTest.java | 7 +---- .../formats/jpeg/iptc/IptcUpdateTest.java | 28 +++---------------- 8 files changed, 12 insertions(+), 73 deletions(-) diff --git a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java index 6570e1bcf0..3eff8f3773 100644 --- a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java +++ b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java @@ -177,22 +177,12 @@ public void checkGetImageInfo(final File imageFile, final byte[] imageFileBytes) final ImageFormat imageFormat = Imaging.guessFormat(imageFile); if (imageFormat.equals(ImageFormats.TIFF)) { final ImagingParametersTiff paramsTiff = new ImagingParametersTiff(); - if (ignoreImageData == true) { - paramsTiff.disableReadThumbnails(); - } - else { - paramsTiff.enableReadThumbnails(); - } + if (ignoreImageData == false) paramsTiff.enableReadThumbnails(); params = paramsTiff; } else if (imageFormat.equals(ImageFormats.JPEG)) { final ImagingParametersJpeg paramsJpeg = new ImagingParametersJpeg(); - if (ignoreImageData == true) { - paramsJpeg.enableReadThumbnails(); - } - else { - paramsJpeg.disableReadThumbnails(); - } + if (ignoreImageData == false) paramsJpeg.enableReadThumbnails(); params = paramsJpeg; } else { diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java index 64b7e80bbc..b6d8f75fc1 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java @@ -54,13 +54,7 @@ public JpegReadTest(File imageFile) { public void test() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - - if (ignoreImageData) { - params.disableReadThumbnails(); - } - else { - params.enableReadThumbnails(); - } + if (ignoreImageData == false) params.enableReadThumbnails(); final ImageMetadata metadata = Imaging.getMetadata(imageFile, params); // TODO only run this tests with images that have metadata... diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java index 0aaed0b797..829a07552c 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java @@ -61,12 +61,7 @@ public void testDumpJFIF() throws Exception { public void testMetadata() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData) { - params.disableReadThumbnails(); - } - else { - params.enableReadThumbnails(); - } + if (ignoreImageData == false) params.enableReadThumbnails(); final JpegImageMetadata metadata = (JpegImageMetadata) Imaging.getMetadata(imageFile, params); assertNotNull(metadata); diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java index 207d33ac25..69f5f1765c 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java @@ -54,12 +54,7 @@ public void test() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData) { - params.disableReadThumbnails(); - } - else { - params.enableReadThumbnails(); - } + if (ignoreImageData == false) params.enableReadThumbnails(); final JpegImageMetadata metadata = (JpegImageMetadata) Imaging .getMetadata(imageFile, params); diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java index 11ed4708d0..dc78c5627b 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java @@ -68,12 +68,7 @@ private void checkImage(final File imageFile) throws IOException, final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData) { - params.disableReadThumbnails(); - } - else { - params.enableReadThumbnails(); - } + if (ignoreImageData == false) params.enableReadThumbnails(); // note that metadata might be null if no metadata is found. final ImageMetadata metadata = Imaging.getMetadata(imageFile, params); diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java index feb7a053e0..48b8ef7ec5 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java @@ -63,12 +63,7 @@ public void testAddIptcData() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData) { - params.disableReadThumbnails(); - } - else { - params.enableReadThumbnails(); - } + if (ignoreImageData == false) params.enableReadThumbnails(); final JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, params); if (metadata == null) { diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java index 13b89b962c..d69a9acb02 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java @@ -52,12 +52,7 @@ public IptcDumpTest(File imageFile) { public void test() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData) { - params.disableReadThumbnails(); - } - else { - params.enableReadThumbnails(); - } + if (ignoreImageData == false) params.enableReadThumbnails(); final JpegImageMetadata metadata = (JpegImageMetadata) Imaging.getMetadata(imageFile, params); assertNotNull(metadata); diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java index 1db46bbf56..32c4bc4b9f 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java @@ -65,12 +65,7 @@ public void testRemove() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData) { - params.disableReadThumbnails(); - } - else { - params.enableReadThumbnails(); - } + if (ignoreImageData == false) params.enableReadThumbnails(); final JpegPhotoshopMetadata metadata = new JpegImageParser() .getPhotoshopMetadata(byteSource, params); @@ -103,12 +98,7 @@ public void testInsert() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData) { - params.disableReadThumbnails(); - } - else { - params.enableReadThumbnails(); - } + if (ignoreImageData == false) params.enableReadThumbnails(); final JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, params); assertNotNull(metadata); @@ -153,12 +143,7 @@ public void testUpdate() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData) { - params.disableReadThumbnails(); - } - else { - params.enableReadThumbnails(); - } + if (ignoreImageData == false) params.enableReadThumbnails(); final JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, params); assertNotNull(metadata); @@ -205,12 +190,7 @@ public void testNoChangeUpdate() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData) { - params.disableReadThumbnails(); - } - else { - params.enableReadThumbnails(); - } + if (ignoreImageData == false) params.enableReadThumbnails(); final JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, params); assertNotNull(metadata); From f197352dba69e6e53af9a35f795001a068e33d0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 23 Feb 2015 21:19:29 +0100 Subject: [PATCH 164/179] doc --- src/main/java/org/apache/commons/imaging/ImageParser.java | 2 -- src/main/java/org/apache/commons/imaging/Imaging.java | 2 -- .../java/org/apache/commons/imaging/ImagingParameters.java | 3 --- .../java/org/apache/commons/imaging/ImagingParametersJpeg.java | 3 --- .../java/org/apache/commons/imaging/ImagingParametersPcx.java | 3 --- .../java/org/apache/commons/imaging/ImagingParametersPng.java | 3 --- .../java/org/apache/commons/imaging/ImagingParametersPnm.java | 3 --- .../java/org/apache/commons/imaging/ImagingParametersTiff.java | 3 --- .../org/apache/commons/imaging/formats/bmp/BmpImageParser.java | 2 -- .../org/apache/commons/imaging/formats/dcx/DcxImageParser.java | 2 -- .../org/apache/commons/imaging/formats/gif/GifImageParser.java | 2 -- .../apache/commons/imaging/formats/icns/IcnsImageParser.java | 2 -- .../org/apache/commons/imaging/formats/ico/IcoImageParser.java | 2 -- .../apache/commons/imaging/formats/jpeg/JpegImageParser.java | 2 -- .../apache/commons/imaging/formats/jpeg/iptc/IptcParser.java | 2 -- .../commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java | 2 -- .../commons/imaging/formats/jpeg/segments/App13Segment.java | 2 -- .../org/apache/commons/imaging/formats/pcx/PcxConstants.java | 2 -- .../org/apache/commons/imaging/formats/pcx/PcxImageParser.java | 2 -- .../java/org/apache/commons/imaging/formats/pcx/PcxWriter.java | 2 -- .../org/apache/commons/imaging/formats/png/PngConstants.java | 2 -- .../org/apache/commons/imaging/formats/png/PngImageParser.java | 2 -- .../java/org/apache/commons/imaging/formats/png/PngWriter.java | 2 -- .../java/org/apache/commons/imaging/formats/pnm/PamWriter.java | 2 -- .../java/org/apache/commons/imaging/formats/pnm/PbmWriter.java | 2 -- .../java/org/apache/commons/imaging/formats/pnm/PgmWriter.java | 2 -- .../org/apache/commons/imaging/formats/pnm/PnmImageParser.java | 2 -- .../java/org/apache/commons/imaging/formats/pnm/PnmWriter.java | 2 -- .../java/org/apache/commons/imaging/formats/pnm/PpmWriter.java | 2 -- .../org/apache/commons/imaging/formats/psd/PsdImageParser.java | 2 -- .../apache/commons/imaging/formats/rgbe/RgbeImageParser.java | 2 -- .../org/apache/commons/imaging/formats/tiff/TiffDirectory.java | 2 -- .../apache/commons/imaging/formats/tiff/TiffImageParser.java | 2 -- .../org/apache/commons/imaging/formats/tiff/TiffReader.java | 2 -- .../commons/imaging/formats/tiff/constants/TiffConstants.java | 2 -- .../imaging/formats/tiff/write/TiffImageWriterBase.java | 2 -- .../imaging/formats/tiff/write/TiffImageWriterLossless.java | 2 -- .../apache/commons/imaging/formats/wbmp/WbmpImageParser.java | 3 --- .../org/apache/commons/imaging/formats/xbm/XbmImageParser.java | 3 --- .../org/apache/commons/imaging/formats/xpm/XpmImageParser.java | 3 --- .../commons/imaging/common/bytesource/ByteSourceImageTest.java | 2 -- .../imaging/examples/ApacheImagingSpeedAndMemoryTest.java | 2 -- .../org/apache/commons/imaging/examples/ImageReadExample.java | 2 -- .../org/apache/commons/imaging/examples/ImageWriteExample.java | 2 -- .../java/org/apache/commons/imaging/examples/SampleUsage.java | 2 -- .../org/apache/commons/imaging/formats/bmp/BmpReadTest.java | 2 -- .../apache/commons/imaging/formats/bmp/BmpRoundtripTest.java | 2 -- .../org/apache/commons/imaging/formats/dcx/DcxReadTest.java | 2 -- .../org/apache/commons/imaging/formats/icns/IcnsReadTest.java | 2 -- .../org/apache/commons/imaging/formats/ico/IcoReadTest.java | 2 -- .../org/apache/commons/imaging/formats/jpeg/JpegReadTest.java | 2 -- .../imaging/formats/jpeg/JpegWithJpegThumbnailTest.java | 2 -- .../commons/imaging/formats/jpeg/exif/AsciiFieldTest.java | 2 -- .../apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java | 2 -- .../org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java | 2 -- .../commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java | 2 -- .../commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java | 2 -- .../apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java | 2 -- .../apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java | 2 -- .../commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java | 2 -- .../commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java | 2 -- .../commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java | 2 -- .../org/apache/commons/imaging/formats/pam/PamReadTest.java | 2 -- .../org/apache/commons/imaging/formats/pcx/PcxReadTest.java | 2 -- .../commons/imaging/formats/png/ConvertPngToGifTest.java | 2 -- .../commons/imaging/formats/png/PngMultipleRoundtripTest.java | 2 -- .../org/apache/commons/imaging/formats/png/PngTextTest.java | 2 -- .../imaging/formats/png/PngWriteForceTrueColorText.java | 2 -- .../apache/commons/imaging/formats/png/PngWriteReadTest.java | 2 -- .../org/apache/commons/imaging/formats/psd/PsdReadTest.java | 2 -- .../org/apache/commons/imaging/formats/tiff/TiffCcittTest.java | 2 -- .../org/apache/commons/imaging/formats/tiff/TiffLzwTest.java | 2 -- .../commons/imaging/formats/tiff/TiffReadWriteTagsTest.java | 2 -- .../apache/commons/imaging/formats/tiff/TiffRoundtripTest.java | 2 -- .../apache/commons/imaging/formats/tiff/TiffSubImageTest.java | 2 -- .../org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java | 3 --- .../org/apache/commons/imaging/formats/xbm/XbmReadTest.java | 2 -- .../org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java | 2 -- .../org/apache/commons/imaging/formats/xpm/XpmReadTest.java | 3 --- .../org/apache/commons/imaging/roundtrip/RoundtripTest.java | 2 -- 80 files changed, 171 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImageParser.java b/src/main/java/org/apache/commons/imaging/ImageParser.java index 6cf2e8279a..4f2777d93a 100644 --- a/src/main/java/org/apache/commons/imaging/ImageParser.java +++ b/src/main/java/org/apache/commons/imaging/ImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging; diff --git a/src/main/java/org/apache/commons/imaging/Imaging.java b/src/main/java/org/apache/commons/imaging/Imaging.java index 47021e6301..8c88452095 100644 --- a/src/main/java/org/apache/commons/imaging/Imaging.java +++ b/src/main/java/org/apache/commons/imaging/Imaging.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging; diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 7d775269c6..25a3c8b27e 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -13,9 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Created 2015 by Michael Gross, mgmechanics@mgmechanics.de - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging; diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index 45dd3441af..868a2ef13c 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -13,9 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Created 2015 by Michael Gross, mgmechanics@mgmechanics.de - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging; diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java index 067d1835e6..66eaf75b7b 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPcx.java @@ -13,9 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Created 2015 by Michael Gross, mgmechanics@mgmechanics.de - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging; diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java index bbe9fe6d36..3069010a96 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java @@ -13,9 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Created 2015 by Michael Gross, mgmechanics@mgmechanics.de - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging; diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java index 0f9f02cb65..aa98af518b 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java @@ -13,9 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Created 2015 by Michael Gross, mgmechanics@mgmechanics.de - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging; diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 7adc0abf35..050f47cba1 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -13,9 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Created 2015 by Michael Gross, mgmechanics@mgmechanics.de - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging; diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java index 0e1ccd6b3f..57ce95539a 100644 --- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.bmp; diff --git a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java index c5ecac24b9..ff5e9b7dbd 100644 --- a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.dcx; diff --git a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java index 0a926c55e5..f83227a467 100644 --- a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.gif; diff --git a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java index 3d63694530..56780d4e15 100644 --- a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.icns; diff --git a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java index 924f3d2f2a..b2812e103d 100644 --- a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.ico; diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java index 00e40ab69b..f0314597a3 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg; diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java index 5214f7ebae..9f3109bbc5 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.iptc; diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java index 2a82739d15..d3adbbc641 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.iptc; diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App13Segment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App13Segment.java index 9f18e43823..bbb27c85c0 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App13Segment.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App13Segment.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.segments; diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java index 0cef9ab1fc..afb45d9ab3 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java +++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java @@ -10,8 +10,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pcx; diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java index 28737ba233..4abc2b22a9 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pcx; diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java index 2f2d3b3ce3..cca27bb1e4 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java @@ -10,8 +10,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pcx; diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java b/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java index 5c52662549..352abc8b53 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.png; diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java index 87d7fc3f70..0da1d4a5c2 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.png; diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java index fa21b4ac56..5e2723445c 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.png; diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java index 9365c27807..4849fda673 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pnm; diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java index 642c3609c5..d9e600e1d1 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pnm; diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java index 7ac474a1eb..87575cc802 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pnm; diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java index 4d222dc041..287750074e 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pnm; diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java index 4e7536e52a..dadbb7d922 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pnm; diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java index 44d112ddc9..5fc21ca418 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pnm; diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java index 58157a12bf..39f97ba447 100644 --- a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.psd; diff --git a/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java b/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java index 9086d026d5..484eaa9b31 100644 --- a/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.rgbe; diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java index 8b6d8a950a..0c9da54a2b 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java index 42e4c949ef..7f7797c396 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java index 3e97838f3f..521fcf209b 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java index 7ff91d13b3..dbdf7c6cf4 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffConstants.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff.constants; diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java index ded0c43a7b..c5ccee3687 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff.write; diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java index 99112804c4..d7430bae8e 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff.write; diff --git a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java index 6479e5ce83..9c9cb9b6ad 100644 --- a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java @@ -10,9 +10,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.wbmp; diff --git a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java index 2617a2eed0..b145462d16 100644 --- a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java @@ -10,9 +10,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.xbm; diff --git a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java index 39a618d883..92a593746a 100644 --- a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java @@ -10,9 +10,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.xpm; diff --git a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java index 3eff8f3773..81a8057f0b 100644 --- a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java +++ b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.common.bytesource; diff --git a/src/test/java/org/apache/commons/imaging/examples/ApacheImagingSpeedAndMemoryTest.java b/src/test/java/org/apache/commons/imaging/examples/ApacheImagingSpeedAndMemoryTest.java index 80666b36bc..ce7424cfaf 100644 --- a/src/test/java/org/apache/commons/imaging/examples/ApacheImagingSpeedAndMemoryTest.java +++ b/src/test/java/org/apache/commons/imaging/examples/ApacheImagingSpeedAndMemoryTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ /**************************************************************** diff --git a/src/test/java/org/apache/commons/imaging/examples/ImageReadExample.java b/src/test/java/org/apache/commons/imaging/examples/ImageReadExample.java index 232f03daeb..60f2a1baca 100644 --- a/src/test/java/org/apache/commons/imaging/examples/ImageReadExample.java +++ b/src/test/java/org/apache/commons/imaging/examples/ImageReadExample.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.examples; diff --git a/src/test/java/org/apache/commons/imaging/examples/ImageWriteExample.java b/src/test/java/org/apache/commons/imaging/examples/ImageWriteExample.java index b1dbf45c10..92f8b68d64 100644 --- a/src/test/java/org/apache/commons/imaging/examples/ImageWriteExample.java +++ b/src/test/java/org/apache/commons/imaging/examples/ImageWriteExample.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.examples; diff --git a/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java b/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java index 80dc35d413..4beb690231 100644 --- a/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java +++ b/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.examples; diff --git a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java index 4cf6900422..8c1d39b0b8 100644 --- a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.bmp; diff --git a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpRoundtripTest.java b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpRoundtripTest.java index e45f3cc753..3c1e407423 100644 --- a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpRoundtripTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpRoundtripTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.bmp; diff --git a/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java b/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java index 048100a1e6..86b85fcba1 100644 --- a/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.dcx; diff --git a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java b/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java index 788cbd0cfd..01c5e3ae4d 100644 --- a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.icns; diff --git a/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java b/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java index 5ae014624a..f9cd3d5f30 100644 --- a/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.ico; diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java index b6d8f75fc1..7fcfd234ea 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg; diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegWithJpegThumbnailTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegWithJpegThumbnailTest.java index 72de8a0695..8de9599034 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegWithJpegThumbnailTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegWithJpegThumbnailTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg; diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java index d26b0c530f..2147ac03fa 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.exif; diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java index 829a07552c..8c55676104 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.exif; diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java index 69f5f1765c..c521ba6a64 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.exif; diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java index 2328777abe..a191e172ad 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.exif; diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java index dc78c5627b..9126f2942c 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.exif; diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java index 48b8ef7ec5..a397df191a 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.iptc; diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java index d69a9acb02..0ade85a536 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.iptc; diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java index 32c4bc4b9f..b16e6a1f4a 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.iptc; diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java index a59dc32b2b..f1e1b9750d 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.xmp; diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java index 69e7ec4ad3..9093f4780f 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.jpeg.xmp; diff --git a/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java b/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java index f74ea1dbb0..655a610fd4 100644 --- a/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pam; diff --git a/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java b/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java index 97b70eafb2..454c3b1754 100644 --- a/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.pcx; diff --git a/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java b/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java index b5226c34e2..4e4e024fb9 100644 --- a/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.png; diff --git a/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java b/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java index 514129ffbe..c2d4b07bd4 100644 --- a/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.png; diff --git a/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java b/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java index 01b6c5c248..d239411464 100644 --- a/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.png; diff --git a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java index dbf6661b95..6deba31b9b 100644 --- a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java +++ b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.png; diff --git a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java index d80f6f19f2..aab4f0316a 100644 --- a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.png; diff --git a/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java b/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java index 7da6b59c1c..3fc5d7baa2 100644 --- a/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.psd; diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java index bcbe2c0718..12ed166d6a 100644 --- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java index ebc77ef5c9..822dd1be50 100644 --- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java index 42ccc8d83f..e74bddd60a 100644 --- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java index 392185a1a6..5d35fa26fd 100644 --- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java index 07a11664ed..3b29fe0e47 100644 --- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.tiff; diff --git a/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java b/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java index 1c14fd4561..50ff878e1f 100644 --- a/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java @@ -10,9 +10,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.wbmp; diff --git a/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java b/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java index f19015e879..2fa9b2c1f5 100644 --- a/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java @@ -10,8 +10,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.xbm; diff --git a/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java b/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java index c5af769f6a..30a99ce3d6 100644 --- a/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.xmp; diff --git a/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java b/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java index 13d4a03e1e..f420e7eac0 100644 --- a/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java @@ -10,9 +10,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.formats.xpm; diff --git a/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java b/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java index d9759eaa58..d8d82875c0 100644 --- a/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java +++ b/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java @@ -13,8 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * - * Changed 2015 by Michael Gross, mgmechanics@mgmechanics.de */ package org.apache.commons.imaging.roundtrip; From 2cbee0d3d25298f2d42622443ce25804b52e6541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 23 Feb 2015 22:19:35 +0100 Subject: [PATCH 165/179] reverted unrelated modifications --- .../org/apache/commons/imaging/Imaging.java | 81 ------------------- 1 file changed, 81 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/Imaging.java b/src/main/java/org/apache/commons/imaging/Imaging.java index 8c88452095..68362f3fee 100644 --- a/src/main/java/org/apache/commons/imaging/Imaging.java +++ b/src/main/java/org/apache/commons/imaging/Imaging.java @@ -191,8 +191,6 @@ public static boolean hasImageFileExtension(String filename) { * @return An ImageFormat, such as ImageFormat.IMAGE_FORMAT_JPEG. Returns * ImageFormat.IMAGE_FORMAT_UNKNOWN if the image type cannot be * determined. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static ImageFormat guessFormat(final byte[] bytes) throws ImageReadException, IOException { @@ -213,8 +211,6 @@ public static ImageFormat guessFormat(final byte[] bytes) * @return An ImageFormat, such as ImageFormat.IMAGE_FORMAT_JPEG. Returns * ImageFormat.IMAGE_FORMAT_UNKNOWN if the image type cannot be * determined. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static ImageFormat guessFormat(final File file) throws ImageReadException, IOException { @@ -359,8 +355,6 @@ else if (compareBytePair(MAGIC_NUMBERS_PNG, bytePair)) { * Byte array containing an image file. * @return An instance of ICC_Profile or null if the image contains no ICC * profile. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static ICC_Profile getICCProfile(final byte[] bytes) throws ImageReadException, IOException { @@ -378,8 +372,6 @@ public static ICC_Profile getICCProfile(final byte[] bytes) * Optional parameters, defined in ImagingParameters. * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static ICC_Profile getICCProfile(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { @@ -397,8 +389,6 @@ public static ICC_Profile getICCProfile(final byte[] bytes, final ImagingParamet * Filename associated with image data (optional). * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static ICC_Profile getICCProfile(final InputStream is, final String filename) throws ImageReadException, IOException { @@ -418,8 +408,6 @@ public static ICC_Profile getICCProfile(final InputStream is, final String filen * Optional parameters, defined in ImagingParameters. * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static ICC_Profile getICCProfile(final InputStream is, final String filename, final ImagingParameters params) throws ImageReadException, IOException { @@ -435,8 +423,6 @@ public static ICC_Profile getICCProfile(final InputStream is, final String filen * File containing image data. * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static ICC_Profile getICCProfile(final File file) throws ImageReadException, IOException { @@ -454,8 +440,6 @@ public static ICC_Profile getICCProfile(final File file) * Optional parameters, defined in ImagingParameters. * @return An instance of ICC_Profile or null if the image contains no ICC * profile.. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static ICC_Profile getICCProfile(final File file, final ImagingParameters params) throws ImageReadException, IOException { @@ -492,8 +476,6 @@ protected static ICC_Profile getICCProfile(final ByteSource byteSource, final Im * @param bytes * Byte array containing an image file. * @return A byte array. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see IccProfileParser * @see ICC_Profile */ @@ -515,8 +497,6 @@ public static byte[] getICCProfileBytes(final byte[] bytes) * @param params * Optional parameters, defined in ImagingParameters. * @return A byte array. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see IccProfileParser * @see ICC_Profile */ @@ -536,8 +516,6 @@ public static byte[] getICCProfileBytes(final byte[] bytes, final ImagingParamet * @param file * File containing image data. * @return A byte array. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see IccProfileParser * @see ICC_Profile */ @@ -559,8 +537,6 @@ public static byte[] getICCProfileBytes(final File file) * @param params * Optional parameters, defined in ImagingParameters. * @return A byte array. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see IccProfileParser * @see ICC_Profile */ @@ -592,8 +568,6 @@ private static byte[] getICCProfileBytes(final ByteSource byteSource, final Imag * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of ImageInfo. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final String filename, final byte[] bytes, @@ -615,8 +589,6 @@ public static ImageInfo getImageInfo(final String filename, final byte[] bytes, * @param bytes * Byte array containing an image file. * @return An instance of ImageInfo. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final String filename, final byte[] bytes) @@ -638,8 +610,6 @@ public static ImageInfo getImageInfo(final String filename, final byte[] bytes) * @param filename * Filename associated with image data (optional). * @return An instance of ImageInfo. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final InputStream is, final String filename) @@ -663,8 +633,6 @@ public static ImageInfo getImageInfo(final InputStream is, final String filename * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of ImageInfo. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final InputStream is, final String filename, @@ -684,8 +652,6 @@ public static ImageInfo getImageInfo(final InputStream is, final String filename * @param bytes * Byte array containing an image file. * @return An instance of ImageInfo. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final byte[] bytes) @@ -707,8 +673,6 @@ public static ImageInfo getImageInfo(final byte[] bytes) * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of ImageInfo. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final byte[] bytes, final ImagingParameters params) @@ -730,8 +694,6 @@ public static ImageInfo getImageInfo(final byte[] bytes, final ImagingParameters * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of ImageInfo. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final File file, final ImagingParameters params) @@ -751,8 +713,6 @@ public static ImageInfo getImageInfo(final File file, final ImagingParameters pa * @param file * File containing image data. * @return An instance of ImageInfo. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see ImageInfo */ public static ImageInfo getImageInfo(final File file) throws ImageReadException, @@ -804,8 +764,6 @@ private static ImageParser getImageParser(final ByteSource byteSource) * @param filename * Filename associated with image data (optional). * @return The width and height of the image. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static Dimension getImageSize(final InputStream is, final String filename) throws ImageReadException, IOException { @@ -823,8 +781,6 @@ public static Dimension getImageSize(final InputStream is, final String filename * @param params * Optional parameters, defined in ImagingParameters. * @return The width and height of the image. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static Dimension getImageSize(final InputStream is, final String filename, final ImagingParameters params) throws ImageReadException, IOException { @@ -838,8 +794,6 @@ public static Dimension getImageSize(final InputStream is, final String filename * @param bytes * Byte array containing an image file. * @return The width and height of the image. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static Dimension getImageSize(final byte[] bytes) throws ImageReadException, IOException { @@ -855,8 +809,6 @@ public static Dimension getImageSize(final byte[] bytes) * @param params * Optional parameters, defined in ImagingParameters. * @return The width and height of the image. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static Dimension getImageSize(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { @@ -870,8 +822,6 @@ public static Dimension getImageSize(final byte[] bytes, final ImagingParameters * @param file * File containing image data. * @return The width and height of the image. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static Dimension getImageSize(final File file) throws ImageReadException, IOException { @@ -887,8 +837,6 @@ public static Dimension getImageSize(final File file) throws ImageReadException, * @param params * Optional parameters, defined in ImagingParameters. * @return The width and height of the image. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static Dimension getImageSize(final File file, final ImagingParameters params) throws ImageReadException, IOException { @@ -911,8 +859,6 @@ public static Dimension getImageSize(final ByteSource byteSource, final ImagingP * @param filename * Filename associated with image data (optional). * @return Xmp Xml as String, if present. Otherwise, returns null. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static String getXmpXml(final InputStream is, final String filename) throws ImageReadException, IOException { @@ -930,8 +876,6 @@ public static String getXmpXml(final InputStream is, final String filename) * @param params * Optional parameters, defined in ImagingParameters. * @return Xmp Xml as String, if present. Otherwise, returns null. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static String getXmpXml(final InputStream is, final String filename, final ImagingParameters params) throws ImageReadException, IOException { @@ -945,8 +889,6 @@ public static String getXmpXml(final InputStream is, final String filename, fina * @param bytes * Byte array containing an image file. * @return Xmp Xml as String, if present. Otherwise, returns null. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static String getXmpXml(final byte[] bytes) throws ImageReadException, IOException { @@ -962,8 +904,6 @@ public static String getXmpXml(final byte[] bytes) throws ImageReadException, * @param params * Optional parameters, defined in ImagingParameters. * @return Xmp Xml as String, if present. Otherwise, returns null. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static String getXmpXml(final byte[] bytes, final ImagingParameters params) throws ImageReadException, IOException { @@ -977,8 +917,6 @@ public static String getXmpXml(final byte[] bytes, final ImagingParameters param * @param file * File containing image data. * @return Xmp Xml as String, if present. Otherwise, returns null. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static String getXmpXml(final File file) throws ImageReadException, IOException { @@ -994,8 +932,6 @@ public static String getXmpXml(final File file) throws ImageReadException, * @param params * Optional parameters, defined in ImagingParameters. * @return Xmp Xml as String, if present. Otherwise, returns null. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static String getXmpXml(final File file, final ImagingParameters params) throws ImageReadException, IOException { @@ -1011,8 +947,6 @@ public static String getXmpXml(final File file, final ImagingParameters params) * @param params * Optional parameters, defined in ImagingParameters. * @return Xmp Xml as String, if present. Otherwise, returns null. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException */ public static String getXmpXml(final ByteSource byteSource, final ImagingParameters params) throws ImageReadException, IOException { @@ -1037,8 +971,6 @@ public static String getXmpXml(final ByteSource byteSource, final ImagingParamet * @param bytes * Byte array containing an image file. * @return An instance of IImageMetadata. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final byte[] bytes) @@ -1064,8 +996,6 @@ public static ImageMetadata getMetadata(final byte[] bytes) * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of IImageMetadata. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final byte[] bytes, final ImagingParameters params) @@ -1091,8 +1021,6 @@ public static ImageMetadata getMetadata(final byte[] bytes, final ImagingParamet * @param filename * Filename associated with image data (optional). * @return An instance of IImageMetadata. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final InputStream is, final String filename) @@ -1120,8 +1048,6 @@ public static ImageMetadata getMetadata(final InputStream is, final String filen * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of IImageMetadata. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final InputStream is, final String filename, @@ -1145,8 +1071,6 @@ public static ImageMetadata getMetadata(final InputStream is, final String filen * @param file * File containing image data. * @return An instance of IImageMetadata. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final File file) @@ -1172,8 +1096,6 @@ public static ImageMetadata getMetadata(final File file) * @param params * Optional parameters, defined in ImagingParameters. * @return An instance of IImageMetadata. - * @throws org.apache.commons.imaging.ImageReadException - * @throws java.io.IOException * @see org.apache.commons.imaging.common.ImageMetadata */ public static ImageMetadata getMetadata(final File file, final ImagingParameters params) @@ -1268,9 +1190,6 @@ private static FormatCompliance getFormatCompliance(final ByteSource byteSource) * Gets all images specified by the InputStream (some * formats may include multiple images within a single data source). * @param is A valid InputStream - * @param filename used to hint the filename when reading from a byte array - * or InputStream. The filename hint can help disambiguate what file the - * image format. * @return A valid (potentially empty) list of BufferedImage objects. * @throws ImageReadException In the event that the the specified * content does not conform to the format of the specific parser From 43e44315a03e789c7c9e666f2987ac909e826127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 23 Feb 2015 22:21:29 +0100 Subject: [PATCH 166/179] doc --- src/main/java/org/apache/commons/imaging/ImagingParameters.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 25a3c8b27e..2f078c4b03 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -20,7 +20,7 @@ import org.apache.commons.imaging.common.BufferedImageFactory; /** - * This class is a POJO holding data for parameters as requested in IMAGING-159. + * This class is a POJO holding data for parameters. * It holds data needed for all image formats. For data needed only by one * particular format there are inherited classes. *

From 8639f88ef5fd4389f578860766cedc19c369a678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 23 Feb 2015 22:22:27 +0100 Subject: [PATCH 167/179] doc --- .../commons/imaging/ImagingParameters.java | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 2f078c4b03..b5e0e64243 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -23,24 +23,6 @@ * This class is a POJO holding data for parameters. * It holds data needed for all image formats. For data needed only by one * particular format there are inherited classes. - *

- * There are two kinds of parameters: with and without default value. For - * parameters without default value it implements lazy initialization: - *
- * After getting an instance there is no value present. In this state accessing - * the value with getX() in this state will cause a RuntimeException. - * There is always a isXPresent() method for this parameter which returns - * {@code false} in this state. - *
- * Once you provided a value using setX() you may access this value with getX(). - * The isXPresent() method will return {@code true} now. - *

- * Other parameters have a default value. This is told in the javadoc for their - * getX() method. They don't have a isXPresent() method. You may access them any time. - *

- * All boolean parameters have default parameters. Their setter and getter have a different - * naming scheme: enableX() causes isXEnabled() to return {@code true} while - * disableX() causes isXEnabled() to return {@code false}. */ public class ImagingParameters { From 832402a11faf5070e3ddf1b0b81389cc0a32341a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 23 Feb 2015 22:28:06 +0100 Subject: [PATCH 168/179] doc --- .../commons/imaging/ImagingParameters.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index b5e0e64243..9d8d63fc3e 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -20,9 +20,27 @@ import org.apache.commons.imaging.common.BufferedImageFactory; /** - * This class is a POJO holding data for parameters. + * This class is a POJO holding data for parameters as requested in IMAGING-159. * It holds data needed for all image formats. For data needed only by one * particular format there are inherited classes. + *

+ * There are two kinds of parameters: with and without default value. For + * parameters without default value it implements lazy initialization: + *
+ * After getting an instance there is no value present. Accessing + * the value with getX() in this state will cause a RuntimeException. + * There is always a isXPresent() method for this parameter which returns + * {@code false} in this state. + *
+ * Once you provided a value using setX() you may access this value with getX(). + * The isXPresent() method will return {@code true} now. + *

+ * Other parameters have a default value. This is told in the javadoc for their + * getX() method. They don't have a isXPresent() method. You may access them any time. + *

+ * All boolean parameters have default values. Their setter and getter have a different + * naming scheme: enableX() causes isXEnabled() to return {@code true} while + * disableX() causes isXEnabled() to return {@code false}. */ public class ImagingParameters { From 5d03d43baccad8c137189d537b291932f03a5cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 23 Feb 2015 22:29:15 +0100 Subject: [PATCH 169/179] doc --- .../commons/imaging/ImagingParameters.java | 14 ++++++------- .../imaging/ImagingParametersJpeg.java | 2 +- .../imaging/ImagingParametersTiff.java | 20 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 9d8d63fc3e..f5c3a667e7 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -44,19 +44,19 @@ */ public class ImagingParameters { - private boolean verbose; //PARAM_KEY_VERBOSE + private boolean verbose; - private boolean strict; // PARAM_KEY_STRICT + private boolean strict; - private String fileNameHint; // PARAM_KEY_FILENAME + private String fileNameHint; - private String xmpXmlAsString; // PARAM_KEY_XMP_XML + private String xmpXmlAsString; - private ImageFormat imageFormat; // PARAM_KEY_FORMAT + private ImageFormat imageFormat; - private BufferedImageFactory bufferedImageFactory; // BUFFERED_IMAGE_FACTORY + private BufferedImageFactory bufferedImageFactory; - private PixelDensity pixelDensity; // PARAM_KEY_PIXEL_DENSITY + private PixelDensity pixelDensity; /** * This gives you a parameter object with default values. diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index 868a2ef13c..6110f28683 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -23,7 +23,7 @@ */ public final class ImagingParametersJpeg extends ImagingParameters { - private boolean readThumbnailsValue; // PARAM_KEY_READ_THUMBNAILS + private boolean readThumbnailsValue; /** * This gives you a parameter object with default values. diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 050f47cba1..48af9e6881 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -25,25 +25,25 @@ */ public final class ImagingParametersTiff extends ImagingParameters { - private Integer compressionLevel; // PARAM_KEY_COMPRESSION + private Integer compressionLevel; - private Integer compressionBlockSize; // PARAM_KEY_LZW_COMPRESSION_BLOCK_SIZE + private Integer compressionBlockSize; - private TiffOutputSet outputSetForMetaData; // PARAM_KEY_EXIF + private TiffOutputSet outputSetForMetaData; - private boolean readThumbnails; // PARAM_KEY_READ_THUMBNAILS + private boolean readThumbnails; - private Integer t4options; // PARAM_KEY_T4_OPTIONS + private Integer t4options; - private Integer t6options; // PARAM_KEY_T6_OPTIONS + private Integer t6options; - private Integer subImageX; // PARAM_KEY_SUBIMAGE_X + private Integer subImageX; - private Integer subImageY; // PARAM_KEY_SUBIMAGE_Y + private Integer subImageY; - private Integer subImageWidth; // PARAM_KEY_SUBIMAGE_WIDTH + private Integer subImageWidth; - private Integer subImageHeight; // PARAM_KEY_SUBIMAGE_HEIGHT + private Integer subImageHeight; /** From 9521624a751d88aaf423154937910f4497d8e37b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 23 Feb 2015 22:37:38 +0100 Subject: [PATCH 170/179] set missing default values --- .../apache/commons/imaging/ImagingParametersTiff.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 48af9e6881..a5286d30bb 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -53,6 +53,13 @@ public ImagingParametersTiff() { this.compressionLevel = null; this.compressionBlockSize = null; this.outputSetForMetaData = null; + this.readThumbnails = false; + this.t4options = null; + this.t6options = null; + this.subImageX = null; + this.subImageY = null; + this.subImageWidth = null; + this.subImageHeight = null; } //****** compressionLevel ****** @@ -176,7 +183,7 @@ public void setOutputSet(final TiffOutputSet value) { * @return Valid values:{@code true} (causes it to read embedded thumbnails * and {@code false} (don't read embedded thumbnails). */ - public boolean getReadThumbnails() { + public boolean isReadThumbnailsEnabled() { return this.readThumbnails; } From 405eab0d000b19651fbfee8e6e788a8c66235ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 23 Feb 2015 22:38:19 +0100 Subject: [PATCH 171/179] shortened field name --- .../apache/commons/imaging/ImagingParametersJpeg.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index 6110f28683..d5aa585e79 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -23,13 +23,13 @@ */ public final class ImagingParametersJpeg extends ImagingParameters { - private boolean readThumbnailsValue; + private boolean readThumbnails; /** * This gives you a parameter object with default values. */ public ImagingParametersJpeg() { - this.readThumbnailsValue = false; + this.readThumbnails = false; } //****** readThumbnails ****** @@ -44,7 +44,7 @@ public ImagingParametersJpeg() { * and {@code false} (don't read embedded thumbnails, default value). */ public boolean isReadThumbnailsEnabled() { - return this.readThumbnailsValue; + return this.readThumbnails; } /** @@ -53,7 +53,7 @@ public boolean isReadThumbnailsEnabled() { * Only applies to read EXIF metadata from JPEG/JFIF files. */ public void enableReadThumbnails() { - this.readThumbnailsValue = true; + this.readThumbnails = true; } /** @@ -62,6 +62,6 @@ public void enableReadThumbnails() { * Only applies to read EXIF metadata from JPEG/JFIF files. */ public void disableReadThumbnails() { - this.readThumbnailsValue = false; + this.readThumbnails = false; } } From a1eaf9cb619d2eda8dc20d5c61efb1524b4afe34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 23 Feb 2015 22:38:40 +0100 Subject: [PATCH 172/179] renamed method --- .../org/apache/commons/imaging/formats/tiff/TiffReader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java index 521fcf209b..424e3f5f23 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java @@ -314,7 +314,7 @@ public Collector(final ImagingParameters params) { if (params != null) { if (params instanceof ImagingParametersTiff) { final ImagingParametersTiff paramsTiff = (ImagingParametersTiff) params; - tmpReadThumbnails = paramsTiff.getReadThumbnails(); + tmpReadThumbnails = paramsTiff.isReadThumbnailsEnabled(); } } this.readThumbnails = tmpReadThumbnails; From 99bc27e554a93a3ca0104a6de8ba6f5d28603819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 23 Feb 2015 22:53:14 +0100 Subject: [PATCH 173/179] set parameter name in error message --- .../java/org/apache/commons/imaging/ImagingParametersTiff.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index a5286d30bb..f9214cc823 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -171,7 +171,7 @@ public TiffOutputSet getOutputSet() { * @param value Valid values: TiffOutputSet to write into the image's EXIF metadata. */ public void setOutputSet(final TiffOutputSet value) { - checkIfValueIsNull(value); + checkIfValueIsNull(value, "outputSet"); this.outputSetForMetaData = value; } From ef43d0a52e8dc2344e1a6cdf022b3d664d1dd492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 23 Feb 2015 22:53:22 +0100 Subject: [PATCH 174/179] set parameter name in error message --- .../apache/commons/imaging/ImagingParameters.java | 14 +++++++------- .../commons/imaging/ImagingParametersPng.java | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index f5c3a667e7..a156576ee7 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -172,7 +172,7 @@ public String getFileNameHint() { * @see java.io.InputStream */ public void setFileNameHint(final String value) { - checkIfValueIsNull(value); + checkIfValueIsNull(value, "fileNameHint"); this.fileNameHint = value; } @@ -207,7 +207,7 @@ public String getXmpXmlAsString() { * @param value Valid values: String of XMP XML. */ public void setXmpXmlAsString(final String value) { - checkIfValueIsNull(value); + checkIfValueIsNull(value, "xmpXmlAsString"); this.xmpXmlAsString = value; } @@ -238,7 +238,7 @@ public ImageFormat getImageFormat() { * ImageFormat.IMAGE_FORMAT_PNG. */ public void setImageFormat(final ImageFormat value) { - checkIfValueIsNull(value); + checkIfValueIsNull(value, "imageFormat"); this.imageFormat = value; } @@ -267,7 +267,7 @@ public BufferedImageFactory getBufferedImageFactory() { * @param value A BufferedImageFactory */ public void setBufferedImageFactory(final BufferedImageFactory value) { - checkIfValueIsNull(value); + checkIfValueIsNull(value, "bufferedImageFactory"); this.bufferedImageFactory = value; } @@ -302,7 +302,7 @@ public PixelDensity getPixelDensity() { * @see org.apache.commons.imaging.PixelDensity */ public void setPixelDensity(final PixelDensity value) { - checkIfValueIsNull(value); + checkIfValueIsNull(value, "pixelDensity"); this.pixelDensity = value; } @@ -312,9 +312,9 @@ public void setPixelDensity(final PixelDensity value) { * Throws a RuntimeException if a given value is {code null}. * @param value */ - final void checkIfValueIsNull(final Object value) { + final void checkIfValueIsNull(final Object value, final String parameterName) { if (value == null) { - throw new IllegalArgumentException("The value for any parameter must not null."); + throw new IllegalArgumentException("The value for the parameter " + parameterName + " must not null."); } } diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java index 3069010a96..79533422a6 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java @@ -146,7 +146,7 @@ public List getTextChunks() { * @param textChunks the text chunks */ public void setTextChunks(final List textChunks) { - checkIfValueIsNull(textChunks); + checkIfValueIsNull(textChunks, "textChunks"); this.textChunks = textChunks; } } From c27bc68550ee91a3e91846596af337a8070251a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Mon, 23 Feb 2015 23:02:25 +0100 Subject: [PATCH 175/179] added tests --- .../imaging/ImagingParametersTest.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/test/java/org/apache/commons/imaging/ImagingParametersTest.java diff --git a/src/test/java/org/apache/commons/imaging/ImagingParametersTest.java b/src/test/java/org/apache/commons/imaging/ImagingParametersTest.java new file mode 100644 index 0000000000..b46557359c --- /dev/null +++ b/src/test/java/org/apache/commons/imaging/ImagingParametersTest.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.imaging; + +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * Tests for ImagingParameters. + */ +public final class ImagingParametersTest { + /** + * Test if an exception is thrown if the provided value is null. + */ + @Test(expected=IllegalArgumentException.class) + public void testCheckIfValueIsNull() { + ImagingParameters ip = new ImagingParameters(); + ip.setFileNameHint(null); + } + + /** + * Test the exception thrown if the provided value is null + * provides the parameter name. + */ + @Test + public void testCheckIfValueIsNullMsg() { + ImagingParameters ip = new ImagingParameters(); + try { + ip.setFileNameHint(null); + } + catch (IllegalArgumentException ex) { + assertEquals("The value for the parameter fileNameHint must not null.", ex.getLocalizedMessage()); + } + } + + /** + * Test if an exception is thrown if the parameter is accessed before a value was provided. + */ + @Test(expected=IllegalStateException.class) + public void testCheckIfParameterIsPresent() { + ImagingParameters ip = new ImagingParameters(); + ip.getFileNameHint(); + } +} \ No newline at end of file From 381797666637d47d1af18499cbe6401729e797a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Tue, 24 Feb 2015 17:01:46 +0100 Subject: [PATCH 176/179] added more tests --- .../imaging/ImagingParametersTest.java | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/apache/commons/imaging/ImagingParametersTest.java b/src/test/java/org/apache/commons/imaging/ImagingParametersTest.java index b46557359c..3ee9e971b8 100644 --- a/src/test/java/org/apache/commons/imaging/ImagingParametersTest.java +++ b/src/test/java/org/apache/commons/imaging/ImagingParametersTest.java @@ -25,20 +25,20 @@ */ public final class ImagingParametersTest { /** - * Test if an exception is thrown if the provided value is null. + * Asserts that an exception is thrown if the provided value is null. */ @Test(expected=IllegalArgumentException.class) - public void testCheckIfValueIsNull() { + public void testCheckIfValueIsNull01() { ImagingParameters ip = new ImagingParameters(); ip.setFileNameHint(null); } /** - * Test the exception thrown if the provided value is null + * Test if the exception thrown if the provided value is null * provides the parameter name. */ @Test - public void testCheckIfValueIsNullMsg() { + public void testCheckIfValueIsNull02() { ImagingParameters ip = new ImagingParameters(); try { ip.setFileNameHint(null); @@ -49,11 +49,31 @@ public void testCheckIfValueIsNullMsg() { } /** - * Test if an exception is thrown if the parameter is accessed before a value was provided. + * Asserts that no exception is thrown if the provided value is not null. + */ + @Test + public void testCheckIfValueIsNull03() { + ImagingParameters ip = new ImagingParameters(); + ip.setFileNameHint("Teststring"); + assertEquals("Teststring", ip.getFileNameHint()); + } + + /** + * Asserts that an exception is thrown if the parameter is accessed before a value was provided. */ @Test(expected=IllegalStateException.class) - public void testCheckIfParameterIsPresent() { + public void testCheckIfParameterIsPresent01() { ImagingParameters ip = new ImagingParameters(); ip.getFileNameHint(); } + + /** + * Asserts that no exception is thrown if the parameter is accessed after a value was provided. + */ + @Test + public void testCheckIfParameterIsPresent02() { + ImagingParameters ip = new ImagingParameters(); + ip.setFileNameHint("Teststring"); + assertEquals("Teststring", ip.getFileNameHint()); + } } \ No newline at end of file From 862469e9dfa8c7b3671a94df3ecde0373598c39f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Tue, 24 Feb 2015 17:37:31 +0100 Subject: [PATCH 177/179] implemented plain setters even for boolean values --- .../apache/commons/imaging/ImageParser.java | 2 +- .../commons/imaging/ImagingParameters.java | 32 +++++------------ .../imaging/ImagingParametersJpeg.java | 17 +++------ .../commons/imaging/ImagingParametersPng.java | 36 +++++++------------ .../commons/imaging/ImagingParametersPnm.java | 17 ++++----- .../imaging/ImagingParametersTiff.java | 15 +++----- .../imaging/formats/bmp/BmpImageParser.java | 6 ++-- .../imaging/formats/gif/GifImageParser.java | 2 +- .../imaging/formats/jpeg/JpegImageParser.java | 2 +- .../imaging/formats/jpeg/iptc/IptcParser.java | 4 +-- .../imaging/formats/pcx/PcxImageParser.java | 2 +- .../imaging/formats/png/PngWriter.java | 6 ++-- .../imaging/formats/pnm/PnmImageParser.java | 2 +- .../imaging/formats/tiff/TiffReader.java | 2 +- .../bytesource/ByteSourceImageTest.java | 4 +-- .../imaging/examples/ImageReadExample.java | 2 +- .../imaging/formats/jpeg/JpegReadTest.java | 2 +- .../formats/jpeg/exif/ExifDumpTest.java | 2 +- .../imaging/formats/jpeg/exif/GpsTest.java | 2 +- .../jpeg/exif/SpecificExifTagTest.java | 2 +- .../formats/jpeg/iptc/IptcAddTest.java | 2 +- .../formats/jpeg/iptc/IptcDumpTest.java | 2 +- .../formats/jpeg/iptc/IptcUpdateTest.java | 8 ++--- .../formats/png/ConvertPngToGifTest.java | 2 +- .../png/PngWriteForceTrueColorText.java | 2 +- .../imaging/formats/png/PngWriteReadTest.java | 2 +- 26 files changed, 67 insertions(+), 110 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImageParser.java b/src/main/java/org/apache/commons/imaging/ImageParser.java index 4f2777d93a..758d4cb730 100644 --- a/src/main/java/org/apache/commons/imaging/ImageParser.java +++ b/src/main/java/org/apache/commons/imaging/ImageParser.java @@ -963,6 +963,6 @@ public static boolean isStrict(final ImagingParameters params) { if (params == null) { return false; } - return params.isStrictEnabled(); + return params.getStrict(); } } diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index a156576ee7..f4e86c0ba1 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -79,24 +79,17 @@ public ImagingParameters() { * @return Valid values: {@code true} means {@literal "verbose mode enabled"} * and {@code false} means {@literal "verbose mode disabled"} (default value). */ - public boolean isVerboseEnabled() { + public boolean getVerbose() { return this.verbose; } /** * Turns the verbose mode on. * Parameter applies to read and write operations. + * @param value {@code true} = verbose mode on; {@code false} = verbose mode off */ - public void enableVerbose() { - this.verbose = true; - } - - /** - * Turns the verbose mode off. - * Parameter applies to read and write operations. - */ - public void disableVerbose() { - this.verbose = false; + public void setVerbose(final boolean value) { + this.verbose = value; } //****** strict ****** @@ -109,7 +102,7 @@ public void disableVerbose() { * (default value) * @see org.apache.commons.imaging.formats.tiff.constants.TiffConstants */ - public boolean isStrictEnabled() { + public boolean getStrict() { return this.strict; } @@ -118,19 +111,10 @@ public boolean isStrictEnabled() { * files, or whether to tolerate small problems. * This method switches the behavior so that it throws exceptions when * parsing invalid files. + * @param value {@code true} = strict mode on; {@code false} = strict mode off */ - public void enableStrict() { - this.strict = true; - } - - /** - * Parameter indicates whether to throw exceptions when parsing invalid - * files, or whether to tolerate small problems. - * This method switches the behavior so that it tolerates small problems. - * - */ - public void disableStrict() { - this.strict = false; + public void setStrict(final boolean value) { + this.strict = value; } //****** fileNameHint ****** diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java index d5aa585e79..e6bcb99da2 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersJpeg.java @@ -43,7 +43,7 @@ public ImagingParametersJpeg() { * @return Valid values:{@code true} (causes it to read embedded thumbnails * and {@code false} (don't read embedded thumbnails, default value). */ - public boolean isReadThumbnailsEnabled() { + public boolean getReadThumbnails() { return this.readThumbnails; } @@ -51,17 +51,10 @@ public boolean isReadThumbnailsEnabled() { * Call this method to indicate to read embedded thumbnails. *

* Only applies to read EXIF metadata from JPEG/JFIF files. + * @param value {@code true} = read embedded thumbnails; + * {@code false} = don't read embedded thumbnails */ - public void enableReadThumbnails() { - this.readThumbnails = true; - } - - /** - * Call this method to indicate not to read embedded thumbnails. - *

- * Only applies to read EXIF metadata from JPEG/JFIF files. - */ - public void disableReadThumbnails() { - this.readThumbnails = false; + public void setReadThumbnails(final boolean value) { + this.readThumbnails = value; } } diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java index 79533422a6..89c1d444de 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPng.java @@ -69,7 +69,7 @@ public void setBitDepth(final byte value) { this.bitDepth = value; } - // ****** isForceIndexedColorEnabled ****** + // ****** getForceIndexedColor ****** /** * {@code true} = force indexed color; {@code false} = don't force indexed color @@ -77,25 +77,20 @@ public void setBitDepth(final byte value) { * Default value: {@code false} * @return */ - public boolean isForceIndexedColorEnabled() { + public boolean getForceIndexedColor() { return this.forceIndexedColor; } /** * force indexed color + * @param value {@code true} = force indexed color; + * {@code false} = don't force indexed color */ - public void enableForceIndexedColor() { - this.forceIndexedColor = true; + public void setForceIndexedColor(final boolean value) { + this.forceIndexedColor = value; } - /** - * don't force indexed color - */ - public void disableForceIndexedColor() { - this.forceIndexedColor = false; - } - - // ****** isForceTrueColorEnabled ****** + // ****** getForceTrueColor ****** /** * {@code true} = force true color; {@code false} = don't force true color @@ -103,22 +98,17 @@ public void disableForceIndexedColor() { * Default value: {@code false} * @return */ - public boolean isForceTrueColorEnabled() { + public boolean getForceTrueColor() { return this.forceTrueColor; } /** - * force indexed color + * force true color + * @param value {@code true} = force true color; + * {@code false} = don't force true color */ - public void enableForceTrueColor() { - this.forceTrueColor = true; - } - - /** - * don't force indexed color - */ - public void disableForceTrueColor() { - this.forceTrueColor = false; + public void setForceTrueColor(final boolean value) { + this.forceTrueColor = value; } //****** textChunks ****** diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java b/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java index aa98af518b..17cf4a782f 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersPnm.java @@ -32,7 +32,7 @@ public ImagingParametersPnm() { this.useRawbits = true; } - // ****** isUseRawbitsEnabled ****** + // ****** getUseRawbits ****** /** * {@code true} = use raw bits; {@code false} = don't use raw bits @@ -40,21 +40,16 @@ public ImagingParametersPnm() { * Default value: {@code false} * @return */ - public boolean isUseRawbitsEnabled() { + public boolean getUseRawbits() { return this.useRawbits; } /** * use raw bits + * @param value value {@code true} = use raw bits; + * {@code false} = don't use raw bits */ - public void enableUseRawbits() { - this.useRawbits = true; - } - - /** - * don't use raw bits - */ - public void disableUseRawbits() { - this.useRawbits = false; + public void setUseRawbits(final boolean value) { + this.useRawbits = value; } } diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index f9214cc823..00dc476228 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -183,22 +183,17 @@ public void setOutputSet(final TiffOutputSet value) { * @return Valid values:{@code true} (causes it to read embedded thumbnails * and {@code false} (don't read embedded thumbnails). */ - public boolean isReadThumbnailsEnabled() { + public boolean getReadThumbnails() { return this.readThumbnails; } /** * Call this method to indicate to read embedded thumbnails. + * @param value {@code true} = read embedded thumbnails; + * {@code false} = don't read embedded thumbnails */ - public void enableReadThumbnails() { - this.readThumbnails = true; - } - - /** - * Call this method to indicate not to read embedded thumbnails. - */ - public void disableReadThumbnails() { - this.readThumbnails = false; + public void setReadThumbnails(final boolean value) { + this.readThumbnails = value; } //****** t4 options ****** diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java index 57ce95539a..6091e9b770 100644 --- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java @@ -494,7 +494,7 @@ public Dimension getImageSize(final ByteSource byteSource, final ImagingParamete throws ImageReadException, IOException { // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; - final boolean verbose = parameters.isVerboseEnabled(); + final boolean verbose = parameters.getVerbose(); final BmpHeaderInfo bhi = readBmpHeaderInfo(byteSource, verbose); @@ -543,7 +543,7 @@ public ImageInfo getImageInfo(final ByteSource byteSource, final ImagingParamete // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; - final boolean verbose = parameters.isVerboseEnabled(); + final boolean verbose = parameters.getVerbose(); InputStream is = null; ImageContents ic = null; @@ -663,7 +663,7 @@ public BufferedImage getBufferedImage(final InputStream inputStream, final Imagi // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; - final boolean verbose = parameters.isVerboseEnabled(); + final boolean verbose = parameters.getVerbose(); final ImageContents ic = readImageContents(inputStream, FormatCompliance.getDefault(), verbose); diff --git a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java index f83227a467..85d3aab824 100644 --- a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java @@ -759,7 +759,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; - final boolean verbose = parameters.isVerboseEnabled(); + final boolean verbose = parameters.getVerbose(); final String xmpXml = (parameters.isXmpXmlAsStringPresent()) ? parameters.getXmpXmlAsString(): null; final int width = src.getWidth(); diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java index f0314597a3..7629096a9e 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java @@ -350,7 +350,7 @@ public TiffImageMetadata getExifMetadata(final ByteSource byteSource, final Imag if (params == null) { ImagingParametersJpeg jpegParameters; jpegParameters = new ImagingParametersJpeg(); - jpegParameters.enableReadThumbnails(); + jpegParameters.setReadThumbnails(true); parameters = jpegParameters; } else { diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java index 9f3109bbc5..3995a8320d 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java @@ -100,8 +100,8 @@ public PhotoshopApp13Data parsePhotoshopSegment(final byte[] bytes, final Imagin // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; - final boolean strict = parameters.isStrictEnabled(); - final boolean verbose = parameters.isVerboseEnabled(); + final boolean strict = parameters.getStrict(); + final boolean verbose = parameters.getVerbose(); return parsePhotoshopSegment(bytes, verbose, strict); } diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java index 4abc2b22a9..788083bbd3 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java @@ -516,7 +516,7 @@ public final BufferedImage getBufferedImage(final ByteSource byteSource, // ensure that the parameter object is not null final ImagingParameters parameters = (params == null) ? new ImagingParameters() : params; - boolean isStrict = parameters.isStrictEnabled(); + boolean isStrict = parameters.getStrict(); InputStream is = null; boolean canThrow = false; diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java index 5e2723445c..9100d1e46e 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java @@ -42,7 +42,7 @@ public PngWriter(final boolean verbose) { } public PngWriter(final ImagingParameters params) { - this.verbose = params != null && Boolean.TRUE.equals(params.isVerboseEnabled()); + this.verbose = params != null && Boolean.TRUE.equals(params.getVerbose()); } /* @@ -395,8 +395,8 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima if (parameters instanceof ImagingParametersPng) { final ImagingParametersPng parametersPng = (ImagingParametersPng) parameters; - forceIndexedColor = parametersPng.isForceIndexedColorEnabled(); - forceTrueColor = parametersPng.isForceTrueColorEnabled(); + forceIndexedColor = parametersPng.getForceIndexedColor(); + forceTrueColor = parametersPng.getForceTrueColor(); } // only generic parameters are provided so we need to use default values // for PNG format specific parameters diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java index 287750074e..4ff1b4d460 100644 --- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java @@ -329,7 +329,7 @@ public void writeImage(final BufferedImage src, final OutputStream os, final Ima // read parameters specific for the PNM format if (params instanceof ImagingParametersPnm) { final ImagingParametersPnm paramsPnm = (ImagingParametersPnm) params; - useRawbits = paramsPnm.isUseRawbitsEnabled(); + useRawbits = paramsPnm.getUseRawbits(); } } diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java index 424e3f5f23..521fcf209b 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java @@ -314,7 +314,7 @@ public Collector(final ImagingParameters params) { if (params != null) { if (params instanceof ImagingParametersTiff) { final ImagingParametersTiff paramsTiff = (ImagingParametersTiff) params; - tmpReadThumbnails = paramsTiff.isReadThumbnailsEnabled(); + tmpReadThumbnails = paramsTiff.getReadThumbnails(); } } this.readThumbnails = tmpReadThumbnails; diff --git a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java index 81a8057f0b..7d4d867d4f 100644 --- a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java +++ b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java @@ -175,12 +175,12 @@ public void checkGetImageInfo(final File imageFile, final byte[] imageFileBytes) final ImageFormat imageFormat = Imaging.guessFormat(imageFile); if (imageFormat.equals(ImageFormats.TIFF)) { final ImagingParametersTiff paramsTiff = new ImagingParametersTiff(); - if (ignoreImageData == false) paramsTiff.enableReadThumbnails(); + if (ignoreImageData == false) paramsTiff.setReadThumbnails(true); params = paramsTiff; } else if (imageFormat.equals(ImageFormats.JPEG)) { final ImagingParametersJpeg paramsJpeg = new ImagingParametersJpeg(); - if (ignoreImageData == false) paramsJpeg.enableReadThumbnails(); + if (ignoreImageData == false) paramsJpeg.setReadThumbnails(true); params = paramsJpeg; } else { diff --git a/src/test/java/org/apache/commons/imaging/examples/ImageReadExample.java b/src/test/java/org/apache/commons/imaging/examples/ImageReadExample.java index 60f2a1baca..d8c432dadb 100644 --- a/src/test/java/org/apache/commons/imaging/examples/ImageReadExample.java +++ b/src/test/java/org/apache/commons/imaging/examples/ImageReadExample.java @@ -34,7 +34,7 @@ public static BufferedImage imageReadExample(final File file) // set optional parameters if you like params.setBufferedImageFactory(new ManagedImageBufferedImageFactory()); - // params.enableVerbose(); + // params.setVerbose(); // read image final BufferedImage image = Imaging.getBufferedImage(file, params); diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java index 7fcfd234ea..30eabb5fa7 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java @@ -52,7 +52,7 @@ public JpegReadTest(File imageFile) { public void test() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData == false) params.enableReadThumbnails(); + if (ignoreImageData == false) params.setReadThumbnails(true); final ImageMetadata metadata = Imaging.getMetadata(imageFile, params); // TODO only run this tests with images that have metadata... diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java index 8c55676104..89a5c19e81 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java @@ -59,7 +59,7 @@ public void testDumpJFIF() throws Exception { public void testMetadata() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData == false) params.enableReadThumbnails(); + if (ignoreImageData == false) params.setReadThumbnails(true); final JpegImageMetadata metadata = (JpegImageMetadata) Imaging.getMetadata(imageFile, params); assertNotNull(metadata); diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java index c521ba6a64..c563c5db3f 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java @@ -52,7 +52,7 @@ public void test() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData == false) params.enableReadThumbnails(); + if (ignoreImageData == false) params.setReadThumbnails(true); final JpegImageMetadata metadata = (JpegImageMetadata) Imaging .getMetadata(imageFile, params); diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java index 9126f2942c..b90242d67b 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java @@ -66,7 +66,7 @@ private void checkImage(final File imageFile) throws IOException, final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData == false) params.enableReadThumbnails(); + if (ignoreImageData == false) params.setReadThumbnails(true); // note that metadata might be null if no metadata is found. final ImageMetadata metadata = Imaging.getMetadata(imageFile, params); diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java index a397df191a..39f728768e 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java @@ -61,7 +61,7 @@ public void testAddIptcData() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData == false) params.enableReadThumbnails(); + if (ignoreImageData == false) params.setReadThumbnails(true); final JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, params); if (metadata == null) { diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java index 0ade85a536..110670a134 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java @@ -50,7 +50,7 @@ public IptcDumpTest(File imageFile) { public void test() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData == false) params.enableReadThumbnails(); + if (ignoreImageData == false) params.setReadThumbnails(true); final JpegImageMetadata metadata = (JpegImageMetadata) Imaging.getMetadata(imageFile, params); assertNotNull(metadata); diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java index b16e6a1f4a..eef9b44c6d 100644 --- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java @@ -63,7 +63,7 @@ public void testRemove() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData == false) params.enableReadThumbnails(); + if (ignoreImageData == false) params.setReadThumbnails(true); final JpegPhotoshopMetadata metadata = new JpegImageParser() .getPhotoshopMetadata(byteSource, params); @@ -96,7 +96,7 @@ public void testInsert() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData == false) params.enableReadThumbnails(); + if (ignoreImageData == false) params.setReadThumbnails(true); final JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, params); assertNotNull(metadata); @@ -141,7 +141,7 @@ public void testUpdate() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData == false) params.enableReadThumbnails(); + if (ignoreImageData == false) params.setReadThumbnails(true); final JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, params); assertNotNull(metadata); @@ -188,7 +188,7 @@ public void testNoChangeUpdate() throws Exception { final ImagingParametersJpeg params = new ImagingParametersJpeg(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); - if (ignoreImageData == false) params.enableReadThumbnails(); + if (ignoreImageData == false) params.setReadThumbnails(true); final JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, params); assertNotNull(metadata); diff --git a/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java b/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java index 4e4e024fb9..3dab775977 100644 --- a/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java @@ -46,7 +46,7 @@ public void test() throws Exception { } final ImagingParameters params = new ImagingParameters(); - // params.enableVerbose(); + // params.setVerbose(); final BufferedImage image = Imaging.getBufferedImage(imageFile, params); assertNotNull(image); diff --git a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java index 6deba31b9b..95b9daef58 100644 --- a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java +++ b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java @@ -56,7 +56,7 @@ public void test() throws Exception { // Debug.debug("outFile", outFile); final ImagingParametersPng params = new ImagingParametersPng(); - params.enableForceTrueColor(); + params.setForceTrueColor(true); Imaging.writeImage(image, outFile, ImageFormats.PNG, params); final BufferedImage image2 = Imaging.getBufferedImage(outFile, new ImagingParameters()); diff --git a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java index aab4f0316a..f30ecda271 100644 --- a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java +++ b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java @@ -138,7 +138,7 @@ private void writeAndReadImageData(final int[][] rawData) throws IOException, final ImagingParametersPng writeParams = new ImagingParametersPng(); // writeParams.setImageFormat(ImageFormats.PNG); - // writeParams.enableForceTrueColor(); + // writeParams.setForceTrueColor(); final byte[] bytes = Imaging.writeImageToBytes(srcImage, ImageFormats.PNG, writeParams); From 42cc793ec63bd6373dd68a616f398dae06a08fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Tue, 24 Feb 2015 17:40:54 +0100 Subject: [PATCH 178/179] doc --- .../java/org/apache/commons/imaging/ImagingParameters.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index f4e86c0ba1..7b83f5ee97 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -37,10 +37,6 @@ *

* Other parameters have a default value. This is told in the javadoc for their * getX() method. They don't have a isXPresent() method. You may access them any time. - *

- * All boolean parameters have default values. Their setter and getter have a different - * naming scheme: enableX() causes isXEnabled() to return {@code true} while - * disableX() causes isXEnabled() to return {@code false}. */ public class ImagingParameters { From d36b30dee70dc6d92ee4de4b9a2226372ae6ee2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9F?= Date: Wed, 25 Mar 2015 20:07:03 +0100 Subject: [PATCH 179/179] fixed error in javadoc - replaced "{@false}" by "{@code false}" --- .../commons/imaging/ImagingParameters.java | 10 +++++----- .../commons/imaging/ImagingParametersTiff.java | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImagingParameters.java b/src/main/java/org/apache/commons/imaging/ImagingParameters.java index 7b83f5ee97..91ece80fed 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParameters.java @@ -121,7 +121,7 @@ public void setStrict(final boolean value) { * image format. *

* Applies to read operations. - * @return {@code true} if there is a value present, {@false} else. + * @return {@code true} if there is a value present, {@code false} else. */ public boolean isFileNameHintPresent() { return this.fileNameHint != null; @@ -162,7 +162,7 @@ public void setFileNameHint(final String value) { * Parameter key. * * Only used when writing images. Valid values: String of XMP XML. - * @return {@code true} if there is a value present, {@false} else. + * @return {@code true} if there is a value present, {@code false} else. */ public boolean isXmpXmlAsStringPresent() { return this.xmpXmlAsString != null; @@ -195,7 +195,7 @@ public void setXmpXmlAsString(final String value) { /** * Parameter used in write operations to indicate desired image format. - * @return {@code true} if there is a value present, {@false} else. + * @return {@code true} if there is a value present, {@code false} else. */ public boolean isImageFormatPresent() { return this.imageFormat != null; @@ -226,7 +226,7 @@ public void setImageFormat(final ImageFormat value) { /** * - * @return {@code true} if there is a value present, {@false} else. + * @return {@code true} if there is a value present, {@code false} else. */ public boolean isBufferedImageFactoryPresent() { return this.bufferedImageFactory != null; @@ -256,7 +256,7 @@ public void setBufferedImageFactory(final BufferedImageFactory value) { /** * Parameter key. Used in write operations to indicate the desired pixel * density (DPI), and/or aspect ratio. - * @return {@code true} if there is a value present, {@false} else. + * @return {@code true} if there is a value present, {@code false} else. * @see org.apache.commons.imaging.PixelDensity */ public boolean isPixelDensityPresent() { diff --git a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java index 00dc476228..f9910596c0 100644 --- a/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java +++ b/src/main/java/org/apache/commons/imaging/ImagingParametersTiff.java @@ -65,7 +65,7 @@ public ImagingParametersTiff() { //****** compressionLevel ****** /** - * Returns {@code true} if there is a value present, {@false} else. + * Returns {@code true} if there is a value present, {@code false} else. * @return */ public boolean isCompressionLevelPresent() { @@ -109,7 +109,7 @@ public void setCompressionLevel(final int value) { //****** compressionBlockSize ****** /** - * Returns {@code true} if there is a value present, {@false} else. + * Returns {@code true} if there is a value present, {@code false} else. * @return */ public boolean isCompressionBlockSizePresent() { @@ -146,7 +146,7 @@ public void setCompressionBlockSize(final int value) { * Only used when writing images. *

* Valid values: TiffOutputSet to write into the image's EXIF metadata. - * @return {@code true} if there is a value present, {@false} else. + * @return {@code true} if there is a value present, {@code false} else. */ public boolean isOutputSetPresent() { return this.outputSetForMetaData != null; @@ -199,7 +199,7 @@ public void setReadThumbnails(final boolean value) { //****** t4 options ****** /** - * Returns {@code true} if there is a value present, {@false} else. + * Returns {@code true} if there is a value present, {@code false} else. * @return */ public boolean isT4optionsPresent() { @@ -237,7 +237,7 @@ public void setT4options(final int value) { //****** t6 options ****** /** - * Returns {@code true} if there is a value present, {@false} else. + * Returns {@code true} if there is a value present, {@code false} else. * @return */ public boolean isT6optionsPresent() { @@ -273,7 +273,7 @@ public void setT6options(final int value) { //****** subImageX ****** /** - * Returns {@code true} if there is a value present, {@false} else. + * Returns {@code true} if there is a value present, {@code false} else. * @return */ public boolean isSubImageX_Present() { @@ -305,7 +305,7 @@ public void setSubImageX(final int value) { //****** subImageY ****** /** - * Returns {@code true} if there is a value present, {@false} else. + * Returns {@code true} if there is a value present, {@code false} else. * @return */ public boolean isSubImageY_Present() { @@ -337,7 +337,7 @@ public void setSubImageY(final int value) { //****** subImageWidth ****** /** - * Returns {@code true} if there is a value present, {@false} else. + * Returns {@code true} if there is a value present, {@code false} else. * @return */ public boolean isSubImageWidth_Present() { @@ -369,7 +369,7 @@ public void setSubImageWidth(final int value) { //****** subImageHeight ****** /** - * Returns {@code true} if there is a value present, {@false} else. + * Returns {@code true} if there is a value present, {@code false} else. * @return */ public boolean isSubImageHeight_Present() {