Enum ImageResizeMode

    • Enum Constant Detail

      • AUTO

        public static final ImageResizeMode AUTO
        Calculate proportional dimensions that best fit into the target width and height, retain aspect ratio
      • BOUNDED

        public static final ImageResizeMode BOUNDED
        Calculate dimensions for the largest image that fit within the bounding box, retain aspect ratio
      • PADDED

        public static final ImageResizeMode PADDED
        Position an appropriately scaled image within the bounding box, retain aspect ratio
    • Method Detail

      • values

        public static ImageResizeMode[] 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 (ImageResizeMode c : ImageResizeMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ImageResizeMode valueOf​(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:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • computeDimension

        abstract Dimension computeDimension​(Dimension dim,
                                            Dimension icon)
        Computes the dimension for the resulting image
        Parameters:
        dim - the desired image dimension
        icon - the dimensions of the image to resize
        Returns:
        the dimension for the resulting image
      • prepareGraphics

        void prepareGraphics​(Dimension icon,
                             BufferedImage image,
                             Graphics2D g)
        Prepares the graphics object for rendering the given image
        Parameters:
        icon - the dimensions of the image to resize
        image - the image to render afterwards
        g - graphics
      • cacheKey

        int cacheKey​(Dimension dim)
        Returns a cache key for this mode and the given dimension
        Parameters:
        dim - the desired image dimension
        Returns:
        a cache key