Class DecodeOptions

  • Direct Known Subclasses:
    DecodeOptions.FinalDecodeOptions

    public class DecodeOptions
    extends java.lang.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.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  DecodeOptions.FinalDecodeOptions
      Helper class for reusable instances which may not be modified.
    • Constructor Summary

      Constructors 
      Constructor Description
      DecodeOptions()
      Constructs an empty DecodeOptions instance
      DecodeOptions​(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​(java.awt.Rectangle 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
      java.awt.Rectangle getSourceRegion()
      When decoding an image, the part of the image that should be decoded, or null if the entire image is needed.
      int getSubsamplingOffsetX()
      When decoding an image, the horizontal offset for subsampling
      int getSubsamplingOffsetY()
      When decoding an image, the vertical offset for subsampling
      int getSubsamplingX()
      When decoding an image, the number of columns to advance in the source for every pixel decoded.
      int getSubsamplingY()
      When decoding an image, the number of rows to advance in the source for every pixel decoded.
      boolean isFilterSubsampled()
      Flag used by the filter to specify if it performed subsampling.
      (package private) void setFilterSubsampled​(boolean filterSubsampled)
      Used internally by filters to signal they have applied subsampling as requested by this options instance.
      void setSourceRegion​(java.awt.Rectangle sourceRegion)
      Sets the region of the source image that should be decoded.
      void setSubsamplingOffsetX​(int ssOffsetX)
      Sets the horizontal subsampling offset for decoding images
      void setSubsamplingOffsetY​(int ssOffsetY)
      Sets the vertical subsampling offset for decoding images
      void setSubsamplingX​(int ssX)
      Sets the number of columns to advance in the source for every pixel decoded
      void setSubsamplingY​(int ssY)
      Sets the number of rows to advance in the source for every pixel decoded
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
      • sourceRegion

        private java.awt.Rectangle sourceRegion
      • subsamplingX

        private int subsamplingX
      • subsamplingY

        private int subsamplingY
      • subsamplingOffsetX

        private int subsamplingOffsetX
      • subsamplingOffsetY

        private int subsamplingOffsetY
      • filterSubsampled

        private boolean filterSubsampled
    • Constructor Detail

      • DecodeOptions

        public DecodeOptions()
        Constructs an empty DecodeOptions instance
      • DecodeOptions

        public DecodeOptions​(java.awt.Rectangle 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 decoded
        y - y-coordinate of the top-left corner of the region to be decoded
        width - Width of the region to be decoded
        height - 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 java.awt.Rectangle 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​(java.awt.Rectangle 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.
      • setFilterSubsampled

        void setFilterSubsampled​(boolean filterSubsampled)
        Used internally by filters to signal they have applied subsampling as requested by this options instance.
        Parameters:
        filterSubsampled - Value specifying if the filter could meet the requested options. Usually a filter will only call this with the value true, as the default value for the flag is false.