You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/07/04 15:16:20 UTC

[commons-imaging] branch master updated (5688840c -> 4592191a)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git


    from 5688840c Use Java naming conventions
     new 5747277f Use Java naming conventions
     new 68d7954e Use Java naming conventions
     new f00e0984 Use Java naming conventions
     new a19e7605 Use Java naming conventions
     new b6785cd7 Use Java naming conventions
     new baaa2e08 Use Java naming conventions
     new 4592191a Use Java naming conventions

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../commons/imaging/color/ColorConversions.java    |  8 +--
 .../imaging/formats/jpeg/decoder/JpegDecoder.java  | 26 +++++-----
 .../formats/jpeg/decoder/YCbCrConverter.java       | 42 +++++++--------
 .../imaging/formats/psd/PsdImageContents.java      | 36 ++++++-------
 .../imaging/formats/psd/PsdImageParser.java        | 60 +++++++++++-----------
 .../PhotometricInterpreterYCbCr.java               | 30 +++++------
 .../tiff/write/TiffImageWriterLossless.java        |  4 +-
 7 files changed, 103 insertions(+), 103 deletions(-)


[commons-imaging] 05/07: Use Java naming conventions

Posted by gg...@apache.org.
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 b6785cd7ec3847912f3606d60c1f22d4860fc969
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 4 11:12:33 2023 -0400

    Use Java naming conventions
