com.sun.pdfview

Class PDFImage

public class PDFImage extends Object

Encapsulates a PDF Image
Constructor Summary
protected PDFImage(PDFObject imageObj)
Create an instance of a PDFImage
Method Summary
static PDFImagecreateImage(PDFObject obj, Map resources)
Read a PDFImage from an image dictionary and stream
protected intgetBitsPerComponent()
Get the number of bits per component sample
protected PDFColorSpacegetColorSpace()
Get the colorspace associated with this image, or null if there isn't one
protected float[]getDecode()
Get the decode array
intgetHeight()
Get the image's height
BufferedImagegetImage()
Get the image that this PDFImage generates.
PDFImagegetSMask()
Return the soft mask associated with this image
intgetWidth()
Get the image's width
booleanisImageMask()
Return whether or not this is an image mask
protected BufferedImageparseData(byte[] data)
Parse the image stream into a buffered image.
protected voidsetBitsPerComponent(int bpc)
Set the number of bits per component sample
protected voidsetColorSpace(PDFColorSpace colorSpace)
Set the colorspace associated with this image
protected voidsetDecode(float[] decode)
Set the decode array
protected voidsetHeight(int height)
Set the image's height
voidsetImageMask(boolean imageMask)
Set whether or not this is an image mask
protected voidsetSMask(PDFImage sMask)
Set the soft mask image
protected voidsetWidth(int width)
Set the image's width

Constructor Detail

PDFImage

protected PDFImage(PDFObject imageObj)
Create an instance of a PDFImage

Method Detail

createImage

public static PDFImage createImage(PDFObject obj, Map resources)
Read a PDFImage from an image dictionary and stream

Parameters: obj the PDFObject containing the image's dictionary and stream resources the current resources

getBitsPerComponent

protected int getBitsPerComponent()
Get the number of bits per component sample

getColorSpace

protected PDFColorSpace getColorSpace()
Get the colorspace associated with this image, or null if there isn't one

getDecode

protected float[] getDecode()
Get the decode array

getHeight

public int getHeight()
Get the image's height

getImage

public BufferedImage getImage()
Get the image that this PDFImage generates.

Returns: a buffered image containing the decoded image data

getSMask

public PDFImage getSMask()
Return the soft mask associated with this image

getWidth

public int getWidth()
Get the image's width

isImageMask

public boolean isImageMask()
Return whether or not this is an image mask

parseData

protected BufferedImage parseData(byte[] data)
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.

setBitsPerComponent

protected void setBitsPerComponent(int bpc)
Set the number of bits per component sample

setColorSpace

protected void setColorSpace(PDFColorSpace colorSpace)
Set the colorspace associated with this image

setDecode

protected void setDecode(float[] decode)
Set the decode array

setHeight

protected void setHeight(int height)
Set the image's height

setImageMask

public void setImageMask(boolean imageMask)
Set whether or not this is an image mask

setSMask

protected void setSMask(PDFImage sMask)
Set the soft mask image

setWidth

protected void setWidth(int width)
Set the image's width