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 18e80d61692c4388446897100fcd8a9c28cce250 Author: Gary Gregory <[email protected]> AuthorDate: Sun Jan 4 08:00:24 2026 -0500 Javadoc --- .../org/apache/commons/imaging/PixelDensity.java | 90 +++++++++++++++++++++- .../commons/imaging/formats/png/PngColorType.java | 24 +++++- .../commons/imaging/formats/png/PngConstants.java | 9 +++ .../commons/imaging/formats/png/PngImageInfo.java | 32 ++++++++ .../imaging/formats/png/PngImageMetadata.java | 24 ++++++ .../imaging/formats/png/PngImageParser.java | 2 + .../imaging/formats/png/chunks/PngChunkIccp.java | 15 ++++ .../imaging/formats/png/chunks/PngChunkIdat.java | 11 +++ .../imaging/formats/png/chunks/PngChunkIhdr.java | 48 ++++++++++++ .../imaging/formats/png/chunks/PngChunkItxt.java | 8 ++ .../imaging/formats/png/chunks/PngChunkPhys.java | 27 +++++++ .../imaging/formats/png/chunks/PngChunkPlte.java | 30 ++++++++ .../imaging/formats/png/chunks/PngChunkScal.java | 27 +++++++ .../imaging/formats/png/chunks/PngChunkText.java | 3 + .../imaging/formats/png/chunks/PngChunkZtxt.java | 13 ++++ 15 files changed, 360 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/PixelDensity.java b/src/main/java/org/apache/commons/imaging/PixelDensity.java index 79877e29..7525630b 100644 --- a/src/main/java/org/apache/commons/imaging/PixelDensity.java +++ b/src/main/java/org/apache/commons/imaging/PixelDensity.java @@ -25,18 +25,46 @@ public final class PixelDensity { private static final int PIXEL_PER_METRE = 10000; private static final int PIXEL_PER_CENTIMETRE = 100; + /** + * Creates a pixel density from pixels per centimetre. + * + * @param x horizontal density in pixels per centimetre. + * @param y vertical density in pixels per centimetre. + * @return the pixel density. + */ public static PixelDensity createFromPixelsPerCentimetre(final double x, final double y) { return new PixelDensity(x, y, PIXEL_PER_CENTIMETRE); } + /** + * Creates a pixel density from pixels per inch. + * + * @param x horizontal density in pixels per inch. + * @param y vertical density in pixels per inch. + * @return the pixel density. + */ public static PixelDensity createFromPixelsPerInch(final double x, final double y) { return new PixelDensity(x, y, PIXEL_PER_INCH); } + /** + * Creates a pixel density from pixels per metre. + * + * @param x horizontal density in pixels per metre. + * @param y vertical density in pixels per metre. + * @return the pixel density. + */ public static PixelDensity createFromPixelsPerMetre(final double x, final double y) { return new PixelDensity(x, y, PIXEL_PER_METRE); } + /** + * Creates a unitless pixel density. + * + * @param x horizontal density (unitless). + * @param y vertical density (unitless). + * @return the pixel density. + */ public static PixelDensity createUnitless(final double x, final double y) { return new PixelDensity(x, y, PIXEL_NO_UNIT); } @@ -45,7 +73,7 @@ public final class PixelDensity { private final double verticalDensity; - // / One-tenth of a millimetre units. + // One-tenth of a millimetre units. private final int unitLength; private PixelDensity(final double horizontalDensity, final double verticalDensity, final int unitLength) { @@ -54,14 +82,29 @@ public final class PixelDensity { this.unitLength = unitLength; } + /** + * Gets the raw horizontal density. + * + * @return the raw horizontal density. + */ public double getRawHorizontalDensity() { return horizontalDensity; } + /** + * Gets the raw vertical density. + * + * @return the raw vertical density. + */ public double getRawVerticalDensity() { return verticalDensity; } + /** + * Gets the horizontal density in pixels per centimetre. + * + * @return the horizontal density in pixels per centimetre. + */ public double horizontalDensityCentimetres() { if (isInCentimetres()) { return horizontalDensity; @@ -69,6 +112,11 @@ public final class PixelDensity { return horizontalDensity * PIXEL_PER_CENTIMETRE / unitLength; } + /** + * Gets the horizontal density in pixels per inch. + * + * @return the horizontal density in pixels per inch. + */ public double horizontalDensityInches() { if (isInInches()) { return horizontalDensity; @@ -76,6 +124,11 @@ public final class PixelDensity { return horizontalDensity * PIXEL_PER_INCH / unitLength; } + /** + * Gets the horizontal density in pixels per metre. + * + * @return the horizontal density in pixels per metre. + */ public double horizontalDensityMetres() { if (isInMetres()) { return horizontalDensity; @@ -83,22 +136,47 @@ public final class PixelDensity { return horizontalDensity * PIXEL_PER_METRE / unitLength; } + /** + * Checks if the density is in centimetres. + * + * @return true if in centimetres, false otherwise. + */ public boolean isInCentimetres() { return unitLength == PIXEL_PER_CENTIMETRE; } + /** + * Checks if the density is in inches. + * + * @return true if in inches, false otherwise. + */ public boolean isInInches() { return unitLength == PIXEL_PER_INCH; } + /** + * Checks if the density is in metres. + * + * @return true if in metres, false otherwise. + */ public boolean isInMetres() { return unitLength == PIXEL_PER_METRE; } + /** + * Checks if the density is unitless. + * + * @return true if unitless, false otherwise. + */ public boolean isUnitless() { return unitLength == PIXEL_NO_UNIT; } + /** + * Gets the vertical density in pixels per centimetre. + * + * @return the vertical density in pixels per centimetre. + */ public double verticalDensityCentimetres() { if (isInCentimetres()) { return verticalDensity; @@ -106,6 +184,11 @@ public final class PixelDensity { return verticalDensity * PIXEL_PER_CENTIMETRE / unitLength; } + /** + * Gets the vertical density in pixels per inch. + * + * @return the vertical density in pixels per inch. + */ public double verticalDensityInches() { if (isInInches()) { return verticalDensity; @@ -113,6 +196,11 @@ public final class PixelDensity { return verticalDensity * PIXEL_PER_INCH / unitLength; } + /** + * Gets the vertical density in pixels per metre. + * + * @return the vertical density in pixels per metre. + */ public double verticalDensityMetres() { if (isInMetres()) { return verticalDensity; diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java b/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java index 5ef7b7ae..0395001b 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java @@ -19,12 +19,26 @@ package org.apache.commons.imaging.formats.png; import java.util.Arrays; +/** + * PNG color type enumeration. + */ public enum PngColorType { // FIXME can this be merged with ImageInfo.ColorType? - GREYSCALE(0, true, false, 1, new int[] { 1, 2, 4, 8, 16 }), TRUE_COLOR(2, false, false, 3, new int[] { 8, 16 }), - INDEXED_COLOR(3, false, false, 1, new int[] { 1, 2, 4, 8 }), GREYSCALE_WITH_ALPHA(4, true, true, 2, new int[] { 8, 16 }), + /** Grayscale color type. */ + GREYSCALE(0, true, false, 1, new int[] { 1, 2, 4, 8, 16 }), + + /** True color (RGB) type. */ + TRUE_COLOR(2, false, false, 3, new int[] { 8, 16 }), + + /** Indexed color (palette) type. */ + INDEXED_COLOR(3, false, false, 1, new int[] { 1, 2, 4, 8 }), + + /** Grayscale with alpha channel type. */ + GREYSCALE_WITH_ALPHA(4, true, true, 2, new int[] { 8, 16 }), + + /** True color with alpha channel type. */ TRUE_COLOR_WITH_ALPHA(6, false, true, 4, new int[] { 8, 16 }); static PngColorType getColorType(final boolean alpha, final boolean grayscale) { @@ -40,6 +54,12 @@ public enum PngColorType { return TRUE_COLOR; } + /** + * Gets the color type corresponding to the given value. + * + * @param value the color type value. + * @return the color type, or null if not found. + */ public static PngColorType getColorType(final int value) { for (final PngColorType type : values()) { if (type.value == value) { 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 2fa48aef..da13ca42 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 @@ -18,13 +18,21 @@ package org.apache.commons.imaging.formats.png; import org.apache.commons.imaging.common.BinaryConstant; +/** + * PNG format constants. + */ public final class PngConstants { + /** PNG compression type: deflate/inflate. */ public static final int COMPRESSION_DEFLATE_INFLATE = 0; + /** PNG file signature. */ public static final BinaryConstant PNG_SIGNATURE = new BinaryConstant(new byte[] { (byte) 0x89, 'P', 'N', 'G', '\r', '\n', 0x1A, '\n', }); + /** Compression type: inflate/deflate. */ public static final byte COMPRESSION_TYPE_INFLATE_DEFLATE = 0; + + /** Filter method: adaptive. */ public static final byte FILTER_METHOD_ADAPTIVE = 0; /* @@ -39,6 +47,7 @@ public final class PngConstants { * to be reconstructed when the alpha channel is not retained in the PNG image. */ + /** XMP metadata keyword. */ public static final String XMP_KEYWORD = "XML:com.adobe.xmp"; /** diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngImageInfo.java b/src/main/java/org/apache/commons/imaging/formats/png/PngImageInfo.java index 500aa113..b532919e 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngImageInfo.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngImageInfo.java @@ -22,11 +22,38 @@ import java.util.List; import org.apache.commons.imaging.ImageFormat; import org.apache.commons.imaging.ImageInfo; +/** + * PNG image information. + */ public class PngImageInfo extends ImageInfo { private final List<AbstractPngText> textChunks; private final PhysicalScale physicalScale; + /** + * Constructs PNG image info. + * + * @param formatDetails format details. + * @param bitsPerPixel bits per pixel. + * @param comments image comments. + * @param format image format. + * @param formatName format name. + * @param height image height. + * @param mimeType MIME type. + * @param numberOfImages number of images. + * @param physicalHeightDpi physical height DPI. + * @param physicalHeightInch physical height in inches. + * @param physicalWidthDpi physical width DPI. + * @param physicalWidthInch physical width in inches. + * @param width image width. + * @param progressive whether progressive. + * @param transparent whether transparent. + * @param usesPalette whether uses palette. + * @param colorType color type. + * @param compressionAlgorithm compression algorithm. + * @param textChunks text chunks. + * @param physicalScale physical scale. + */ PngImageInfo(final String formatDetails, final int bitsPerPixel, final List<String> comments, final ImageFormat format, final String formatName, final int height, final String mimeType, final int numberOfImages, final int physicalHeightDpi, final float physicalHeightInch, final int physicalWidthDpi, final float physicalWidthInch, final int width, final boolean progressive, final boolean transparent, @@ -48,6 +75,11 @@ public class PngImageInfo extends ImageInfo { return physicalScale; } + /** + * Gets the text chunks. + * + * @return list of text chunks. + */ public List<AbstractPngText> getTextChunks() { return new ArrayList<>(textChunks); } diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngImageMetadata.java b/src/main/java/org/apache/commons/imaging/formats/png/PngImageMetadata.java index 6de5906b..ea20b836 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/PngImageMetadata.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/PngImageMetadata.java @@ -36,19 +36,38 @@ public class PngImageMetadata implements ImageMetadata { private final ImageMetadata textualInformation; private final TiffImageMetadata exif; + /** + * Constructs PNG image metadata. + * + * @param textualInformation textual information. + */ public PngImageMetadata(final ImageMetadata textualInformation) { this(textualInformation, null); } + /** + * Constructs PNG image metadata. + * + * @param textualInformation textual information. + * @param exif EXIF metadata. + */ public PngImageMetadata(final ImageMetadata textualInformation, final TiffImageMetadata exif) { this.textualInformation = Objects.requireNonNull(textualInformation); this.exif = exif; } + /** + * Dumps metadata to debug output. + */ public void dump() { Debug.debug(this.toString()); } + /** + * Gets EXIF metadata. + * + * @return EXIF metadata, or null if none. + */ public TiffImageMetadata getExif() { return exif; } @@ -64,6 +83,11 @@ public class PngImageMetadata implements ImageMetadata { return result; } + /** + * Gets textual information. + * + * @return textual information. + */ public ImageMetadata getTextualInformation() { return textualInformation; } 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 0aae1b71..1488658e 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 @@ -322,6 +322,8 @@ public class PngImageParser extends AbstractImageParser<PngImagingParameters> im } /** + * Reads PNG chunk types from an input stream. + * * @param is PNG image input stream * @return List of String-formatted chunk types, ie. "tRNs". * @throws ImagingException if it fail to read the PNG chunks diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java index d55b8d40..cb483d86 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java @@ -100,14 +100,29 @@ public final class PngChunkIccp extends PngChunk { } } + /** + * Gets a copy of the compressed profile data. + * + * @return the compressed profile data. + */ public byte[] getCompressedProfile() { return compressedProfile.clone(); } + /** + * Gets the compression method. + * + * @return the compression method. + */ public int getCompressionMethod() { return compressionMethod; } + /** + * Gets the profile name. + * + * @return the profile name. + */ public String getProfileName() { return profileName; } diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java index 24deab93..3a034950 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java @@ -16,8 +16,19 @@ */ package org.apache.commons.imaging.formats.png.chunks; +/** + * PNG IDAT chunk with image data. + */ public class PngChunkIdat extends PngChunk { + /** + * Constructs a PNG IDAT chunk. + * + * @param length the chunk length. + * @param chunkType the chunk type. + * @param crc the CRC. + * @param bytes the chunk bytes. + */ public PngChunkIdat(final int length, final int chunkType, final int crc, final byte[] bytes) { super(length, chunkType, crc, bytes); } diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java index 4139aa6f..1e85de2b 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java @@ -26,6 +26,9 @@ import org.apache.commons.imaging.ImagingException; import org.apache.commons.imaging.formats.png.InterlaceMethod; import org.apache.commons.imaging.formats.png.PngColorType; +/** + * PNG IHDR chunk with image header. + */ public final class PngChunkIhdr extends PngChunk { private final int width; @@ -36,6 +39,16 @@ public final class PngChunkIhdr extends PngChunk { private final int filterMethod; private final InterlaceMethod interlaceMethod; + /** + * Constructs a PNG IHDR chunk. + * + * @param length the chunk length. + * @param chunkType the chunk type. + * @param crc the CRC. + * @param bytes the chunk bytes. + * @throws ImagingException if the chunk is corrupt. + * @throws IOException if an I/O error occurs. + */ public PngChunkIhdr(final int length, final int chunkType, final int crc, final byte[] bytes) throws ImagingException, IOException { super(length, chunkType, crc, bytes); @@ -57,30 +70,65 @@ public final class PngChunkIhdr extends PngChunk { interlaceMethod = InterlaceMethod.values()[method]; } + /** + * Gets the bit depth. + * + * @return the bit depth. + */ public int getBitDepth() { return bitDepth; } + /** + * Gets the compression method. + * + * @return the compression method. + */ public int getCompressionMethod() { return compressionMethod; } + /** + * Gets the filter method. + * + * @return the filter method. + */ public int getFilterMethod() { return filterMethod; } + /** + * Gets the image height. + * + * @return the height. + */ public int getHeight() { return height; } + /** + * Gets the interlace method. + * + * @return the interlace method. + */ public InterlaceMethod getInterlaceMethod() { return interlaceMethod; } + /** + * Gets the PNG color type. + * + * @return the PNG color type. + */ public PngColorType getPngColorType() { return pngColorType; } + /** + * Gets the image width. + * + * @return the width. + */ public int getWidth() { return width; } diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java index e262abfe..aedba79f 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java @@ -28,6 +28,9 @@ import org.apache.commons.imaging.formats.png.AbstractPngText; import org.apache.commons.imaging.formats.png.PngConstants; import org.apache.commons.io.IOUtils; +/** + * PNG iTXt chunk with international textual data. + */ public final class PngChunkItxt extends AbstractPngTextChunk { private final String keyword; @@ -115,6 +118,11 @@ public final class PngChunkItxt extends AbstractPngTextChunk { return text; } + /** + * Gets the translated keyword. + * + * @return the translated keyword. + */ public String getTranslatedKeyword() { return translatedKeyword; } diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java index 98e74a2c..810f3f6a 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java @@ -22,12 +22,24 @@ import static org.apache.commons.imaging.common.BinaryFunctions.readByte; import java.io.ByteArrayInputStream; import java.io.IOException; +/** + * PNG pHYs chunk with physical pixel dimensions. + */ public final class PngChunkPhys extends PngChunk { private final int pixelsPerUnitXAxis; private final int pixelsPerUnitYAxis; private final int unitSpecifier; + /** + * Constructs a PNG pHYs chunk. + * + * @param length the chunk length. + * @param chunkType the chunk type. + * @param crc the CRC. + * @param bytes the chunk bytes. + * @throws IOException if an I/O error occurs. + */ public PngChunkPhys(final int length, final int chunkType, final int crc, final byte[] bytes) throws IOException { super(length, chunkType, crc, bytes); final ByteArrayInputStream is = new ByteArrayInputStream(bytes); @@ -36,14 +48,29 @@ public final class PngChunkPhys extends PngChunk { unitSpecifier = readByte("Unit specifier", is, "Not a Valid PNG File: pHYs Corrupt"); } + /** + * Gets the pixels per unit on the X axis. + * + * @return pixels per unit on the X axis. + */ public int getPixelsPerUnitXAxis() { return pixelsPerUnitXAxis; } + /** + * Gets the pixels per unit on the Y axis. + * + * @return pixels per unit on the Y axis. + */ public int getPixelsPerUnitYAxis() { return pixelsPerUnitYAxis; } + /** + * Gets the unit specifier (0 = unknown, 1 = meter). + * + * @return the unit specifier. + */ public int getUnitSpecifier() { return unitSpecifier; } diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java index afcf5e35..8312d74a 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java @@ -26,9 +26,22 @@ import org.apache.commons.imaging.ImagingException; import org.apache.commons.imaging.common.Allocator; import org.apache.commons.imaging.formats.png.GammaCorrection; +/** + * PNG PLTE chunk with palette. + */ public final class PngChunkPlte extends PngChunk { private final int[] rgb; + /** + * Constructs a PNG PLTE chunk. + * + * @param length the chunk length. + * @param chunkType the chunk type. + * @param crc the CRC. + * @param bytes the chunk bytes. + * @throws ImagingException if the chunk is corrupt. + * @throws IOException if an I/O error occurs. + */ public PngChunkPlte(final int length, final int chunkType, final int crc, final byte[] bytes) throws ImagingException, IOException { super(length, chunkType, crc, bytes); @@ -50,10 +63,20 @@ public final class PngChunkPlte extends PngChunk { } } + /** + * Applies gamma correction to the palette. + * + * @param gammaCorrection the gamma correction to apply. + */ public void correct(final GammaCorrection gammaCorrection) { Arrays.setAll(rgb, i -> gammaCorrection.correctArgb(rgb[i])); } + /** + * Gets a copy of the RGB palette. + * + * @return the RGB palette. + */ public int[] getRgb() { return rgb.clone(); } @@ -69,6 +92,13 @@ public final class PngChunkPlte extends PngChunk { // Debug.debug(); // } + /** + * Gets the RGB value at the specified palette index. + * + * @param index the palette index. + * @return the RGB value. + * @throws ImagingException if the index is out of bounds. + */ public int getRgb(final int index) throws ImagingException { if (index < 0 || index >= rgb.length) { throw new ImagingException("PNG: unknown Palette reference: " + index); diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java index c4ad802d..da7c2b59 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java @@ -21,12 +21,24 @@ import java.nio.charset.StandardCharsets; import org.apache.commons.imaging.ImagingException; import org.apache.commons.imaging.common.BinaryFunctions; +/** + * PNG sCAL chunk with physical scale of image subjects. + */ public final class PngChunkScal extends PngChunk { private final double unitsPerPixelXAxis; private final double unitsPerPixelYAxis; private final int unitSpecifier; + /** + * Constructs a PNG sCAL chunk. + * + * @param length the chunk length. + * @param chunkType the chunk type. + * @param crc the CRC. + * @param bytes the chunk bytes. + * @throws ImagingException if the chunk is corrupt. + */ public PngChunkScal(final int length, final int chunkType, final int crc, final byte[] bytes) throws ImagingException { super(length, chunkType, crc, bytes); @@ -49,14 +61,29 @@ public final class PngChunkScal extends PngChunk { unitsPerPixelYAxis = toDouble(yStr); } + /** + * Gets the unit specifier (1 = meter, 2 = radian). + * + * @return the unit specifier. + */ public int getUnitSpecifier() { return unitSpecifier; } + /** + * Gets the units per pixel on the X axis. + * + * @return units per pixel on the X axis. + */ public double getUnitsPerPixelXAxis() { return unitsPerPixelXAxis; } + /** + * Gets the units per pixel on the Y axis. + * + * @return units per pixel on the Y axis. + */ public double getUnitsPerPixelYAxis() { return unitsPerPixelYAxis; } diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkText.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkText.java index 49aa52e6..813074bb 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkText.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkText.java @@ -24,6 +24,9 @@ import org.apache.commons.imaging.ImagingException; import org.apache.commons.imaging.common.BinaryFunctions; import org.apache.commons.imaging.formats.png.AbstractPngText; +/** + * PNG tEXt chunk with textual data. + */ public final class PngChunkText extends AbstractPngTextChunk { private static final Logger LOGGER = Logger.getLogger(PngChunkText.class.getName()); diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkZtxt.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkZtxt.java index 6d15196b..15dfd2a8 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkZtxt.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkZtxt.java @@ -28,11 +28,24 @@ import org.apache.commons.imaging.formats.png.AbstractPngText; import org.apache.commons.imaging.formats.png.PngConstants; import org.apache.commons.io.IOUtils; +/** + * PNG zTXt chunk with compressed textual data. + */ public final class PngChunkZtxt extends AbstractPngTextChunk { private final String keyword; private final String text; + /** + * Constructs a PNG zTXt chunk. + * + * @param length the chunk length. + * @param chunkType the chunk type. + * @param crc the CRC. + * @param bytes the chunk bytes. + * @throws ImagingException if the chunk is corrupt. + * @throws IOException if an I/O error occurs. + */ public PngChunkZtxt(final int length, final int chunkType, final int crc, final byte[] bytes) throws ImagingException, IOException { super(length, chunkType, crc, bytes);
