public final class PDInlineImage extends Object implements PDImage
Constructor and Description |
---|
PDInlineImage(COSDictionary parameters,
byte[] data,
PDResources resources)
Creates an inline image from the given parameters and data.
|
Modifier and Type | Method and Description |
---|---|
InputStream |
createInputStream()
Returns an InputStream containing the image data, irrespective of whether this is an
inline image or an image XObject.
|
InputStream |
createInputStream(List<String> stopFilters)
Returns an InputStream containing the image data, irrespective of whether this is an
inline image or an image XObject.
|
int |
getBitsPerComponent()
Returns bits per component of this image, or -1 if one has not been set.
|
COSArray |
getColorKeyMask()
Returns the color key mask array associated with this image, or null if
there is none.
|
PDColorSpace |
getColorSpace()
Returns the image's color space.
|
COSBase |
getCOSObject()
Convert this standard java object to a COS object.
|
byte[] |
getData()
Returns the inline image data.
|
COSArray |
getDecode()
Returns the decode array.
|
List<String> |
getFilters()
Returns a list of filters applied to this stream, or null if there are none.
|
int |
getHeight()
Returns height of this image, or -1 if one has not been set.
|
BufferedImage |
getImage()
Returns the content of this image as an AWT buffered image with an (A)RGB color space.
|
boolean |
getInterpolate()
Returns true if the image should be interpolated when rendered.
|
BufferedImage |
getStencilImage(Paint paint)
Returns an ARGB image filled with the given paint and using this image as a mask.
|
String |
getSuffix()
Returns the suffix for this image type, e.g. jpg/png.
|
int |
getWidth()
Returns the width of this image, or -1 if one has not been set.
|
boolean |
isEmpty()
Returns true if the image has no data.
|
boolean |
isStencil()
Returns true if the image is a stencil mask.
|
void |
setBitsPerComponent(int bitsPerComponent)
Set the number of bits per component.
|
void |
setColorSpace(PDColorSpace colorSpace)
Sets the color space for this image.
|
void |
setDecode(COSArray decode)
Sets the decode array.
|
void |
setFilters(List<String> filters)
Sets which filters are applied to this stream.
|
void |
setHeight(int height)
Sets the height of the image.
|
void |
setInterpolate(boolean value)
Sets the Interpolate flag, true for high-quality image scaling.
|
void |
setStencil(boolean isStencil)
Sets whether or not the image is a stencil.
|
void |
setWidth(int width)
Sets the width of the image.
|
public PDInlineImage(COSDictionary parameters, byte[] data, PDResources resources) throws IOException
parameters
- the image parametersdata
- the image dataresources
- the current resourcesIOException
- if the stream cannot be decodedpublic COSBase getCOSObject()
COSObjectable
getCOSObject
in interface COSObjectable
public int getBitsPerComponent()
PDImage
getBitsPerComponent
in interface PDImage
public void setBitsPerComponent(int bitsPerComponent)
PDImage
setBitsPerComponent
in interface PDImage
bitsPerComponent
- The number of bits per component.public PDColorSpace getColorSpace() throws IOException
PDImage
getColorSpace
in interface PDImage
IOException
- If there is an error getting the color space.public void setColorSpace(PDColorSpace colorSpace)
PDImage
setColorSpace
in interface PDImage
colorSpace
- The color space for this image.public int getHeight()
PDImage
public void setHeight(int height)
PDImage
public int getWidth()
PDImage
public void setWidth(int width)
PDImage
public boolean getInterpolate()
PDImage
getInterpolate
in interface PDImage
public void setInterpolate(boolean value)
PDImage
setInterpolate
in interface PDImage
public List<String> getFilters()
public void setFilters(List<String> filters)
filters
- the filters to apply to this stream.public void setDecode(COSArray decode)
PDImage
public COSArray getDecode()
PDImage
public boolean isStencil()
PDImage
public void setStencil(boolean isStencil)
PDImage
ImageMask
entry in the image stream's dictionary.setStencil
in interface PDImage
isStencil
- True to make the image a stencil.public InputStream createInputStream() throws IOException
PDImage
createInputStream
in interface PDImage
IOException
- if the data could not be read.public InputStream createInputStream(List<String> stopFilters) throws IOException
PDImage
createInputStream
in interface PDImage
IOException
- if the data could not be read.public boolean isEmpty()
PDImage
public byte[] getData()
public BufferedImage getImage() throws IOException
PDImage
getImage
in interface PDImage
IOException
public BufferedImage getStencilImage(Paint paint) throws IOException
PDImage
getStencilImage
in interface PDImage
paint
- the paint to fill the visible portions of the image withIOException
- if the image cannot be readpublic COSArray getColorKeyMask()
Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.