---
 .../imaging/formats/psd/PsdImageContents.java      | 36 +++++++++++-----------
 .../imaging/formats/psd/PsdImageParser.java        |  8 ++---
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageContents.java b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageContents.java
index a4838a72..eb5b8919 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageContents.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageContents.java
@@ -28,20 +28,20 @@ public class PsdImageContents {
 
     public final PsdHeaderInfo header;
 
-    public final int ColorModeDataLength;
-    public final int ImageResourcesLength;
-    public final int LayerAndMaskDataLength;
-    public final int Compression;
+    public final int colorModeDataLength;
+    public final int imageResourcesLength;
+    public final int layerAndMaskDataLength;
+    public final int compression;
 
     public PsdImageContents(final PsdHeaderInfo header,
 
-    final int ColorModeDataLength, final int ImageResourcesLength,
-            final int LayerAndMaskDataLength, final int Compression) {
+    final int colorModeDataLength, final int imageResourcesLength,
+            final int layerAndMaskDataLength, final int compression) {
         this.header = header;
-        this.ColorModeDataLength = ColorModeDataLength;
-        this.ImageResourcesLength = ImageResourcesLength;
-        this.LayerAndMaskDataLength = LayerAndMaskDataLength;
-        this.Compression = Compression;
+        this.colorModeDataLength = colorModeDataLength;
+        this.imageResourcesLength = imageResourcesLength;
+        this.layerAndMaskDataLength = layerAndMaskDataLength;
+        this.compression = compression;
     }
 
     public void dump() {
@@ -58,14 +58,14 @@ public class PsdImageContents {
     public void dump(final PrintWriter pw) {
         pw.println("");
         pw.println("ImageContents");
-        pw.println("Compression: " + Compression + " ("
-                + Integer.toHexString(Compression) + ")");
-        pw.println("ColorModeDataLength: " + ColorModeDataLength + " ("
-                + Integer.toHexString(ColorModeDataLength) + ")");
-        pw.println("ImageResourcesLength: " + ImageResourcesLength + " ("
-                + Integer.toHexString(ImageResourcesLength) + ")");
-        pw.println("LayerAndMaskDataLength: " + LayerAndMaskDataLength + " ("
-                + Integer.toHexString(LayerAndMaskDataLength) + ")");
+        pw.println("Compression: " + compression + " ("
+                + Integer.toHexString(compression) + ")");
+        pw.println("ColorModeDataLength: " + colorModeDataLength + " ("
+                + Integer.toHexString(colorModeDataLength) + ")");
+        pw.println("ImageResourcesLength: " + imageResourcesLength + " ("
+                + Integer.toHexString(imageResourcesLength) + ")");
+        pw.println("LayerAndMaskDataLength: " + layerAndMaskDataLength + " ("
+                + Integer.toHexString(layerAndMaskDataLength) + ")");
         // System.out.println("Depth: " + Depth + " ("
         // + Integer.toHexString(Depth) + ")");
         // System.out.println("Mode: " + Mode + " (" + Integer.toHexString(Mode)
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 4a8c86eb..2af6e9e7 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
@@ -201,7 +201,7 @@ public class PsdImageParser extends ImageParser<PsdImagingParameters> implements
                     + imageContents.header.mode);
         }
         DataReader fDataReader;
-        switch (imageContents.Compression) {
+        switch (imageContents.compression) {
         case 0:
             fDataReader = new UncompressedDataReader(dataParser);
             break;
@@ -210,7 +210,7 @@ public class PsdImageParser extends ImageParser<PsdImagingParameters> implements
             break;
         default:
             throw new ImagingException("Unknown Compression: "
-                    + imageContents.Compression);
+                    + imageContents.compression);
         }
 
         try (InputStream is = getInputStream(byteSource, PSD_SECTION_IMAGE_DATA)) {
@@ -382,7 +382,7 @@ public class PsdImageParser extends ImageParser<PsdImagingParameters> implements
         final ImageInfo.ColorType colorType = ImageInfo.ColorType.UNKNOWN;
 
         ImageInfo.CompressionAlgorithm compressionAlgorithm;
-        switch (imageContents.Compression) {
+        switch (imageContents.compression) {
         case 0:
             compressionAlgorithm = ImageInfo.CompressionAlgorithm.NONE;
             break;
@@ -637,7 +637,7 @@ public class PsdImageParser extends ImageParser<PsdImagingParameters> implements
             final PsdImageContents imageContents = readImageContents(imageStream);
 
             final byte[] ImageResources = readBytes("ImageResources",
-                    resourceStream, imageContents.ImageResourcesLength,
+                    resourceStream, imageContents.imageResourcesLength,
                     "Not a Valid PSD File");
 
             return readImageResourceBlocks(ImageResources, imageResourceIDs,


[commons-imaging] 03/07: Use Java naming conventions

Posted by gg...@apache.org.
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 f00e0984c88fc329822fd7c245de7ef351bac226
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 4 11:09:26 2023 -0400

    Use Java naming conventions
---
 .../imaging/formats/jpeg/decoder/JpegDecoder.java  | 26 +++++++++++-----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
index 73315c0e..4520bace 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
@@ -500,23 +500,23 @@ public class JpegDecoder extends BinaryFileParser implements JpegUtils.Visitor {
                         for (int x2 = 0; x2 < hSize
                                 && x1 + x2 < sofnSegment.width; x2++) {
                             if (scaledMCU.length == 4) {
-                                final int C = scaledMCU[0].samples[srcRowOffset + x2];
-                                final int M = scaledMCU[1].samples[srcRowOffset + x2];
-                                final int Y = scaledMCU[2].samples[srcRowOffset + x2];
-                                final int K = scaledMCU[3].samples[srcRowOffset + x2];
-                                final int rgb = ColorConversions.convertCmykToRgb(C, M, Y, K);
+                                final int c = scaledMCU[0].samples[srcRowOffset + x2];
+                                final int m = scaledMCU[1].samples[srcRowOffset + x2];
+                                final int y = scaledMCU[2].samples[srcRowOffset + x2];
+                                final int k = scaledMCU[3].samples[srcRowOffset + x2];
+                                final int rgb = ColorConversions.convertCmykToRgb(c, m, y, k);
                                 dataBuffer.setElem(dstRowOffset + x2, rgb);
                             } else if (scaledMCU.length == 3) {
-                                final int Y = scaledMCU[0].samples[srcRowOffset + x2];
-                                final int Cb = scaledMCU[1].samples[srcRowOffset + x2];
-                                final int Cr = scaledMCU[2].samples[srcRowOffset + x2];
-                                final int rgb = YCbCrConverter.convertYCbCrToRGB(Y,
-                                        Cb, Cr);
+                                final int y = scaledMCU[0].samples[srcRowOffset + x2];
+                                final int cb = scaledMCU[1].samples[srcRowOffset + x2];
+                                final int cr = scaledMCU[2].samples[srcRowOffset + x2];
+                                final int rgb = YCbCrConverter.convertYCbCrToRGB(y,
+                                        cb, cr);
                                 dataBuffer.setElem(dstRowOffset + x2, rgb);
                             } else if (mcu.length == 1) {
-                                final int Y = scaledMCU[0].samples[srcRowOffset + x2];
-                                dataBuffer.setElem(dstRowOffset + x2, (Y << 16)
-                                        | (Y << 8) | Y);
+                                final int y = scaledMCU[0].samples[srcRowOffset + x2];
+                                dataBuffer.setElem(dstRowOffset + x2, (y << 16)
+                                        | (y << 8) | y);
                             } else {
                                 throw new ImagingException(
                                         "Unsupported JPEG with " + mcu.length


[commons-imaging] 06/07: Use Java naming conventions

Posted by gg...@apache.org.
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 baaa2e083f2ffc4c08888e45ae188c63071c7502
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 4 11:13:52 2023 -0400

    Use Java naming conventions
---
 .../imaging/formats/psd/PsdImageParser.java        | 52 +++++++++++-----------
 1 file changed, 26 insertions(+), 26 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 2af6e9e7..22c44786 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
@@ -259,39 +259,39 @@ public class PsdImageParser extends ImageParser<PsdImagingParameters> implements
             }
             skipBytes(is, PSD_HEADER_LENGTH);
 
-            final int ColorModeDataLength = read4Bytes("ColorModeDataLength", is,
+            final int colorModeDataLength = read4Bytes("ColorModeDataLength", is,
                     "Not a Valid PSD File", getByteOrder());
 
             if (section == PSD_SECTION_COLOR_MODE) {
-                return readBytes("ColorModeData", is, ColorModeDataLength,
+                return readBytes("ColorModeData", is, colorModeDataLength,
                         "Not a Valid PSD File");
             }
 
-            skipBytes(is, ColorModeDataLength);
+            skipBytes(is, colorModeDataLength);
             // byte ColorModeData[] = readByteArray("ColorModeData",
             // ColorModeDataLength, is, "Not a Valid PSD File");
 
-            final int ImageResourcesLength = read4Bytes("ImageResourcesLength", is,
+            final int imageResourcesLength = read4Bytes("ImageResourcesLength", is,
                     "Not a Valid PSD File", getByteOrder());
 
             if (section == PSD_SECTION_IMAGE_RESOURCES) {
                 return readBytes("ImageResources", is,
-                        ImageResourcesLength, "Not a Valid PSD File");
+                        imageResourcesLength, "Not a Valid PSD File");
             }
 
-            skipBytes(is, ImageResourcesLength);
+            skipBytes(is, imageResourcesLength);
             // byte ImageResources[] = readByteArray("ImageResources",
             // ImageResourcesLength, is, "Not a Valid PSD File");
 
-            final int LayerAndMaskDataLength = read4Bytes("LayerAndMaskDataLength",
+            final int layerAndMaskDataLength = read4Bytes("LayerAndMaskDataLength",
                     is, "Not a Valid PSD File", getByteOrder());
 
             if (section == PSD_SECTION_LAYER_AND_MASK_DATA) {
                 return readBytes("LayerAndMaskData",
-                        is, LayerAndMaskDataLength, "Not a Valid PSD File");
+                        is, layerAndMaskDataLength, "Not a Valid PSD File");
             }
 
-            skipBytes(is, LayerAndMaskDataLength);
+            skipBytes(is, layerAndMaskDataLength);
             // byte LayerAndMaskData[] = readByteArray("LayerAndMaskData",
             // LayerAndMaskDataLength, is, "Not a Valid PSD File");
 
@@ -354,13 +354,13 @@ public class PsdImageParser extends ImageParser<PsdImagingParameters> implements
         final List<String> comments = new ArrayList<>();
         // TODO: comments...
 
-        int BitsPerPixel = header.depth * getChannelsPerMode(header.mode);
+        int bitsPerPixel = header.depth * getChannelsPerMode(header.mode);
         // System.out.println("header.Depth: " + header.Depth);
         // System.out.println("header.Mode: " + header.Mode);
         // System.out.println("getChannelsPerMode(header.Mode): " +
         // getChannelsPerMode(header.Mode));
-        if (BitsPerPixel < 0) {
-            BitsPerPixel = 0;
+        if (bitsPerPixel < 0) {
+            bitsPerPixel = 0;
         }
         final ImageFormat format = ImageFormats.PSD;
         final String formatName = "Photoshop";
@@ -393,7 +393,7 @@ public class PsdImageParser extends ImageParser<PsdImagingParameters> implements
             compressionAlgorithm = ImageInfo.CompressionAlgorithm.UNKNOWN;
         }
 
-        return new ImageInfo(formatDetails, BitsPerPixel, comments,
+        return new ImageInfo(formatDetails, bitsPerPixel, comments,
                 format, formatName, height, mimeType, numberOfImages,
                 physicalHeightDpi, physicalHeightInch, physicalWidthDpi,
                 physicalWidthInch, width, progressive, transparent,
@@ -537,13 +537,13 @@ public class PsdImageParser extends ImageParser<PsdImagingParameters> implements
         return new String(block.data, 0, block.data.length, StandardCharsets.UTF_8);
     }
 
-    private boolean keepImageResourceBlock(final int ID, final int[] imageResourceIDs) {
+    private boolean keepImageResourceBlock(final int id, final int[] imageResourceIDs) {
         if (imageResourceIDs == null) {
             return true;
         }
 
         for (final int imageResourceID : imageResourceIDs) {
-            if (ID == imageResourceID) {
+            if (id == imageResourceID) {
                 return true;
             }
         }
@@ -583,28 +583,28 @@ public class PsdImageParser extends ImageParser<PsdImagingParameters> implements
             throws ImagingException, IOException {
         final PsdHeaderInfo header = readHeader(is);
 
-        final int ColorModeDataLength = read4Bytes("ColorModeDataLength", is,
+        final int colorModeDataLength = read4Bytes("ColorModeDataLength", is,
                 "Not a Valid PSD File", getByteOrder());
-        skipBytes(is, ColorModeDataLength);
+        skipBytes(is, colorModeDataLength);
         // is.skip(ColorModeDataLength);
         // byte ColorModeData[] = readByteArray("ColorModeData",
         // ColorModeDataLength, is, "Not a Valid PSD File");
 
-        final int ImageResourcesLength = read4Bytes("ImageResourcesLength", is,
+        final int imageResourcesLength = read4Bytes("ImageResourcesLength", is,
                 "Not a Valid PSD File", getByteOrder());
-        skipBytes(is, ImageResourcesLength);
+        skipBytes(is, imageResourcesLength);
         // long skipped = is.skip(ImageResourcesLength);
         // byte ImageResources[] = readByteArray("ImageResources",
         // ImageResourcesLength, is, "Not a Valid PSD File");
 
-        final int LayerAndMaskDataLength = read4Bytes("LayerAndMaskDataLength", is,
+        final int layerAndMaskDataLength = read4Bytes("LayerAndMaskDataLength", is,
                 "Not a Valid PSD File", getByteOrder());
-        skipBytes(is, LayerAndMaskDataLength);
+        skipBytes(is, layerAndMaskDataLength);
         // is.skip(LayerAndMaskDataLength);
         // byte LayerAndMaskData[] = readByteArray("LayerAndMaskData",
         // LayerAndMaskDataLength, is, "Not a Valid PSD File");
 
-        final int Compression = read2Bytes("Compression", is, "Not a Valid PSD File", getByteOrder());
+        final int compression = read2Bytes("Compression", is, "Not a Valid PSD File", getByteOrder());
 
         // skip_bytes(is, LayerAndMaskDataLength);
         // byte ImageData[] = readByteArray("ImageData", LayerAndMaskDataLength,
@@ -612,13 +612,13 @@ public class PsdImageParser extends ImageParser<PsdImagingParameters> implements
 
         // System.out.println("Compression: " + Compression);
 
-        return new PsdImageContents(header, ColorModeDataLength,
+        return new PsdImageContents(header, colorModeDataLength,
         // ColorModeData,
-                ImageResourcesLength,
+                imageResourcesLength,
                 // ImageResources,
-                LayerAndMaskDataLength,
+                layerAndMaskDataLength,
                 // LayerAndMaskData,
-                Compression);
+                compression);
     }
 
     private List<ImageResourceBlock> readImageResourceBlocks(final byte[] bytes,


[commons-imaging] 04/07: Use Java naming conventions

Posted by gg...@apache.org.
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 a19e760549a26168fce5a87e0931d6c694825635
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 4 11:10:49 2023 -0400

    Use Java naming conventions
---
 .../formats/jpeg/decoder/YCbCrConverter.java       | 42 +++++++++++-----------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java
index 60639e44..7c98bb00 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java
@@ -28,28 +28,28 @@ final class YCbCrConverter {
          * itself between adjacent pixels, so using it as the high order byte
          * gives higher locality of reference.
          */
-        for (int Y = 0; Y < 256; Y++) {
-            for (int Cr = 0; Cr < 256; Cr++) {
-                int r = Y + fastRound(1.402f * (Cr - 128));
+        for (int y = 0; y < 256; y++) {
+            for (int cr = 0; cr < 256; cr++) {
+                int r = y + fastRound(1.402f * (cr - 128));
                 if (r < 0) {
                     r = 0;
                 }
                 if (r > 255) {
                     r = 255;
                 }
-                REDS[(Cr << 8) | Y] = r << 16;
+                REDS[(cr << 8) | y] = r << 16;
             }
         }
-        for (int Y = 0; Y < 256; Y++) {
-            for (int Cb = 0; Cb < 256; Cb++) {
-                int b = Y + fastRound(1.772f * (Cb - 128));
+        for (int y = 0; y < 256; y++) {
+            for (int cb = 0; cb < 256; cb++) {
+                int b = y + fastRound(1.772f * (cb - 128));
                 if (b < 0) {
                     b = 0;
                 }
                 if (b > 255) {
                     b = 255;
                 }
-                BLUES[(Cb << 8) | Y] = b;
+                BLUES[(cb << 8) | y] = b;
             }
         }
         // green is the hardest
@@ -79,31 +79,31 @@ final class YCbCrConverter {
         // 0 134
         // thus the range is [-134,390] and has 524 values
         // but is clamped to [0, 255]
-        for (int Cb = 0; Cb < 256; Cb++) {
-            for (int Cr = 0; Cr < 256; Cr++) {
-                final int value = fastRound(0.34414f * (Cb - 128) + 0.71414f
-                        * (Cr - 128));
-                GREENS1[(Cb << 8) | Cr] = value + 135;
+        for (int cb = 0; cb < 256; cb++) {
+            for (int cr = 0; cr < 256; cr++) {
+                final int value = fastRound(0.34414f * (cb - 128) + 0.71414f
+                        * (cr - 128));
+                GREENS1[(cb << 8) | cr] = value + 135;
             }
         }
-        for (int Y = 0; Y < 256; Y++) {
+        for (int y = 0; y < 256; y++) {
             for (int value = 0; value < 270; value++) {
-                int green = Y - (value - 135);
+                int green = y - (value - 135);
                 if (green < 0) {
                     green = 0;
                 } else if (green > 255) {
                     green = 255;
                 }
-                GREENS2[(value << 8) | Y] = green << 8;
+                GREENS2[(value << 8) | y] = green << 8;
             }
         }
     }
 
-    public static int convertYCbCrToRGB(final int Y, final int Cb, final int Cr) {
-        final int r = REDS[(Cr << 8) | Y];
-        final int g1 = GREENS1[(Cb << 8) | Cr];
-        final int g = GREENS2[(g1 << 8) | Y];
-        final int b = BLUES[(Cb << 8) | Y];
+    public static int convertYCbCrToRGB(final int y, final int cb, final int cr) {
+        final int r = REDS[(cr << 8) | y];
+        final int g1 = GREENS1[(cb << 8) | cr];
+        final int g = GREENS2[(g1 << 8) | y];
+        final int b = BLUES[(cb << 8) | y];
         return r | g | b;
     }
 


[commons-imaging] 07/07: Use Java naming conventions

Posted by gg...@apache.org.
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 4592191afb4ca397f580f4d6d5385baff5a44f29
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 4 11:14:47 2023 -0400

    Use Java naming conventions
---
 .../commons/imaging/formats/tiff/write/TiffImageWriterLossless.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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 b7e59983..f4db5595 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
@@ -130,14 +130,14 @@ public class TiffImageWriterLossless extends TiffImageWriterBase {
             elements.sort(TiffElement.COMPARATOR);
 
             final List<TiffElement> rewritableElements = new ArrayList<>();
-            final int TOLERANCE = 3;
+            final int tolerance = 3;
             TiffElement start = null;
             long index = -1;
             for (final TiffElement element : elements) {
                 final long lastElementByte = element.offset + element.length;
                 if (start == null) {
                     start = element;
-                } else if (element.offset - index > TOLERANCE) {
+                } else if (element.offset - index > tolerance) {
                     rewritableElements.add(new TiffElement.Stub(start.offset,
                             (int) (index - start.offset)));
                     start = element;


[commons-imaging] 01/07: Use Java naming conventions

Posted by gg...@apache.org.
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 5747277fbc8056cf9e9e64bf49387823c69dc0d1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 4 11:05:58 2023 -0400

    Use Java naming conventions
---
 .../java/org/apache/commons/imaging/color/ColorConversions.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/imaging/color/ColorConversions.java b/src/main/java/org/apache/commons/imaging/color/ColorConversions.java
index e12ee316..ad5ff941 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorConversions.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorConversions.java
@@ -788,10 +788,10 @@ public final class ColorConversions {
         varG = pivotRgb(varG);
         varB = pivotRgb(varB);
 
-        final double R = (varR * 255);
-        final double G = (varG * 255);
-        final double B = (varB * 255);
-        return convertRgbToRgb(R, G, B);
+        final double r = (varR * 255);
+        final double g = (varG * 255);
+        final double b = (varB * 255);
+        return convertRgbToRgb(r, g, b);
     }
 
     public static double degree2radian(final double degree) {


[commons-imaging] 02/07: Use Java naming conventions

Posted by gg...@apache.org.
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 68d7954e7857c84a9adafe42150c9ca2c7684d97
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 4 11:07:34 2023 -0400

    Use Java naming conventions
---
 .../PhotometricInterpreterYCbCr.java               | 30 +++++++++++-----------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java
index 69bad7bb..aab5059d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java
@@ -32,18 +32,18 @@ public class PhotometricInterpreterYCbCr extends PhotometricInterpreter {
      * the case of a null constructor, or they are automatically calculated from
      * the image parameter constructor.
      *
-     * @param Y
+     * @param y
      *            The Y component set.
-     * @param Cb
+     * @param cb
      *            The Cb component set.
-     * @param Cr
+     * @param cr
      *            The Cr component set.
      * @return R The R component.
      */
-    public static int convertYCbCrtoRGB(final int Y, final int Cb, final int Cr) {
-        final double r1 = (((1.164 * (Y - 16.0))) + (1.596 * (Cr - 128.0)));
-        final double g1 = (((1.164 * (Y - 16.0))) - (0.813 * (Cr - 128.0)) - (0.392 * (Cb - 128.0)));
-        final double b1 = (((1.164 * (Y - 16.0))) + (2.017 * (Cb - 128.0)));
+    public static int convertYCbCrtoRGB(final int y, final int cb, final int cr) {
+        final double r1 = (((1.164 * (y - 16.0))) + (1.596 * (cr - 128.0)));
+        final double g1 = (((1.164 * (y - 16.0))) - (0.813 * (cr - 128.0)) - (0.392 * (cb - 128.0)));
+        final double b1 = (((1.164 * (y - 16.0))) + (2.017 * (cb - 128.0)));
 
         final int r = limit((int) r1, 0, 255);
         final int g = limit((int) g1, 0, 255);
@@ -67,15 +67,15 @@ public class PhotometricInterpreterYCbCr extends PhotometricInterpreter {
     public void interpretPixel(final ImageBuilder imageBuilder, final int[] samples, final int x,
             final int y) throws ImagingException, IOException {
         final int Y = samples[0];
-        final int Cb = samples[1];
-        final int Cr = samples[2];
-        final double R = Y + 1.402 * (Cr - 128.0);
-        final double G = Y - 0.34414 * (Cb - 128.0) - 0.71414 * (Cr - 128.0);
-        final double B = Y + 1.772 * (Cb - 128.0);
+        final int cb = samples[1];
+        final int cr = samples[2];
+        final double r = Y + 1.402 * (cr - 128.0);
+        final double g = Y - 0.34414 * (cb - 128.0) - 0.71414 * (cr - 128.0);
+        final double b = Y + 1.772 * (cb - 128.0);
 
-        final int red = limit((int) R, 0, 255);
-        final int green = limit((int) G, 0, 255);
-        final int blue = limit((int) B, 0, 255);
+        final int red = limit((int) r, 0, 255);
+        final int green = limit((int) g, 0, 255);
+        final int blue = limit((int) b, 0, 255);
 
         final int alpha = 0xff;
         final int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);