From 2d7f260d19b399c57e6610dfb97deac62954f8aa Mon Sep 17 00:00:00 2001 From: obo Date: Wed, 6 Sep 2023 14:33:00 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-103847=20=E4=BC=98=E5=8C=96=E8=A1=A5?= =?UTF-8?q?=E5=85=85=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/third/com/lowagie/text/Image.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fine-itext-old/src/main/java/com/fr/third/com/lowagie/text/Image.java b/fine-itext-old/src/main/java/com/fr/third/com/lowagie/text/Image.java index 515160b54..4e534db31 100644 --- a/fine-itext-old/src/main/java/com/fr/third/com/lowagie/text/Image.java +++ b/fine-itext-old/src/main/java/com/fr/third/com/lowagie/text/Image.java @@ -753,10 +753,6 @@ public abstract class Image extends Rectangle { } else if (transparency == null) { if (alpha == 0) { transparentPixel = pixels[j] & 0xffffff; - transparency = new int[6]; - transparency[0] = transparency[1] = (transparentPixel >> 16) & 0xff; - transparency[2] = transparency[3] = (transparentPixel >> 8) & 0xff; - transparency[4] = transparency[5] = transparentPixel & 0xff; // Added by Michael Klink // Check whether this value for transparent pixels // has already been used for a non-transparent one @@ -768,10 +764,15 @@ public abstract class Image extends Rectangle { // for transparency; we could still use an image // mask but for simplicity let's use a soft mask // which already is implemented here + // stackOverFlow:https://stackoverflow.com/questions/39119776/itext-binary-transparency-bug shades = true; break; } } + transparency = new int[6]; + transparency[0] = transparency[1] = (transparentPixel >> 16) & 0xff; + transparency[2] = transparency[3] = (transparentPixel >> 8) & 0xff; + transparency[4] = transparency[5] = transparentPixel & 0xff; } } else if (((pixels[j] & 0xffffff) != transparentPixel) && (alpha == 0)) { shades = true;