public abstract class PDXObjectImage extends PDXObject
Modifier and Type | Field and Description |
---|---|
static String |
SUB_TYPE
The XObject subtype.
|
Constructor and Description |
---|
PDXObjectImage(PDDocument doc,
String fileSuffix)
Standard constuctor.
|
PDXObjectImage(PDStream imageStream,
String fileSuffix)
Standard constructor.
|
Modifier and Type | Method and Description |
---|---|
BufferedImage |
applyMasks(BufferedImage baseImage) |
static PDXObject |
createThumbnailXObject(COSBase xobject)
Create the correct thumbnail from the cos base.
|
int |
getBitsPerComponent()
The bits per component of this image.
|
PDColorSpace |
getColorSpace()
This will get the color space.
|
COSArray |
getDecode()
Returns the Decode Array of an XObjectImage.
|
int |
getHeight()
Get the height of the image.
|
boolean |
getImageMask()
Get the ImageMask flag.
|
COSBase |
getMask()
Returns the optional mask of a XObjectImage if there is one.
|
abstract BufferedImage |
getRGBImage()
Returns an java.awt.Image, that can be used for display etc.
|
PDXObjectImage |
getSMaskImage()
Returns a PDXObjectImage of the SMask image, if there is one.
|
PDColorState |
getStencilColor()
Returns the non stroking colorstate to be used to create stencil makes images.
|
String |
getSuffix()
This will get the suffix for this image type, jpg/png.
|
int |
getWidth()
Get the width of the image.
|
boolean |
hasMask() |
BufferedImage |
imageMask(BufferedImage baseImage) |
BufferedImage |
mask(BufferedImage baseImage) |
void |
setBitsPerComponent(int bpc)
Set the number of bits per component.
|
void |
setColorSpace(PDColorSpace cs)
This will set the color space for this image.
|
void |
setHeight(int height)
Set the height of the image.
|
void |
setStencilColor(PDColorState stencilColorValue)
Set the current non stroking colorstate.
|
void |
setWidth(int width)
Set the width of the image.
|
void |
write2file(File file)
Writes the image to a file with the filename + an appropriate
suffix, like "Image.jpg".
|
void |
write2file(String filename)
Writes the image to a file with the filename + an appropriate suffix, like "Image.jpg".
|
abstract void |
write2OutputStream(OutputStream out)
Writes the Image to out.
|
clear, commonXObjectCreation, createXObject, getCOSObject, getCOSStream, getMetadata, getPDStream, getStructParent, setMetadata, setStructParent
public static final String SUB_TYPE
public PDXObjectImage(PDStream imageStream, String fileSuffix)
imageStream
- The XObject is passed as a COSStream.fileSuffix
- The file suffix, jpg/png.public PDXObjectImage(PDDocument doc, String fileSuffix)
doc
- The document to store the stream in.fileSuffix
- The file suffix, jpg/png.public static PDXObject createThumbnailXObject(COSBase xobject) throws IOException
xobject
- The cos level xobject to create.IOException
- If there is an error creating the xobject.public abstract BufferedImage getRGBImage() throws IOException
IOException
- If there is an error creating the image.public PDXObjectImage getSMaskImage() throws IOException
null
.IOException
- if an I/O error occurs creating an XObjectpublic BufferedImage applyMasks(BufferedImage baseImage) throws IOException
IOException
public boolean hasMask() throws IOException
IOException
public BufferedImage imageMask(BufferedImage baseImage) throws IOException
IOException
public BufferedImage mask(BufferedImage baseImage) throws IOException
IOException
public abstract void write2OutputStream(OutputStream out) throws IOException
out
- the OutputStream that the Image is written to.IOException
- when somethings wrong with outpublic void write2file(String filename) throws IOException
filename
- the filenameIOException
- When somethings wrong with the corresponding file.public void write2file(File file) throws IOException
file
- the fileIOException
- When somethings wrong with the corresponding file.public int getHeight()
public void setHeight(int height)
height
- The height of the image.public int getWidth()
public void setWidth(int width)
width
- The width of the image.public int getBitsPerComponent()
public void setBitsPerComponent(int bpc)
bpc
- The number of bits per component.public PDColorSpace getColorSpace() throws IOException
IOException
- If there is an error getting the colorspace.public void setColorSpace(PDColorSpace cs)
cs
- The color space for this image.public String getSuffix()
public boolean getImageMask()
public void setStencilColor(PDColorState stencilColorValue)
stencilColorValue
- The non stroking colorstatepublic PDColorState getStencilColor()
public COSArray getDecode()
public COSBase getMask()
Copyright © 2002-2015 The Apache Software Foundation. All Rights Reserved.