Class ProgressiveBilinearResizer

  • All Implemented Interfaces:
    Resizer

    public class ProgressiveBilinearResizer
    extends AbstractResizer
    A Resizer which performs resizing operations by using progressive bilinear scaling.

    The resizing technique used in this class is based on the technique discussed in Chapter 4: Images of Filthy Rich Clients by Chet Haase and Romain Guy.

    The actual implementation of the technique is independent of the code which is provided in the book.

    • Field Detail

      • bilinearResizer

        private final BilinearResizer bilinearResizer
        A resizer that's used when a single-step resize is needed.
    • Constructor Detail

      • ProgressiveBilinearResizer

        public ProgressiveBilinearResizer()
        Instantiates a ProgressiveBilinearResizer with default rendering hints.
      • ProgressiveBilinearResizer

        public ProgressiveBilinearResizer​(java.util.Map<java.awt.RenderingHints.Key,​java.lang.Object> hints)
        Instantiates a ProgressiveBilinearResizer with the specified rendering hints.
        Parameters:
        hints - Additional rendering hints to apply.
    • Method Detail

      • resize

        public void resize​(java.awt.image.BufferedImage srcImage,
                           java.awt.image.BufferedImage destImage)
                    throws java.lang.NullPointerException
        Resizes an image using the progressive bilinear scaling technique.

        When the source image isn't at least twice as large as the destination image for both dimensions, a regular one-step scaling is performed.

        If the source and/or destination image is null, then a NullPointerException will be thrown.

        Specified by:
        resize in interface Resizer
        Overrides:
        resize in class AbstractResizer
        Parameters:
        srcImage - The source image.
        destImage - The destination image.
        Throws:
        java.lang.NullPointerException - When the source and/or the destination image is null.