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 3a340ca23ad47023323d46c528de7a42b841dcdc Author: Gary Gregory <[email protected]> AuthorDate: Sat Jan 3 11:44:49 2026 -0500 Javadoc --- .../imaging/formats/png/GammaCorrection.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/org/apache/commons/imaging/formats/png/GammaCorrection.java b/src/main/java/org/apache/commons/imaging/formats/png/GammaCorrection.java index 843b81b3..8766e49b 100644 --- a/src/main/java/org/apache/commons/imaging/formats/png/GammaCorrection.java +++ b/src/main/java/org/apache/commons/imaging/formats/png/GammaCorrection.java @@ -19,12 +19,21 @@ package org.apache.commons.imaging.formats.png; import java.util.logging.Level; import java.util.logging.Logger; +/** + * Handles gamma correction for PNG images. + */ public class GammaCorrection { private static final Logger LOGGER = Logger.getLogger(GammaCorrection.class.getName()); private final int[] lookupTable; + /** + * Constructs a gamma correction with the specified source and destination gamma values. + * + * @param srcGamma the source gamma value. + * @param dstGamma the destination gamma value. + */ public GammaCorrection(final double srcGamma, final double dstGamma) { if (LOGGER.isLoggable(Level.FINEST)) { @@ -41,6 +50,12 @@ public class GammaCorrection { } } + /** + * Corrects an ARGB pixel value for gamma. + * + * @param pixel the ARGB pixel value. + * @return the gamma-corrected pixel value. + */ public int correctArgb(final int pixel) { final int alpha = 0xff000000 & pixel; int red = pixel >> 16 & 0xff; @@ -54,6 +69,12 @@ public class GammaCorrection { return alpha | (0xff & red) << 16 | (0xff & green) << 8 | (0xff & blue) << 0; } + /** + * Corrects a sample value using the lookup table. + * + * @param sample the sample value. + * @return the corrected sample value. + */ public int correctSample(final int sample) { return lookupTable[sample]; }
