"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java" between
pdfbox-2.0.23-src.zip and pdfbox-2.0.24-src.zip

About: Apache PDFBox is a Java PDF library tool that allows creation of new PDF documents, manipulation of existing documents and the ability to extract content from documents.

PNGConverter.java  (pdfbox-2.0.23-src):PNGConverter.java  (pdfbox-2.0.24-src)
skipping to change at line 241 skipping to change at line 241
PDImageXObject image = buildImageObject(doc, state); PDImageXObject image = buildImageObject(doc, state);
if (image == null) if (image == null)
{ {
return null; return null;
} }
int highVal = (plte.length / 3) - 1; int highVal = (plte.length / 3) - 1;
if (highVal > 255) if (highVal > 255)
{ {
LOG.error(String.format("To much colors in PLTE, only 256 allowed, f ound %d colors.", LOG.error(String.format("Too much colors in PLTE, only 256 allowed, found %d colors.",
highVal + 1)); highVal + 1));
return null; return null;
} }
setupIndexedColorSpace(doc, plte, image, highVal); setupIndexedColorSpace(doc, plte, image, highVal);
if (state.tRNS != null) if (state.tRNS != null)
{ {
image.getCOSObject().setItem(COSName.SMASK, image.getCOSObject().setItem(COSName.SMASK,
buildTransparencyMaskFromIndexedData(doc, image, state)); buildTransparencyMaskFromIndexedData(doc, image, state));
skipping to change at line 282 skipping to change at line 282
new ByteArrayInputStream(decodedIDAT)); new ByteArrayInputStream(decodedIDAT));
try try
{ {
int bitsPerComponent = state.bitsPerComponent; int bitsPerComponent = state.bitsPerComponent;
int w = 0; int w = 0;
int neededBits = bitsPerComponent * state.width; int neededBits = bitsPerComponent * state.width;
int bitPadding = neededBits % 8; int bitPadding = neededBits % 8;
for (int i = 0; i < bytes.length; i++) for (int i = 0; i < bytes.length; i++)
{ {
int idx = (int) iis.readBits(bitsPerComponent); int idx = (int) iis.readBits(bitsPerComponent);
byte v;
if (idx < transparencyTable.length) if (idx < transparencyTable.length)
{ {
// Inside the table, use the transparency value // Inside the table, use the transparency value
v = transparencyTable[idx]; bytes[i] = transparencyTable[idx];
} }
else else
{ {
// Outside the table -> transparent value is 0xFF here. // Outside the table -> transparent value is 0xFF here.
v = (byte) 0xFF; bytes[i] = (byte) 0xFF;
} }
bytes[i] = v;
w++; w++;
if (w == state.width) if (w == state.width)
{ {
w = 0; w = 0;
iis.readBits(bitPadding); iis.readBits(bitPadding);
} }
} }
} }
finally finally
{ {
 End of changes. 5 change blocks. 
5 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)