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(DecodeOptions options)
Returns an InputStream, passing additional options to each filter
|
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()
Deprecated.
inline images don't have a color key mask.
|
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.
|
BufferedImage |
getImage(Rectangle region,
int subsampling)
Returns the content of this image as an AWT buffered image with an (A)RGB colored 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.
|
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(DecodeOptions options) throws IOException
PDImage
createInputStream
in interface PDImage
options
- Additional decoding options passed to the filters usedIOException
- if the data could not be readpublic InputStream createInputStream(List<String> stopFilters) throws IOException
PDImage
createInputStream
in interface PDImage
stopFilters
- A list of filters to stop decoding at.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 getImage(Rectangle region, int subsampling) throws IOException
PDImage
the unparameterized version
, this method does not
cache the resulting image.getImage
in interface PDImage
region
- The region of the source image to get, or null if the entire image is needed.
The actual region will be clipped to the dimensions of the source image.subsampling
- The amount of rows and columns to advance for every output pixel, a value
of 1 meaning every pixel will be readIOException
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 read@Deprecated public COSArray getColorKeyMask()
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.