private static class LosslessFactory.PredictorEncoder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) byte[] |
alphaImageData |
(package private) byte[] |
aValues |
(package private) byte[] |
bValues |
private int |
bytesPerComponent |
private int |
bytesPerPixel |
private int |
componentsPerPixel |
(package private) byte[] |
cValues |
private byte[] |
dataRawRowAverage |
private byte[] |
dataRawRowNone |
private byte[] |
dataRawRowPaeth |
private byte[] |
dataRawRowSub |
private byte[] |
dataRawRowUp |
private PDDocument |
document |
(package private) boolean |
hasAlpha |
private int |
height |
private java.awt.image.BufferedImage |
image |
(package private) int |
imageType |
(package private) byte[] |
tmpResultValues |
private int |
transferType |
private int |
width |
(package private) byte[] |
xValues |
Constructor and Description |
---|
PredictorEncoder(PDDocument document,
java.awt.image.BufferedImage image)
Initialize the encoder and set all final fields
|
Modifier and Type | Method and Description |
---|---|
private byte[] |
chooseDataRowToWrite()
We look which row encoding is the "best" one, ie.
|
private void |
copyImageBytes(byte[] transferRow,
int indexInTranferRow,
byte[] targetValues,
byte[] alphaImageData,
int alphaPtr) |
private void |
copyIntToBytes(int[] transferRow,
int indexInTranferRow,
byte[] targetValues,
byte[] alphaImageData,
int alphaPtr) |
private static void |
copyShortsToBytes(short[] transferRow,
int indexInTranferRow,
byte[] targetValues,
byte[] alphaImageData,
int alphaPtr) |
(package private) PDImageXObject |
encode()
Tries to compress the image using a predictor.
|
private static long |
estCompressSum(byte[] dataRawRowSub) |
private static byte |
pngFilterAverage(int x,
int a,
int b) |
private static byte |
pngFilterPaeth(int x,
int a,
int b,
int c) |
private static byte |
pngFilterSub(int x,
int a) |
private static byte |
pngFilterUp(int x,
int b) |
private PDImageXObject |
preparePredictorPDImage(java.io.ByteArrayOutputStream stream,
int bitsPerComponent) |
private final PDDocument document
private final java.awt.image.BufferedImage image
private final int componentsPerPixel
private final int transferType
private final int bytesPerComponent
private final int bytesPerPixel
private final int height
private final int width
private final byte[] dataRawRowNone
private final byte[] dataRawRowSub
private final byte[] dataRawRowUp
private final byte[] dataRawRowAverage
private final byte[] dataRawRowPaeth
final int imageType
final boolean hasAlpha
final byte[] alphaImageData
final byte[] aValues
final byte[] cValues
final byte[] bValues
final byte[] xValues
final byte[] tmpResultValues
PredictorEncoder(PDDocument document, java.awt.image.BufferedImage image)
PDImageXObject encode() throws java.io.IOException
java.io.IOException
private void copyIntToBytes(int[] transferRow, int indexInTranferRow, byte[] targetValues, byte[] alphaImageData, int alphaPtr)
private void copyImageBytes(byte[] transferRow, int indexInTranferRow, byte[] targetValues, byte[] alphaImageData, int alphaPtr)
private static void copyShortsToBytes(short[] transferRow, int indexInTranferRow, byte[] targetValues, byte[] alphaImageData, int alphaPtr)
private PDImageXObject preparePredictorPDImage(java.io.ByteArrayOutputStream stream, int bitsPerComponent) throws java.io.IOException
java.io.IOException
private byte[] chooseDataRowToWrite()
private static byte pngFilterSub(int x, int a)
private static byte pngFilterUp(int x, int b)
private static byte pngFilterAverage(int x, int a, int b)
private static byte pngFilterPaeth(int x, int a, int b, int c)
private static long estCompressSum(byte[] dataRawRowSub)