public class PDFImage
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
PDFImage(PDFObject imageObj)
Create an instance of a PDFImage
|
Modifier and Type | Method and Description |
---|---|
static PDFImage |
createImage(PDFObject obj,
java.util.Map resources)
Read a PDFImage from an image dictionary and stream
|
static void |
dump(PDFObject obj) |
protected int |
getBitsPerComponent()
Get the number of bits per component sample
|
protected PDFColorSpace |
getColorSpace()
Get the colorspace associated with this image, or null if there
isn't one
|
protected float[] |
getDecode()
Get the decode array
|
int |
getHeight()
Get the image's height
|
java.awt.image.BufferedImage |
getImage()
Get the image that this PDFImage generates.
|
PDFImage |
getSMask()
Return the soft mask associated with this image
|
int |
getWidth()
Get the image's width
|
boolean |
isImageMask()
Return whether or not this is an image mask
|
static void |
p(java.lang.String string) |
protected java.awt.image.BufferedImage |
parseData(byte[] data,
java.nio.ByteBuffer jpegData)
Parse the image stream into a buffered image.
|
protected void |
setBitsPerComponent(int bpc)
Set the number of bits per component sample
|
protected void |
setColorSpace(PDFColorSpace colorSpace)
Set the colorspace associated with this image
|
protected void |
setDecode(float[] decode)
Set the decode array
|
protected void |
setHeight(int height)
Set the image's height
|
void |
setImageMask(boolean imageMask)
Set whether or not this is an image mask
|
protected void |
setSMask(PDFImage sMask)
Set the soft mask image
|
protected void |
setWidth(int width)
Set the image's width
|
protected PDFImage(PDFObject imageObj)
public static void dump(PDFObject obj) throws java.io.IOException
java.io.IOException
public static void p(java.lang.String string)
public static PDFImage createImage(PDFObject obj, java.util.Map resources) throws java.io.IOException
obj
- the PDFObject containing the image's dictionary and streamresources
- the current resourcesjava.io.IOException
public java.awt.image.BufferedImage getImage()
protected java.awt.image.BufferedImage parseData(byte[] data, java.nio.ByteBuffer jpegData) throws java.io.IOException
Parse the image stream into a buffered image. Note that this is guaranteed to be called after all the other setXXX methods have been called.
NOTE: the color convolving is extremely slow on large images. It would be good to see if it could be moved out into the rendering phases, where we might be able to scale the image down first.
data
- the data when already completely filtered and uncompressedjpegData
- a byte buffer if data still requiring the DCDTecode filter
is being usedjava.io.IOException
public int getWidth()
protected void setWidth(int width)
public int getHeight()
protected void setHeight(int height)
protected PDFColorSpace getColorSpace()
protected void setColorSpace(PDFColorSpace colorSpace)
protected int getBitsPerComponent()
protected void setBitsPerComponent(int bpc)
public boolean isImageMask()
public void setImageMask(boolean imageMask)
public PDFImage getSMask()
protected void setSMask(PDFImage sMask)
protected float[] getDecode()
protected void setDecode(float[] decode)