Enum Resizers

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Resizers>, Resizer

    public enum Resizers
    extends java.lang.Enum<Resizers>
    implements Resizer

    This enum can be used to select a specific Resizer in order to perform a resizing operation.

    The instance held by a value of this enum is a single instance. When using specific implementations of Resizers, it is preferable to obtain an instance of a Resizer through this enum or the DefaultResizerFactory class in order to prevent many instances of the Resizer class implementations from being instantiated.

    Usage:

    The following example code demonstrates how to use the Resizers enum in order to resize an image using bilinear interpolation:

    BufferedImage sourceImage = new BufferedImageBuilder(400, 400).build();
    BufferedImage destImage = new BufferedImageBuilder(200, 200).build();
    
    Resizers.BILINEAR.resize(sourceImage, destImage);
     
    See Also:
    DefaultResizerFactory
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      BICUBIC
      A Resizer which performs resizing operations using bicubic interpolation.
      BILINEAR
      A Resizer which performs resizing operations using bilinear interpolation.
      NULL
      A Resizer which does not perform resizing operations.
      PROGRESSIVE
      A Resizer which performs resizing operations using progressive bilinear scaling.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Resizer resizer  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Resizers​(Resizer resizer)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void resize​(java.awt.image.BufferedImage srcImage, java.awt.image.BufferedImage destImage)
      Resizes an image.
      static Resizers valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static Resizers[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • NULL

        public static final Resizers NULL
        A Resizer which does not perform resizing operations. The source image will be drawn at the origin of the destination image.
      • BILINEAR

        public static final Resizers BILINEAR
        A Resizer which performs resizing operations using bilinear interpolation.
      • BICUBIC

        public static final Resizers BICUBIC
        A Resizer which performs resizing operations using bicubic interpolation.
      • PROGRESSIVE

        public static final Resizers PROGRESSIVE
        A Resizer which performs resizing operations using progressive bilinear scaling.

        For details on this technique, refer to the documentation of the ProgressiveBilinearResizer class.

    • Field Detail

      • resizer

        private final Resizer resizer
    • Constructor Detail

      • Resizers

        private Resizers​(Resizer resizer)
    • Method Detail

      • values

        public static Resizers[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Resizers c : Resizers.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Resizers valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • resize

        public void resize​(java.awt.image.BufferedImage srcImage,
                           java.awt.image.BufferedImage destImage)
        Description copied from interface: Resizer
        Resizes an image.

        The source image is resized to fit the dimensions of the destination image and drawn.

        Specified by:
        resize in interface Resizer
        Parameters:
        srcImage - The source image.
        destImage - The destination image.