Class AbstractResizer

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.awt.RenderingHints.Key KEY_INTERPOLATION  
      protected java.util.Map<java.awt.RenderingHints.Key,​java.lang.Object> RENDERING_HINTS
      Rendering hints to use when resizing an image.
      protected java.util.Map<java.awt.RenderingHints.Key,​java.lang.Object> UNMODIFIABLE_RENDERING_HINTS
      Field used to hold the rendering hints in an unmodifiable form.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractResizer​(java.lang.Object interpolationValue, java.util.Map<java.awt.RenderingHints.Key,​java.lang.Object> hints)
      Initializes the AbstractResizer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.awt.Graphics2D createGraphics​(java.awt.image.BufferedImage img)
      Returns a Graphics2D object with rendering hints pre-applied.
      java.util.Map<java.awt.RenderingHints.Key,​java.lang.Object> getRenderingHints()
      Returns the rendering hints that the resizer uses.
      protected void performChecks​(java.awt.image.BufferedImage srcImage, java.awt.image.BufferedImage destImage)
      Performs checks on the source and destination image to see if they are images which can be processed.
      void resize​(java.awt.image.BufferedImage srcImage, java.awt.image.BufferedImage destImage)
      Performs a resize operation from a source image and outputs to a destination image.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • RENDERING_HINTS

        protected final java.util.Map<java.awt.RenderingHints.Key,​java.lang.Object> RENDERING_HINTS
        Rendering hints to use when resizing an image.
      • UNMODIFIABLE_RENDERING_HINTS

        protected final java.util.Map<java.awt.RenderingHints.Key,​java.lang.Object> UNMODIFIABLE_RENDERING_HINTS
        Field used to hold the rendering hints in an unmodifiable form.
      • KEY_INTERPOLATION

        protected static final java.awt.RenderingHints.Key KEY_INTERPOLATION
    • Constructor Detail

      • AbstractResizer

        protected AbstractResizer​(java.lang.Object interpolationValue,
                                  java.util.Map<java.awt.RenderingHints.Key,​java.lang.Object> hints)
        Initializes the AbstractResizer.
        Parameters:
        interpolationValue - The rendering hint value to use for the interpolation hint.
        hints - Other rendering hints to add.
    • Method Detail

      • resize

        public void resize​(java.awt.image.BufferedImage srcImage,
                           java.awt.image.BufferedImage destImage)

        Performs a resize operation from a source image and outputs to a destination image.

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

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

        protected java.awt.Graphics2D createGraphics​(java.awt.image.BufferedImage img)
        Returns a Graphics2D object with rendering hints pre-applied.
        Parameters:
        img - BufferedImage for which the Graphics2D object should be generated for.
        Returns:
        Graphics2D object for the given BufferedImage.
      • performChecks

        protected void performChecks​(java.awt.image.BufferedImage srcImage,
                                     java.awt.image.BufferedImage destImage)
        Performs checks on the source and destination image to see if they are images which can be processed.
        Parameters:
        srcImage - The source image.
        destImage - The destination image.
      • getRenderingHints

        public java.util.Map<java.awt.RenderingHints.Key,​java.lang.Object> getRenderingHints()
        Returns the rendering hints that the resizer uses.

        The keys and values used for the rendering hints are those defined in the RenderingHints class.

        Returns:
        Rendering hints used when resizing the image.
        See Also:
        RenderingHints