|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.icepdf.core.pobjects.ImageUtility
public class ImageUtility
Utility methods for applying various colour models and masks to image data.
| Field Summary | |
|---|---|
protected static int[] |
GRAY_1_BIT_INDEX_TO_RGB
|
protected static int[] |
GRAY_1_BIT_INDEX_TO_RGB_REVERSED
|
protected static int[] |
GRAY_2_BIT_INDEX_TO_RGB
|
protected static int[] |
GRAY_4_BIT_INDEX_TO_RGB
|
protected static int |
JPEG_ENC_CMYK
|
protected static int |
JPEG_ENC_GRAY
|
protected static java.lang.String[] |
JPEG_ENC_NAMES
|
protected static int |
JPEG_ENC_RGB
|
protected static int |
JPEG_ENC_UNKNOWN_PROBABLY_YCbCr
|
protected static int |
JPEG_ENC_YCbCr
|
protected static int |
JPEG_ENC_YCCK
|
| Method Summary | |
|---|---|
protected static java.awt.image.BufferedImage |
alterBufferedImage(java.awt.image.BufferedImage bi,
java.awt.image.BufferedImage smaskImage,
java.awt.image.BufferedImage maskImage,
int[] maskMinRGB,
int[] maskMaxRGB)
|
protected static java.awt.image.BufferedImage |
alterRasterCMYK2BGRA(java.awt.image.WritableRaster wr)
|
protected static java.awt.image.BufferedImage |
alterRasterCMYK2BGRA(java.awt.image.WritableRaster wr,
float[] decode)
|
protected static void |
alterRasterRGB2PColorSpace(java.awt.image.WritableRaster wr,
PColorSpace colorSpace)
Convert a rgb encoded raster to the specified colour space. |
protected static java.awt.image.WritableRaster |
alterRasterRGBA(java.awt.image.WritableRaster wr,
java.awt.image.BufferedImage smaskImage,
java.awt.image.BufferedImage maskImage,
int[] maskMinRGB,
int[] maskMaxRGB)
|
protected static void |
alterRasterY2Gray(java.awt.image.WritableRaster wr,
float[] decode)
|
protected static java.awt.image.BufferedImage |
alterRasterYCbCr2RGBA(java.awt.image.WritableRaster wr,
float[] decode)
|
protected static void |
alterRasterYCbCrA2RGBA(java.awt.image.WritableRaster wr)
|
protected static void |
alterRasterYCCK2BGRA(java.awt.image.WritableRaster wr,
java.awt.image.BufferedImage smaskImage,
java.awt.image.BufferedImage maskImage,
float[] decode,
int bitsPerComponent)
The basic idea is that we do a fuzzy colour conversion from YCCK to BGRA. |
protected static void |
alterRasterYCCK2CMYK(java.awt.image.WritableRaster wr,
float[] decode)
The basic idea is that we do a fuzzy colour conversion from YCCK to CMYK. |
static java.awt.image.BufferedImage |
applyExplicitMask(java.awt.image.BufferedImage baseImage,
java.awt.image.BufferedImage maskImage)
(see 8.9.6.3, "Explicit Masking") Explicit Masking algorithm, as of PDF 1.3. |
protected static java.awt.image.BufferedImage |
applyExplicitMask(java.awt.image.BufferedImage baseImage,
java.awt.Color fill)
Treats the base image as as mask data applying the specified fill colour to the flagged bytes and a transparency value otherwise. |
static java.awt.image.BufferedImage |
applyExplicitSMask(java.awt.image.BufferedImage baseImage,
java.awt.image.BufferedImage sMaskImage)
(see 11.6.5.3, "Soft-Mask Images") A subsidiary image XObject defining a soft-mask image that shall be used as a source of mask shape or mask opacity values in the transparent imaging model. |
protected static java.awt.image.BufferedImage |
applyIndexColourModel(java.awt.image.BufferedImage image,
int width,
int height,
PColorSpace colourSpace,
int bitspercomponent)
Temporarily pulled out the index colur model application for images from the raw image decode. |
static java.awt.image.BufferedImage |
createBufferedImage(java.awt.Image imageIn)
|
static java.awt.image.BufferedImage |
createBufferedImage(java.awt.Image imageIn,
int imageType)
|
static void |
displayImage(java.awt.image.BufferedImage bufferedImage,
java.lang.String title)
|
float |
getBlackRatio()
|
static ImageUtility |
getInstance()
|
protected static int |
getJPEGEncoding(byte[] data,
int dataLength)
|
protected static void |
getNormalizedComponents(byte[] pixels,
float[] decode,
float[] out)
Apply the Decode Array domain for each colour component. |
protected static void |
getNormalizedComponents(byte[] pixels,
float[] decode,
int[] out)
Apply the Decode Array domain for each colour component. |
static java.awt.Image |
getTrilinearScaledInstance(java.awt.image.BufferedImage img,
int targetWidth,
int targetHeight)
Applies an iterative scaling method to provide a smooth end result, once complete apply a trilinear blend based on the desired width and height. |
protected static boolean |
hasAlpha(java.awt.Image image)
|
protected static java.awt.image.BufferedImage |
jbig2Decode(byte[] data,
java.util.HashMap decodeParms,
Stream globalsStream)
|
protected static java.awt.image.BufferedImage |
makeGrayBufferedImage(java.awt.image.WritableRaster wr)
|
protected static java.awt.image.BufferedImage |
makeImageWithRasterFromBytes(PColorSpace colourSpace,
java.awt.Color fill,
int width,
int height,
int colorSpaceCompCount,
int bitspercomponent,
boolean imageMask,
float[] decode,
java.awt.image.BufferedImage smaskImage,
java.awt.image.BufferedImage maskImage,
int[] maskMinRGB,
int[] maskMaxRGB,
int maskMinIndex,
int maskMaxIndex,
byte[] data,
int dataLength)
|
protected static java.awt.image.BufferedImage |
makeRGBABufferedImage(java.awt.image.WritableRaster wr)
Utility to build an RGBA buffered image using the specified raster and a Transparency.OPAQUE transparency model. |
protected static java.awt.image.BufferedImage |
makeRGBABufferedImage(java.awt.image.WritableRaster wr,
int transparency)
Utility to build an RGBA buffered image using the specified raster and transparency type. |
protected static java.awt.image.BufferedImage |
makeRGBABufferedImageFromImage(java.awt.Image image)
|
protected static java.awt.image.BufferedImage |
makeRGBBufferedImage(java.awt.image.WritableRaster wr)
|
protected static java.awt.image.BufferedImage |
makeRGBBufferedImage(java.awt.image.WritableRaster wr,
float[] decode,
PColorSpace colorSpace)
|
protected static java.awt.image.BufferedImage |
makeRGBtoRGBABuffer(java.awt.image.WritableRaster wr,
int width,
int height)
|
protected static java.awt.image.BufferedImage |
proJbig2Decode(javax.imageio.stream.ImageInputStream imageInputStream,
java.util.HashMap decodeParms,
Stream globalsStream)
|
static java.awt.image.BufferedImage[] |
scaleImagesToSameSize(java.awt.image.BufferedImage baseImage,
java.awt.image.BufferedImage maskImage)
Utility method to scale the two provided images. |
void |
setBlackRatio(float blackRatio)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int[] GRAY_1_BIT_INDEX_TO_RGB_REVERSED
protected static final int[] GRAY_1_BIT_INDEX_TO_RGB
protected static final int[] GRAY_2_BIT_INDEX_TO_RGB
protected static final int[] GRAY_4_BIT_INDEX_TO_RGB
protected static final int JPEG_ENC_UNKNOWN_PROBABLY_YCbCr
protected static final int JPEG_ENC_RGB
protected static final int JPEG_ENC_CMYK
protected static final int JPEG_ENC_YCbCr
protected static final int JPEG_ENC_YCCK
protected static final int JPEG_ENC_GRAY
protected static java.lang.String[] JPEG_ENC_NAMES
| Method Detail |
|---|
public static ImageUtility getInstance()
public float getBlackRatio()
public void setBlackRatio(float blackRatio)
protected static java.awt.image.BufferedImage alterBufferedImage(java.awt.image.BufferedImage bi,
java.awt.image.BufferedImage smaskImage,
java.awt.image.BufferedImage maskImage,
int[] maskMinRGB,
int[] maskMaxRGB)
protected static java.awt.image.BufferedImage alterRasterCMYK2BGRA(java.awt.image.WritableRaster wr,
float[] decode)
protected static java.awt.image.BufferedImage alterRasterCMYK2BGRA(java.awt.image.WritableRaster wr)
public static void displayImage(java.awt.image.BufferedImage bufferedImage,
java.lang.String title)
protected static java.awt.image.BufferedImage makeRGBABufferedImage(java.awt.image.WritableRaster wr)
wr - writable raster of image.
protected static java.awt.image.BufferedImage makeRGBABufferedImage(java.awt.image.WritableRaster wr,
int transparency)
wr - writable raster of image.transparency - any valid Transparency interface type. Bitmask,
opaque and translucent.
protected static java.awt.image.BufferedImage makeRGBtoRGBABuffer(java.awt.image.WritableRaster wr,
int width,
int height)
protected static java.awt.image.BufferedImage makeRGBBufferedImage(java.awt.image.WritableRaster wr)
protected static java.awt.image.BufferedImage makeGrayBufferedImage(java.awt.image.WritableRaster wr)
protected static java.awt.image.BufferedImage makeRGBBufferedImage(java.awt.image.WritableRaster wr,
float[] decode,
PColorSpace colorSpace)
protected static java.awt.image.BufferedImage makeRGBABufferedImageFromImage(java.awt.Image image)
protected static boolean hasAlpha(java.awt.Image image)
protected static void alterRasterYCCK2CMYK(java.awt.image.WritableRaster wr,
float[] decode)
alterRasterCMYK2BGRA
wr - writable raster to alter.decode - decode vector.
protected static void getNormalizedComponents(byte[] pixels,
float[] decode,
float[] out)
pixels - colour to process by decodedecode - decode array for colour spaceout - return value
always (2bitsPerComponent - 1).
protected static void getNormalizedComponents(byte[] pixels,
float[] decode,
int[] out)
pixels - colour to process by decodedecode - decode array for colour spaceout - return value
always (2bitsPerComponent - 1).
protected static void alterRasterRGB2PColorSpace(java.awt.image.WritableRaster wr,
PColorSpace colorSpace)
wr - writable rasters in rgb.colorSpace - colour space to convert colours too.
protected static java.awt.image.WritableRaster alterRasterRGBA(java.awt.image.WritableRaster wr,
java.awt.image.BufferedImage smaskImage,
java.awt.image.BufferedImage maskImage,
int[] maskMinRGB,
int[] maskMaxRGB)
protected static void alterRasterY2Gray(java.awt.image.WritableRaster wr,
float[] decode)
protected static java.awt.image.BufferedImage alterRasterYCbCr2RGBA(java.awt.image.WritableRaster wr,
float[] decode)
protected static void alterRasterYCCK2BGRA(java.awt.image.WritableRaster wr,
java.awt.image.BufferedImage smaskImage,
java.awt.image.BufferedImage maskImage,
float[] decode,
int bitsPerComponent)
wr - image stream to convert colour space.smaskImage - smask used to apply alpha values.maskImage - maks image for drop out.protected static void alterRasterYCbCrA2RGBA(java.awt.image.WritableRaster wr)
public static java.awt.image.BufferedImage applyExplicitMask(java.awt.image.BufferedImage baseImage,
java.awt.image.BufferedImage maskImage)
baseImage - base image in which the mask weill be applied tomaskImage - image mask to be applied to base image.
public static java.awt.image.BufferedImage applyExplicitSMask(java.awt.image.BufferedImage baseImage,
java.awt.image.BufferedImage sMaskImage)
baseImage - base image in which the mask weill be applied to
protected static java.awt.image.BufferedImage applyExplicitMask(java.awt.image.BufferedImage baseImage,
java.awt.Color fill)
baseImage - masking image.fill - fill value to apply to mask.
protected static java.awt.image.BufferedImage applyIndexColourModel(java.awt.image.BufferedImage image,
int width,
int height,
PColorSpace colourSpace,
int bitspercomponent)
protected static java.awt.image.BufferedImage proJbig2Decode(javax.imageio.stream.ImageInputStream imageInputStream,
java.util.HashMap decodeParms,
Stream globalsStream)
throws java.lang.reflect.InvocationTargetException,
java.lang.IllegalAccessException,
java.lang.NoSuchMethodException,
java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.NoSuchMethodException
java.io.IOException
java.lang.ClassNotFoundException
java.lang.InstantiationException
protected static java.awt.image.BufferedImage jbig2Decode(byte[] data,
java.util.HashMap decodeParms,
Stream globalsStream)
protected static int getJPEGEncoding(byte[] data,
int dataLength)
protected static java.awt.image.BufferedImage makeImageWithRasterFromBytes(PColorSpace colourSpace,
java.awt.Color fill,
int width,
int height,
int colorSpaceCompCount,
int bitspercomponent,
boolean imageMask,
float[] decode,
java.awt.image.BufferedImage smaskImage,
java.awt.image.BufferedImage maskImage,
int[] maskMinRGB,
int[] maskMaxRGB,
int maskMinIndex,
int maskMaxIndex,
byte[] data,
int dataLength)
public static java.awt.image.BufferedImage createBufferedImage(java.awt.Image imageIn)
public static java.awt.image.BufferedImage createBufferedImage(java.awt.Image imageIn,
int imageType)
public static java.awt.image.BufferedImage[] scaleImagesToSameSize(java.awt.image.BufferedImage baseImage,
java.awt.image.BufferedImage maskImage)
baseImage - base image that mask will be applied tomaskImage - mask image that will be applied to base image.
public static java.awt.Image getTrilinearScaledInstance(java.awt.image.BufferedImage img,
int targetWidth,
int targetHeight)
img - image to scaletargetWidth - target widthtargetHeight - target height
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||