Package mgui.util

Class ImageFunctions

java.lang.Object
mgui.interfaces.Utility
mgui.util.ImageFunctions

public class ImageFunctions
extends Utility
Utility class for imaging-related functions.
Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Summary

    Fields
    Modifier and Type Field Description
    static int CENTERED  
    static int TOP_LEFT  
  • Constructor Summary

    Constructors
    Constructor Description
    ImageFunctions()  
  • Method Summary

    Modifier and Type Method Description
    static void fillImage​(java.awt.image.BufferedImage image, double value)
    Set all values in image to value
    static java.awt.image.BufferedImage getCopy​(java.awt.image.BufferedImage image)
    Returns a clone of image; i.e., a new instance with the same state.
    static javax.swing.filechooser.FileFilter getPngFileFilter()  
    protected static int getPowerOfTwo​(int value)  
    static java.awt.image.BufferedImage getPowerOfTwoImage​(java.awt.image.BufferedImage image, double filler, int pos)
    Returns a power-of-two dimensioned version of image, with its boundaries filled with filler.
    static java.awt.image.BufferedImage getResampledImage​(java.awt.image.BufferedImage image_to_scale, double scale_x, double scale_y)
    Resamples image_to_scale and returns the result
    static java.awt.image.BufferedImage getResampledImage​(java.awt.image.BufferedImage image_to_scale, int new_width, int new_height)
    Resamples image_to_scale and returns the result

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • ImageFunctions

      public ImageFunctions()
  • Method Details

    • fillImage

      public static void fillImage​(java.awt.image.BufferedImage image, double value)
      Set all values in image to value
      Parameters:
      image -
      value -
    • getPowerOfTwoImage

      public static java.awt.image.BufferedImage getPowerOfTwoImage​(java.awt.image.BufferedImage image, double filler, int pos)
      Returns a power-of-two dimensioned version of image, with its boundaries filled with filler.
      Parameters:
      image -
      filler -
      position - (one of CENTERED, TOP_LEFT, etc.)
      Returns:
    • getPowerOfTwo

      protected static int getPowerOfTwo​(int value)
    • getPngFileFilter

      public static javax.swing.filechooser.FileFilter getPngFileFilter()
    • getCopy

      public static java.awt.image.BufferedImage getCopy​(java.awt.image.BufferedImage image)
      Returns a clone of image; i.e., a new instance with the same state.
      Parameters:
      image -
      Returns:
    • getResampledImage

      public static java.awt.image.BufferedImage getResampledImage​(java.awt.image.BufferedImage image_to_scale, double scale_x, double scale_y)
      Resamples image_to_scale and returns the result
      Parameters:
      image_to_scale -
      new_width -
      new_height -
      Returns:
    • getResampledImage

      public static java.awt.image.BufferedImage getResampledImage​(java.awt.image.BufferedImage image_to_scale, int new_width, int new_height)
      Resamples image_to_scale and returns the result
      Parameters:
      image_to_scale -
      new_width -
      new_height -
      Returns: