Package org.apache.pdfbox.filter
Class DecodeOptions
java.lang.Object
org.apache.pdfbox.filter.DecodeOptions
Options that may be passed to a Filter to request special handling when decoding the stream.
Filters may not honor some or all of the specified options, and so callers should check the
honored flag if further processing relies on the options being used.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty DecodeOptions instanceDecodeOptions
(int subsampling) Constructs an instance specifying the image should be decoded using subsampling.DecodeOptions
(int x, int y, int width, int height) Constructs an instance specifying the region of the image that should be decoded.DecodeOptions
(Rectangle sourceRegion) Constructs an instance specifying the region of the image that should be decoded. -
Method Summary
Modifier and TypeMethodDescriptionWhen decoding an image, the part of the image that should be decoded, or null if the entire image is needed.int
When decoding an image, the horizontal offset for subsamplingint
When decoding an image, the vertical offset for subsamplingint
When decoding an image, the number of columns to advance in the source for every pixel decoded.int
When decoding an image, the number of rows to advance in the source for every pixel decoded.boolean
Flag used by the filter to specify if it performed subsampling.void
setSourceRegion
(Rectangle sourceRegion) Sets the region of the source image that should be decoded.void
setSubsamplingOffsetX
(int ssOffsetX) Sets the horizontal subsampling offset for decoding imagesvoid
setSubsamplingOffsetY
(int ssOffsetY) Sets the vertical subsampling offset for decoding imagesvoid
setSubsamplingX
(int ssX) Sets the number of columns to advance in the source for every pixel decodedvoid
setSubsamplingY
(int ssY) Sets the number of rows to advance in the source for every pixel decoded
-
Field Details
-
DEFAULT
Default decode options. The honored flag for this instance is always true, as it represents the default behavior.
-
-
Constructor Details
-
DecodeOptions
public DecodeOptions()Constructs an empty DecodeOptions instance -
DecodeOptions
Constructs an instance specifying the region of the image that should be decoded. The actual region will be clipped to the dimensions of the image.- Parameters:
sourceRegion
- Region of the source image that should be decoded
-
DecodeOptions
public DecodeOptions(int x, int y, int width, int height) Constructs an instance specifying the region of the image that should be decoded. The actual region will be clipped to the dimensions of the image.- Parameters:
x
- x-coordinate of the top-left corner of the region to be decodedy
- y-coordinate of the top-left corner of the region to be decodedwidth
- Width of the region to be decodedheight
- Height of the region to be decoded
-
DecodeOptions
public DecodeOptions(int subsampling) Constructs an instance specifying the image should be decoded using subsampling. The subsampling will be the same for the X and Y axes.- Parameters:
subsampling
- The number of rows and columns to advance in the source for each pixel in the decoded image.
-
-
Method Details
-
getSourceRegion
When decoding an image, the part of the image that should be decoded, or null if the entire image is needed.- Returns:
- The source region to decode, or null if the entire image should be decoded
-
setSourceRegion
Sets the region of the source image that should be decoded. The region will be clipped to the dimensions of the source image. Setting this value to null will result in the entire image being decoded.- Parameters:
sourceRegion
- The source region to decode, or null if the entire image should be decoded.
-
getSubsamplingX
public int getSubsamplingX()When decoding an image, the number of columns to advance in the source for every pixel decoded.- Returns:
- The x-axis subsampling value
-
setSubsamplingX
public void setSubsamplingX(int ssX) Sets the number of columns to advance in the source for every pixel decoded- Parameters:
ssX
- The x-axis subsampling value
-
getSubsamplingY
public int getSubsamplingY()When decoding an image, the number of rows to advance in the source for every pixel decoded.- Returns:
- The y-axis subsampling value
-
setSubsamplingY
public void setSubsamplingY(int ssY) Sets the number of rows to advance in the source for every pixel decoded- Parameters:
ssY
- The y-axis subsampling value
-
getSubsamplingOffsetX
public int getSubsamplingOffsetX()When decoding an image, the horizontal offset for subsampling- Returns:
- The x-axis subsampling offset
-
setSubsamplingOffsetX
public void setSubsamplingOffsetX(int ssOffsetX) Sets the horizontal subsampling offset for decoding images- Parameters:
ssOffsetX
- The x-axis subsampling offset
-
getSubsamplingOffsetY
public int getSubsamplingOffsetY()When decoding an image, the vertical offset for subsampling- Returns:
- The y-axis subsampling offset
-
setSubsamplingOffsetY
public void setSubsamplingOffsetY(int ssOffsetY) Sets the vertical subsampling offset for decoding images- Parameters:
ssOffsetY
- The y-axis subsampling offset
-
isFilterSubsampled
public boolean isFilterSubsampled()Flag used by the filter to specify if it performed subsampling. Some filters may be unable or unwilling to apply subsampling, and so the caller must check this flag after decoding.- Returns:
- True if the filter applied the options specified by this instance, false otherwise.
-