Package com.tom_roush.pdfbox.filter
Class DecodeOptions
- java.lang.Object
-
- com.tom_roush.pdfbox.filter.DecodeOptions
-
public class DecodeOptions extends Object
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 Modifier and Type Field Description static DecodeOptionsDEFAULTDefault decode options.
-
Constructor Summary
Constructors Constructor Description DecodeOptions()Constructs 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(Rect sourceRegion)Constructs an instance specifying the region of the image that should be decoded.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RectgetSourceRegion()When decoding an image, the part of the image that should be decoded, or null if the entire image is needed.intgetSubsamplingOffsetX()When decoding an image, the horizontal offset for subsamplingintgetSubsamplingOffsetY()When decoding an image, the vertical offset for subsamplingintgetSubsamplingX()When decoding an image, the number of columns to advance in the source for every pixel decoded.intgetSubsamplingY()When decoding an image, the number of rows to advance in the source for every pixel decoded.booleanisFilterSubsampled()Flag used by the filter to specify if it performed subsampling.voidsetSourceRegion(Rect sourceRegion)Sets the region of the source image that should be decoded.voidsetSubsamplingOffsetX(int ssOffsetX)Sets the horizontal subsampling offset for decoding imagesvoidsetSubsamplingOffsetY(int ssOffsetY)Sets the vertical subsampling offset for decoding imagesvoidsetSubsamplingX(int ssX)Sets the number of columns to advance in the source for every pixel decodedvoidsetSubsamplingY(int ssY)Sets the number of rows to advance in the source for every pixel decoded
-
-
-
Field Detail
-
DEFAULT
public static final DecodeOptions DEFAULT
Default decode options. The honored flag for this instance is always true, as it represents the default behavior.
-
-
Constructor Detail
-
DecodeOptions
public DecodeOptions()
Constructs an empty DecodeOptions instance
-
DecodeOptions
public DecodeOptions(Rect sourceRegion)
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 Detail
-
getSourceRegion
public Rect 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
public void setSourceRegion(Rect sourceRegion)
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.
-
-