Class FilterChainRable8Bit

  • All Implemented Interfaces:
    java.awt.image.renderable.RenderableImage, Filter, FilterChainRable, PaintRable

    public class FilterChainRable8Bit
    extends AbstractRable
    implements FilterChainRable, PaintRable
    Implements a filter chain. A filter chain is defined by its filter region (i.e., the bounding box of its input/output), its filter resolution and its source. Its source cannot be null, but its resolution can.
    The filter chain decomposes as follows:
    • A pad operation that makes the input image a big as the filter region.
    • If there is a filterResolution specified along at least one of the axis, a AffineRable
    Version:
    $Id: FilterChainRable8Bit.java 1805408 2017-08-18 12:21:52Z ssteiner $
    • Field Detail

      • filterResolutionX

        private int filterResolutionX
        Resolution along the X axis
      • filterResolutionY

        private int filterResolutionY
        Resolution along the Y axis
      • chainSource

        private Filter chainSource
        The chain's source
      • filterRes

        private FilterResRable filterRes
        Scale operation. May be null
      • crop

        private PadRable crop
        Crop operation.
      • filterRegion

        private java.awt.geom.Rectangle2D filterRegion
        Filter region
    • Constructor Detail

      • FilterChainRable8Bit

        public FilterChainRable8Bit​(Filter source,
                                    java.awt.geom.Rectangle2D filterRegion)
        Default constructor.
    • Method Detail

      • setFilterResolutionX

        public void setFilterResolutionX​(int filterResolutionX)
        Sets the resolution along the X axis, i.e., the maximum size for intermediate images along that axis. If filterResolutionX is less than zero, no filter resolution is forced on the filter chain. If filterResolutionX is zero, then the filter returns null. If filterResolutionX is positive, then the filter resolution is applied.
        Specified by:
        setFilterResolutionX in interface FilterChainRable
      • setFilterResolutionY

        public void setFilterResolutionY​(int filterResolutionY)
        Sets the resolution along the Y axis, i.e., the maximum size for intermediate images along that axis. If filterResolutionY is zero or less, the value of filterResolutionX is used.
        Specified by:
        setFilterResolutionY in interface FilterChainRable
      • setupFilterRes

        private void setupFilterRes()
        Implementation. Checks the current value of the filterResolutionX and filterResolutionY attribute and setup the filterRes operation accordingly.
      • setFilterRegion

        public void setFilterRegion​(java.awt.geom.Rectangle2D filterRegion)
        Sets the filter output area, in user space. A null value is illegal.
        Specified by:
        setFilterRegion in interface FilterChainRable
      • getFilterRegion

        public java.awt.geom.Rectangle2D getFilterRegion()
        Returns the filter output area, in user space
        Specified by:
        getFilterRegion in interface FilterChainRable
      • getSource

        public Filter getSource()
        Returns the source of the chain. Note that a crop and affine operation may be inserted before the source, depending on the filterRegion and filterResolution parameters.
        Specified by:
        getSource in interface FilterChainRable
      • setSource

        public void setSource​(Filter chainSource)
        Sets the source to be src.
        Specified by:
        setSource in interface FilterChainRable
        Parameters:
        chainSource - image to the chain.
      • paintRable

        public boolean paintRable​(java.awt.Graphics2D g2d)
        Should perform the equivilent action as createRendering followed by drawing the RenderedImage to Graphics2D, or return false.
        Specified by:
        paintRable in interface PaintRable
        Parameters:
        g2d - The Graphics2D to draw to.
        Returns:
        true if the paint call succeeded, false if for some reason the paint failed (in which case a createRendering should be used).
      • createRendering

        public java.awt.image.RenderedImage createRendering​(java.awt.image.renderable.RenderContext context)
        Specified by:
        createRendering in interface java.awt.image.renderable.RenderableImage