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
-
Constructor Summary
Constructors Constructor Description ImageFunctions() -
Method Summary
Modifier and Type Method Description static voidfillImage(java.awt.image.BufferedImage image, double value)Set all values in image to valuestatic java.awt.image.BufferedImagegetCopy(java.awt.image.BufferedImage image)Returns a clone ofimage; i.e., a new instance with the same state.static javax.swing.filechooser.FileFiltergetPngFileFilter()protected static intgetPowerOfTwo(int value)static java.awt.image.BufferedImagegetPowerOfTwoImage(java.awt.image.BufferedImage image, double filler, int pos)Returns a power-of-two dimensioned version ofimage, with its boundaries filled withfiller.static java.awt.image.BufferedImagegetResampledImage(java.awt.image.BufferedImage image_to_scale, double scale_x, double scale_y)Resamplesimage_to_scaleand returns the resultstatic java.awt.image.BufferedImagegetResampledImage(java.awt.image.BufferedImage image_to_scale, int new_width, int new_height)Resamplesimage_to_scaleand returns the resultMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
CENTERED
public static final int CENTERED- See Also:
- Constant Field Values
-
TOP_LEFT
public static final int TOP_LEFT- See Also:
- Constant Field Values
-
-
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 ofimage, with its boundaries filled withfiller.- 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 ofimage; 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)Resamplesimage_to_scaleand 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)Resamplesimage_to_scaleand returns the result- Parameters:
image_to_scale-new_width-new_height-- Returns:
-