| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final boolean | USE_PREDICTOR_ENCODER
Internal, only for benchmark purpose |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static PDImageXObject | |
| public static PDImageXObject | Returns: a new image XObjectthe document where the image will be created document, BufferedImage the BufferedImage to embed image)Creates a new lossless encoded image XObject from a BufferedImage. |
| private static PDImageXObject | |
| private static boolean | |
| pack-priv static PDImageXObject | Returns: the newly created PDImageXObject with the data compressed.The document. document, byte[] array with data. byteArray, int the image width width, int the image height height, int the bits per component bitsPerComponent, PDColorSpace the color space initColorSpace)Create a PDImageXObject using the Flate filter. |
| USE_PREDICTOR_ENCODER | back to summary |
|---|---|
| pack-priv static final boolean USE_PREDICTOR_ENCODER Internal, only for benchmark purpose | |
| LosslessFactory | back to summary |
|---|---|
| private LosslessFactory() | |
| createFromGrayImage | back to summary |
|---|---|
| private static PDImageXObject createFromGrayImage(BufferedImage image, PDDocument document) throws IOException | |
| createFromImage | back to summary |
|---|---|
| public static PDImageXObject createFromImage(PDDocument document, BufferedImage image) throws IOException Creates a new lossless encoded image XObject from a BufferedImage.
New for advanced users from 2.0.12 on:
| |
| createFromRGBImage | back to summary |
|---|---|
| private static PDImageXObject createFromRGBImage(BufferedImage image, PDDocument document) throws IOException | |
| isGrayImage | back to summary |
|---|---|
| private static boolean isGrayImage(BufferedImage image) | |
| prepareImageXObject | back to summary |
|---|---|
| pack-priv static PDImageXObject prepareImageXObject(PDDocument document, byte[] byteArray, int width, int height, int bitsPerComponent, PDColorSpace initColorSpace) throws IOException Create a PDImageXObject using the Flate filter.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final byte[] | |
| pack-priv final byte[] | |
| pack-priv final byte[] | |
| private final int | |
| private final int | |
| private final int | |
| pack-priv final byte[] | |
| private final byte[] | |
| private final byte[] | |
| private final byte[] | |
| private final byte[] | |
| private final byte[] | |
| private final PDDocument | |
| pack-priv final boolean | |
| private final int | |
| private final BufferedImage | |
| pack-priv final int | |
| pack-priv final byte[] | |
| private final int | |
| private final int | |
| pack-priv final byte[] |
| Access | Constructor and Description |
|---|---|
| pack-priv | PredictorEncoder(PDDocument document, BufferedImage image)
Initialize the encoder and set all final fields |
| Modifier and Type | Method and Description |
|---|---|
| private byte[] | Returns: the "best" row encoding of the row encodingsWe 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)
|
| pack-priv PDImageXObject | Returns: the image or null if it is not possible to encoded the image (e.g. not supported raster format etc.)Tries to compress the image using a predictor. |
| private static long | |
| private static byte | |
| private static byte | |
| private static byte | |
| private static byte | |
| private PDImageXObject |
| alphaImageData | back to summary |
|---|---|
| pack-priv final byte[] alphaImageData | |
| aValues | back to summary |
|---|---|
| pack-priv final byte[] aValues | |
| bValues | back to summary |
|---|---|
| pack-priv final byte[] bValues | |
| bytesPerComponent | back to summary |
|---|---|
| private final int bytesPerComponent | |
| bytesPerPixel | back to summary |
|---|---|
| private final int bytesPerPixel | |
| componentsPerPixel | back to summary |
|---|---|
| private final int componentsPerPixel | |
| cValues | back to summary |
|---|---|
| pack-priv final byte[] cValues | |
| dataRawRowAverage | back to summary |
|---|---|
| private final byte[] dataRawRowAverage | |
| dataRawRowNone | back to summary |
|---|---|
| private final byte[] dataRawRowNone | |
| dataRawRowPaeth | back to summary |
|---|---|
| private final byte[] dataRawRowPaeth | |
| dataRawRowSub | back to summary |
|---|---|
| private final byte[] dataRawRowSub | |
| dataRawRowUp | back to summary |
|---|---|
| private final byte[] dataRawRowUp | |
| document | back to summary |
|---|---|
| private final PDDocument document | |
| hasAlpha | back to summary |
|---|---|
| pack-priv final boolean hasAlpha | |
| height | back to summary |
|---|---|
| private final int height | |
| image | back to summary |
|---|---|
| private final BufferedImage image | |
| imageType | back to summary |
|---|---|
| pack-priv final int imageType | |
| tmpResultValues | back to summary |
|---|---|
| pack-priv final byte[] tmpResultValues | |
| transferType | back to summary |
|---|---|
| private final int transferType | |
| width | back to summary |
|---|---|
| private final int width | |
| xValues | back to summary |
|---|---|
| pack-priv final byte[] xValues | |
| PredictorEncoder | back to summary |
|---|---|
| pack-priv PredictorEncoder(PDDocument document, BufferedImage image) Initialize the encoder and set all final fields | |
| chooseDataRowToWrite | back to summary |
|---|---|
| private byte[] chooseDataRowToWrite() We look which row encoding is the "best" one, ie. has the lowest sum. We don't implement anything fancier to choose the right row encoding. This is just the recommend algorithm in the spec. The get the perfect encoding you would need to do a brute force check how all the different encoded rows compress in the zip stream together. You have would have to check 5*image-height permutations...
| |
| copyImageBytes | back to summary |
|---|---|
| private void copyImageBytes(byte[] transferRow, int indexInTranferRow, byte[] targetValues, byte[] alphaImageData, int alphaPtr) | |
| copyIntToBytes | back to summary |
|---|---|
| private void copyIntToBytes(int[] transferRow, int indexInTranferRow, byte[] targetValues, byte[] alphaImageData, int alphaPtr) | |
| copyShortsToBytes | back to summary |
|---|---|
| private static void copyShortsToBytes(short[] transferRow, int indexInTranferRow, byte[] targetValues, byte[] alphaImageData, int alphaPtr) | |
| encode | back to summary |
|---|---|
| pack-priv PDImageXObject encode() throws IOException Tries to compress the image using a predictor.
| |
| estCompressSum | back to summary |
|---|---|
| private static long estCompressSum(byte[] dataRawRowSub) | |
| pngFilterAverage | back to summary |
|---|---|
| private static byte pngFilterAverage(int x, int a, int b) | |
| pngFilterPaeth | back to summary |
|---|---|
| private static byte pngFilterPaeth(int x, int a, int b, int c) | |
| pngFilterSub | back to summary |
|---|---|
| private static byte pngFilterSub(int x, int a) | |
| pngFilterUp | back to summary |
|---|---|
| private static byte pngFilterUp(int x, int b) | |
| preparePredictorPDImage | back to summary |
|---|---|
| private PDImageXObject preparePredictorPDImage(ByteArrayOutputStream stream, int bitsPerComponent) throws IOException | |