This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 89184f38b102519458dcfbfb771170795e8baff1 Author: Gary Gregory <[email protected]> AuthorDate: Sun Jan 4 09:07:04 2026 -0500 Javadoc --- .../commons/imaging/common/RationalNumber.java | 17 ++++-- .../imaging/common/RgbBufferedImageFactory.java | 11 ++++ .../imaging/common/SimpleBufferedImageFactory.java | 11 ++++ .../imaging/formats/jpeg/segments/SofnSegment.java | 37 +++++++++++++ .../imaging/formats/jpeg/segments/SosSegment.java | 35 ++++++++++++ .../imaging/formats/png/PngImagingParameters.java | 63 ++++++++++++++++++++++ .../png/scanlinefilters/ScanlineFilter.java | 12 +++++ .../png/scanlinefilters/ScanlineFilterAverage.java | 9 ++++ .../png/scanlinefilters/ScanlineFilterNone.java | 10 ++++ .../png/scanlinefilters/ScanlineFilterPaeth.java | 9 ++++ .../png/scanlinefilters/ScanlineFilterSub.java | 9 ++++ .../png/scanlinefilters/ScanlineFilterUp.java | 10 ++++ .../commons/imaging/formats/psd/PsdHeaderInfo.java | 39 ++++++++++++++ .../imaging/formats/psd/PsdImageParser.java | 6 +++ .../imaging/formats/psd/PsdImagingParameters.java | 8 ++- .../formats/rgbe/RgbeImagingParameters.java | 8 ++- .../tiff/constants/Rfc2301TagConstants.java | 50 +++++++++++++++++ .../commons/imaging/palette/QuantizedPalette.java | 9 ++++ .../commons/imaging/palette/SimplePalette.java | 3 ++ 19 files changed, 351 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/common/RationalNumber.java b/src/main/java/org/apache/commons/imaging/common/RationalNumber.java index 37a37a16..206070e5 100644 --- a/src/main/java/org/apache/commons/imaging/common/RationalNumber.java +++ b/src/main/java/org/apache/commons/imaging/common/RationalNumber.java @@ -51,6 +51,8 @@ public class RationalNumber extends Number { // int-precision tolerance private static final double TOLERANCE = 1E-8; + + /** Shallow size constant. */ public static final int SHALLOW_SIZE = 32; static RationalNumber factoryMethod(long n, long d) { @@ -170,17 +172,21 @@ public class RationalNumber extends Number { // of 32 bit unsigned integers. Since Java does not have an // unsigned type, this class widens the type to long in order // to avoid unintended negative numbers. + + /** The numerator value. */ public final long numerator; + /** The divisor value. */ public final long divisor; + /** Whether this is an unsigned type. */ public final boolean unsignedType; /** - * Constructs an instance based on signed integers + * Constructs an instance based on signed integers. * - * @param numerator a 32-bit signed integer - * @param divisor a non-zero 32-bit signed integer + * @param numerator a 32-bit signed integer. + * @param divisor a non-zero 32-bit signed integer. */ public RationalNumber(final int numerator, final int divisor) { this.numerator = numerator; @@ -278,6 +284,11 @@ public class RationalNumber extends Number { return new RationalNumber(-n, d, false); } + /** + * Converts to display string. + * + * @return the display string. + */ public String toDisplayString() { if (numerator % divisor == 0) { return Long.toString(numerator / divisor); diff --git a/src/main/java/org/apache/commons/imaging/common/RgbBufferedImageFactory.java b/src/main/java/org/apache/commons/imaging/common/RgbBufferedImageFactory.java index e89e54d4..1ba4ad34 100644 --- a/src/main/java/org/apache/commons/imaging/common/RgbBufferedImageFactory.java +++ b/src/main/java/org/apache/commons/imaging/common/RgbBufferedImageFactory.java @@ -19,7 +19,18 @@ package org.apache.commons.imaging.common; import java.awt.image.BufferedImage; +/** + * Factory for creating RGB buffered images. + */ public class RgbBufferedImageFactory implements BufferedImageFactory { + + /** + * Constructs a new instance. + */ + public RgbBufferedImageFactory() { + // Default constructor + } + @Override public BufferedImage getColorBufferedImage(final int width, final int height, final boolean hasAlpha) { if (hasAlpha) { diff --git a/src/main/java/org/apache/commons/imaging/common/SimpleBufferedImageFactory.java b/src/main/java/org/apache/commons/imaging/common/SimpleBufferedImageFactory.java index a9ebab88..80bc8e08 100644 --- a/src/main/java/org/apache/commons/imaging/common/SimpleBufferedImageFactory.java +++ b/src/main/java/org/apache/commons/imaging/common/SimpleBufferedImageFactory.java @@ -19,7 +19,18 @@ package org.apache.commons.imaging.common; import java.awt.image.BufferedImage; +/** + * Simple factory for creating buffered images. + */ public class SimpleBufferedImageFactory implements BufferedImageFactory { + + /** + * Constructs a new instance. + */ + public SimpleBufferedImageFactory() { + // Default constructor + } + @Override public BufferedImage getColorBufferedImage(final int width, final int height, final boolean hasAlpha) { if (hasAlpha) { diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java index a5e80166..552ca9e0 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java @@ -31,13 +31,34 @@ import org.apache.commons.imaging.formats.jpeg.JpegConstants; public final class SofnSegment extends AbstractSegment { + /** + * JPEG component information. + */ public static class Component { + + /** Shallow size constant. */ static final int SHALLOW_SIZE = 32; + + /** Component identifier. */ public final int componentIdentifier; + + /** Horizontal sampling factor. */ public final int horizontalSamplingFactor; + + /** Vertical sampling factor. */ public final int verticalSamplingFactor; + + /** Quantization table destination selector. */ public final int quantTabDestSelector; + /** + * Constructs a component. + * + * @param componentIdentifier the component identifier. + * @param horizontalSamplingFactor the horizontal sampling factor. + * @param veritcalSamplingFactor the vertical sampling factor. + * @param quantTabDestSelector the quantization table destination selector. + */ public Component(final int componentIdentifier, final int horizontalSamplingFactor, final int veritcalSamplingFactor, final int quantTabDestSelector) { this.componentIdentifier = componentIdentifier; this.horizontalSamplingFactor = horizontalSamplingFactor; @@ -47,13 +68,29 @@ public final class SofnSegment extends AbstractSegment { } private static final Logger LOGGER = Logger.getLogger(SofnSegment.class.getName()); + + /** Image width. */ public final int width; + + /** Image height. */ public final int height; + + /** Number of components. */ public final int numberOfComponents; + + /** Precision. */ public final int precision; private final Component[] components; + /** + * Constructs a SOFn segment. + * + * @param marker the marker. + * @param segmentData the segment data. + * @throws IOException if an I/O error occurs. + * @throws ImagingException if an imaging error occurs. + */ public SofnSegment(final int marker, final byte[] segmentData) throws IOException, ImagingException { this(marker, segmentData.length, new ByteArrayInputStream(segmentData)); } diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java index aa72a2af..ba1fb9c5 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java @@ -28,12 +28,30 @@ import org.apache.commons.imaging.common.Allocator; public final class SosSegment extends AbstractSegment { + /** + * JPEG SOS component information. + */ public static class Component { + + /** Shallow size constant. */ static final int SHALLOW_SIZE = 24; + + /** Scan component selector. */ public final int scanComponentSelector; + + /** DC coding table selector. */ public final int dcCodingTableSelector; + + /** AC coding table selector. */ public final int acCodingTableSelector; + /** + * Constructs a component. + * + * @param scanComponentSelector the scan component selector. + * @param dcCodingTableSelector the DC coding table selector. + * @param acCodingTableSelector the AC coding table selector. + */ public Component(final int scanComponentSelector, final int dcCodingTableSelector, final int acCodingTableSelector) { this.scanComponentSelector = scanComponentSelector; this.dcCodingTableSelector = dcCodingTableSelector; @@ -42,14 +60,31 @@ public final class SosSegment extends AbstractSegment { } private static final Logger LOGGER = Logger.getLogger(SosSegment.class.getName()); + + /** Number of components. */ public final int numberOfComponents; + private final Component[] components; + + /** Start of spectral selection. */ public final int startOfSpectralSelection; + + /** End of spectral selection. */ public final int endOfSpectralSelection; + + /** Successive approximation bit high. */ public final int successiveApproximationBitHigh; + /** Successive approximation bit low. */ public final int successiveApproximationBitLow; + /** + * Constructs a SOS segment. + * + * @param marker the marker. + * @param segmentData the segment data. + * @throws IOException if an I/O error occurs. + */ public SosSegment(final int marker, final byte[] segmentData) throws IOException { this(marker, segmentData.length, new ByteArrayInputStream(segmentData)); } diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngImagingParameters.java b/src/main/java/org/apache/commons/imaging/formats/png/PngImagingParameters.java index 27cea447..af6d4b3a 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngImagingParameters.java @@ -27,6 +27,7 @@ import org.apache.commons.imaging.common.XmpImagingParameters; */ public class PngImagingParameters extends XmpImagingParameters<PngImagingParameters> { + /** Default bit depth value. */ public static final byte DEFAULT_BIT_DEPTH = 8; /** @@ -62,22 +63,54 @@ public class PngImagingParameters extends XmpImagingParameters<PngImagingParamet */ private List<? extends AbstractPngText> textChunks; + /** + * Constructs a new instance. + */ + public PngImagingParameters() { + // Default constructor + } + + /** + * Gets the bit depth. + * + * @return the bit depth. + */ public byte getBitDepth() { return bitDepth; } + /** + * Gets the physical scale. + * + * @return the physical scale. + */ public PhysicalScale getPhysicalScale() { return physicalScale; } + /** + * Gets the text chunks. + * + * @return the text chunks. + */ public List<? extends AbstractPngText> getTextChunks() { return textChunks != null ? Collections.unmodifiableList(textChunks) : null; } + /** + * Checks if forcing indexed color. + * + * @return true if forcing indexed color, false otherwise. + */ public boolean isForceIndexedColor() { return forceIndexedColor; } + /** + * Checks if forcing true color. + * + * @return true if forcing true color, false otherwise. + */ public boolean isForceTrueColor() { return forceTrueColor; } @@ -91,21 +124,45 @@ public class PngImagingParameters extends XmpImagingParameters<PngImagingParamet return predictorEnabled; } + /** + * Sets the bit depth. + * + * @param bitDepth the bit depth. + * @return this instance. + */ public PngImagingParameters setBitDepth(final byte bitDepth) { this.bitDepth = bitDepth; return asThis(); } + /** + * Sets whether to force indexed color. + * + * @param forceIndexedColor whether to force indexed color. + * @return this instance. + */ public PngImagingParameters setForceIndexedColor(final boolean forceIndexedColor) { this.forceIndexedColor = forceIndexedColor; return asThis(); } + /** + * Sets whether to force true color. + * + * @param forceTrueColor whether to force true color. + * @return this instance. + */ public PngImagingParameters setForceTrueColor(final boolean forceTrueColor) { this.forceTrueColor = forceTrueColor; return asThis(); } + /** + * Sets the physical scale. + * + * @param physicalScale the physical scale. + * @return this instance. + */ public PngImagingParameters setPhysicalScale(final PhysicalScale physicalScale) { this.physicalScale = physicalScale; return asThis(); @@ -124,6 +181,12 @@ public class PngImagingParameters extends XmpImagingParameters<PngImagingParamet return asThis(); } + /** + * Sets the text chunks. + * + * @param textChunks the text chunks. + * @return this instance. + */ public PngImagingParameters setTextChunks(final List<? extends AbstractPngText> textChunks) { this.textChunks = Collections.unmodifiableList(textChunks); return asThis(); diff --git a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilter.java b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilter.java index 7bde28ed..5a0ab372 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilter.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilter.java @@ -20,8 +20,20 @@ import java.io.IOException; import org.apache.commons.imaging.ImagingException; +/** + * Interface for PNG scanline filtering. + */ public interface ScanlineFilter { + /** + * Unfilters a scanline. + * + * @param src the source bytes. + * @param dst the destination bytes. + * @param up the previous scanline bytes. + * @throws ImagingException if an imaging error occurs. + * @throws IOException if an I/O error occurs. + */ void unfilter(byte[] src, byte[] dst, byte[] up) throws ImagingException, IOException; } diff --git a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterAverage.java b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterAverage.java index 09daeec1..34e4a611 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterAverage.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterAverage.java @@ -20,9 +20,18 @@ import java.io.IOException; import org.apache.commons.imaging.ImagingException; +/** + * PNG scanline filter using average of left and up pixels. + */ public class ScanlineFilterAverage implements ScanlineFilter { + private final int bytesPerPixel; + /** + * Constructs a new instance. + * + * @param bytesPerPixel the number of bytes per pixel. + */ public ScanlineFilterAverage(final int bytesPerPixel) { this.bytesPerPixel = bytesPerPixel; } diff --git a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterNone.java b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterNone.java index e3357928..6dad9220 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterNone.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterNone.java @@ -20,8 +20,18 @@ import java.io.IOException; import org.apache.commons.imaging.ImagingException; +/** + * PNG scanline filter with no filtering (direct copy). + */ public class ScanlineFilterNone implements ScanlineFilter { + /** + * Constructs a new instance. + */ + public ScanlineFilterNone() { + // Default constructor + } + @Override public void unfilter(final byte[] src, final byte[] dst, final byte[] up) throws ImagingException, IOException { System.arraycopy(src, 0, dst, 0, src.length); diff --git a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java index 162575d2..c4f2e029 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java @@ -20,9 +20,18 @@ import java.io.IOException; import org.apache.commons.imaging.ImagingException; +/** + * PNG scanline filter using Paeth predictor. + */ public class ScanlineFilterPaeth implements ScanlineFilter { + private final int bytesPerPixel; + /** + * Constructs a new instance. + * + * @param bytesPerPixel the number of bytes per pixel. + */ public ScanlineFilterPaeth(final int bytesPerPixel) { this.bytesPerPixel = bytesPerPixel; } diff --git a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterSub.java b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterSub.java index aa79692f..13778e49 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterSub.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterSub.java @@ -20,9 +20,18 @@ import java.io.IOException; import org.apache.commons.imaging.ImagingException; +/** + * PNG scanline filter using subtraction from left pixel. + */ public class ScanlineFilterSub implements ScanlineFilter { + private final int bytesPerPixel; + /** + * Constructs a new instance. + * + * @param bytesPerPixel the number of bytes per pixel. + */ public ScanlineFilterSub(final int bytesPerPixel) { this.bytesPerPixel = bytesPerPixel; } diff --git a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterUp.java b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterUp.java index 18841da6..7ea1fc04 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterUp.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterUp.java @@ -20,8 +20,18 @@ import java.io.IOException; import org.apache.commons.imaging.ImagingException; +/** + * PNG scanline filter using subtraction from up pixel. + */ public class ScanlineFilterUp implements ScanlineFilter { + /** + * Constructs a new instance. + */ + public ScanlineFilterUp() { + // Default constructor + } + @Override public void unfilter(final byte[] src, final byte[] dst, final byte[] up) throws ImagingException, IOException { for (int i = 0; i < src.length; i++) { diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java b/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java index 82c87ffa..34fa258f 100644 --- a/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java +++ b/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java @@ -22,18 +22,44 @@ import java.io.StringWriter; import java.util.logging.Level; import java.util.logging.Logger; +/** + * PSD (Photoshop Document) header information. + */ public class PsdHeaderInfo { private static final Logger LOGGER = Logger.getLogger(PsdHeaderInfo.class.getName()); + /** PSD version. */ public final int version; + private final byte[] reserved; + + /** Number of channels. */ public final int channels; + + /** Number of rows (height). */ public final int rows; + + /** Number of columns (width). */ public final int columns; + + /** Bit depth. */ public final int depth; + + /** Color mode. */ public final int mode; + /** + * Constructs PSD header info. + * + * @param version the version. + * @param reserved reserved bytes. + * @param channels number of channels. + * @param rows number of rows. + * @param columns number of columns. + * @param depth bit depth. + * @param mode color mode. + */ public PsdHeaderInfo(final int version, final byte[] reserved, final int channels, final int rows, final int columns, final int depth, final int mode) { this.version = version; this.reserved = reserved.clone(); @@ -45,6 +71,9 @@ public class PsdHeaderInfo { } + /** + * Dumps header info to logger. + */ public void dump() { try (StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw)) { @@ -57,6 +86,11 @@ public class PsdHeaderInfo { } } + /** + * Dumps header info to print writer. + * + * @param pw the print writer. + */ public void dump(final PrintWriter pw) { pw.println(""); pw.println("Header"); @@ -71,6 +105,11 @@ public class PsdHeaderInfo { pw.flush(); } + /** + * Gets a copy of the reserved bytes. + * + * @return the reserved bytes. + */ public byte[] getReserved() { return reserved.clone(); } 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 5d025bfa..90247d1e 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 @@ -60,8 +60,14 @@ public class PsdImageParser extends AbstractImageParser<PsdImagingParameters> im private static final int PSD_SECTION_IMAGE_DATA = 4; private static final int PSD_HEADER_LENGTH = 26; private static final int COLOR_MODE_INDEXED = 2; + + /** Image resource ID for ICC profile. */ public static final int IMAGE_RESOURCE_ID_ICC_PROFILE = 0x040F; + + /** Image resource ID for XMP. */ public static final int IMAGE_RESOURCE_ID_XMP = 0x0424; + + /** Block name for XMP. */ public static final String BLOCK_NAME_XMP = "XMP"; /** diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImagingParameters.java b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImagingParameters.java index 7e9aeeea..0976ca75 100644 --- a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImagingParameters.java @@ -25,5 +25,11 @@ import org.apache.commons.imaging.ImagingParameters; * @since 1.0-alpha3 */ public class PsdImagingParameters extends ImagingParameters<PsdImagingParameters> { - // empty + + /** + * Constructs a new instance. + */ + public PsdImagingParameters() { + // Default constructor + } } diff --git a/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImagingParameters.java b/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImagingParameters.java index 658c89f3..0c54b6dd 100644 --- a/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImagingParameters.java +++ b/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImagingParameters.java @@ -23,5 +23,11 @@ import org.apache.commons.imaging.ImagingParameters; * @since 1.0-alpha3 */ public class RgbeImagingParameters extends ImagingParameters<RgbeImagingParameters> { - // empty + + /** + * Constructs a new instance. + */ + public RgbeImagingParameters() { + // Default constructor + } } diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/Rfc2301TagConstants.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/Rfc2301TagConstants.java index d500c6bd..dd3355f3 100644 --- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/Rfc2301TagConstants.java +++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/Rfc2301TagConstants.java @@ -45,53 +45,103 @@ import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShorts; */ public final class Rfc2301TagConstants { + /** TIFF tag for bad fax lines. */ public static final TagInfoShortOrLong TIFF_TAG_BAD_FAX_LINES = new TagInfoShortOrLong("BadFaxLines", 0x0146, 1, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + /** TIFF tag for clean fax data. */ public static final TagInfoShort TIFF_TAG_CLEAN_FAX_DATA = new TagInfoShort("CleanFaxData", 0x0147, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + + /** Clean fax data value: clean. */ public static final int CLEAN_FAX_DATA_VALUE_CLEAN = 0; + + /** Clean fax data value: regenerated. */ public static final int CLEAN_FAX_DATA_VALUE_REGENERATED = 1; + + /** Clean fax data value: unclean. */ public static final int CLEAN_FAX_DATA_VALUE_UNCLEAN = 2; + /** TIFF tag for consecutive bad fax lines. */ public static final TagInfoShortOrLong TIFF_TAG_CONSECUTIVE_BAD_FAX_LINES = new TagInfoShortOrLong("ConsecutiveBadFaxLines", 0x0148, 1, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + /** TIFF tag for global parameters IFD. */ public static final TagInfoDirectory TIFF_TAG_GLOBAL_PARAMETERS_IFD = new TagInfoDirectory("GlobalParametersIFD", 0x0190, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + /** TIFF tag for profile type. */ public static final TagInfoLong TIFF_TAG_PROFILE_TYPE = new TagInfoLong("ProfileType", 0x0191, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + + /** Profile type value: unspecified. */ public static final int PROFILE_TYPE_VALUE_UNSPECIFIED = 0; + + /** Profile type value: group 3 fax. */ public static final int PROFILE_TYPE_VALUE_GROUP_3_FAX = 1; + /** TIFF tag for fax profile. */ public static final TagInfoByte TIFF_TAG_FAX_PROFILE = new TagInfoByte("FaxProfile", 0x0192, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + + /** Fax profile value: unknown. */ public static final int FAX_PROFILE_VALUE_UNKNOWN = 0; + + /** Fax profile value: minimal B&W lossless. */ public static final int FAX_PROFILE_VALUE_MINIMAL_B_AND_W_LOSSLESS_S = 1; + + /** Fax profile value: extended B&W lossless. */ public static final int FAX_PROFILE_VALUE_EXTENDED_B_AND_W_LOSSLESS_F = 2; + + /** Fax profile value: lossless JBIG B&W. */ public static final int FAX_PROFILE_VALUE_LOSSLESS_JBIG_B_AND_W_J = 3; + + /** Fax profile value: lossy color and grayscale. */ public static final int FAX_PROFILE_VALUE_LOSSY_COLOR_AND_GRAYSCALE_C = 4; + + /** Fax profile value: lossless color and grayscale. */ public static final int FAX_PROFILE_VALUE_LOSSLESS_COLOR_AND_GRAYSCALE_L = 5; + + /** Fax profile value: mixed raster content. */ public static final int FAX_PROFILE_VALUE_MIXED_RASTER_CONTENT_M = 6; + /** TIFF tag for coding methods. */ public static final TagInfoLong TIFF_TAG_CODING_METHODS = new TagInfoLong("CodingMethods", 0x0193, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + + /** Coding methods value: T4 1D. */ public static final int CODING_METHODS_VALUE_T4_1D = 2; + + /** Coding methods value: T4 2D. */ public static final int CODING_METHODS_VALUE_T4_2D = 4; + + /** Coding methods value: T6. */ public static final int CODING_METHODS_VALUE_T6 = 8; + + /** Coding methods value: T82 T85. */ public static final int CODING_METHODS_VALUE_T82_T85 = 16; + + /** Coding methods value: T81. */ public static final int CODING_METHODS_VALUE_T81 = 32; + + /** Coding methods value: T82 T43. */ public static final int CODING_METHODS_VALUE_T82_T43 = 64; + /** TIFF tag for version year. */ public static final TagInfoBytes TIFF_TAG_VERSION_YEAR = new TagInfoBytes("VersionYear", 0x0194, 4, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + /** TIFF tag for mode number. */ public static final TagInfoByte TIFF_TAG_MODE_NUMBER = new TagInfoByte("ModeNumber", 0x0195, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + /** TIFF tag for decode. */ public static final TagInfoRationals TIFF_TAG_DECODE = new TagInfoRationals("Decode", 0x01b1, -1, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + /** TIFF tag for default image color. */ public static final TagInfoShorts TIFF_TAG_DEFAULT_IMAGE_COLOR = new TagInfoShorts("DefaultImageColor", 0x01b2, -1, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + /** TIFF tag for strip row counts. */ public static final TagInfoLongs TIFF_TAG_STRIP_ROW_COUNTS = new TagInfoLongs("StripRowCounts", 0x022f, -1, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + /** TIFF tag for image layer. */ public static final TagInfoShortOrLong TIFF_TAG_IMAGE_LAYER = new TagInfoShortOrLong("ImageLayer", 0x87ac, 2, TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN); + /** All RFC 2301 tags. */ public static final List<TagInfo> ALL_RFC_2301_TAGS = Collections.unmodifiableList(Arrays.asList(TIFF_TAG_BAD_FAX_LINES, TIFF_TAG_CLEAN_FAX_DATA, TIFF_TAG_CONSECUTIVE_BAD_FAX_LINES, TIFF_TAG_GLOBAL_PARAMETERS_IFD, TIFF_TAG_PROFILE_TYPE, TIFF_TAG_FAX_PROFILE, TIFF_TAG_CODING_METHODS, TIFF_TAG_VERSION_YEAR, TIFF_TAG_MODE_NUMBER, TIFF_TAG_DECODE, TIFF_TAG_DEFAULT_IMAGE_COLOR, TIFF_TAG_STRIP_ROW_COUNTS, TIFF_TAG_IMAGE_LAYER)); diff --git a/src/main/java/org/apache/commons/imaging/palette/QuantizedPalette.java b/src/main/java/org/apache/commons/imaging/palette/QuantizedPalette.java index 56b56ad9..670382e0 100644 --- a/src/main/java/org/apache/commons/imaging/palette/QuantizedPalette.java +++ b/src/main/java/org/apache/commons/imaging/palette/QuantizedPalette.java @@ -22,12 +22,21 @@ import java.util.List; import org.apache.commons.imaging.ImagingException; import org.apache.commons.imaging.common.Allocator; +/** + * Palette with quantized color space. + */ public class QuantizedPalette implements Palette { private final int precision; private final List<ColorSpaceSubset> subsets; private final ColorSpaceSubset[] straight; + /** + * Constructs a quantized palette. + * + * @param subsets the color space subsets. + * @param precision the precision. + */ public QuantizedPalette(final List<ColorSpaceSubset> subsets, final int precision) { this.subsets = subsets == null ? Collections.emptyList() : Collections.unmodifiableList(subsets); this.precision = precision; diff --git a/src/main/java/org/apache/commons/imaging/palette/SimplePalette.java b/src/main/java/org/apache/commons/imaging/palette/SimplePalette.java index 8f27c8cd..a8a5c1a8 100644 --- a/src/main/java/org/apache/commons/imaging/palette/SimplePalette.java +++ b/src/main/java/org/apache/commons/imaging/palette/SimplePalette.java @@ -18,6 +18,9 @@ package org.apache.commons.imaging.palette; import java.util.Objects; +/** + * Simple palette implementation. + */ public class SimplePalette implements Palette { private final int[] palette;
