public class ImageUtils
extends java.lang.Object
Constructor and Description |
---|
ImageUtils() |
Modifier and Type | Method and Description |
---|---|
static java.awt.image.BufferedImage |
addTransparency(java.awt.image.BufferedImage image,
float alpha)
Create a new image with the specified transparency applied to the
original image.
|
static java.awt.image.BufferedImage |
bufferImage(java.awt.Image image)
Return a buffered image that contains the original image contents.
|
static java.awt.image.BufferedImage |
extractColors(java.awt.image.BufferedImage img,
java.util.Set<java.awt.Color> colors,
java.awt.Color replaceColor)
Extract the colors matching the color set into a new image.
|
static java.util.Set<java.awt.Color> |
getCloseColorsFromImage(java.awt.image.BufferedImage image,
java.awt.Color color)
Get the set of colors in an image that are "close" to a specified color.
|
static java.util.Set<java.awt.Color> |
getColors(java.awt.image.BufferedImage img)
Get the set of colors used in an image
|
static java.awt.image.BufferedImage |
selectTransparentColors(java.awt.image.BufferedImage image,
java.util.Set<java.awt.Color> colors)
Create a new image from an existing image by specifying the set of
colors that should be transparent.
|
public static java.awt.image.BufferedImage addTransparency(java.awt.image.BufferedImage image, float alpha)
image
- the original imagealpha
- the alpha value for the transparencypublic static java.awt.image.BufferedImage bufferImage(java.awt.Image image)
image
- the original imagepublic static java.awt.image.BufferedImage extractColors(java.awt.image.BufferedImage img, java.util.Set<java.awt.Color> colors, java.awt.Color replaceColor)
img
- the original imagecolors
- the set of colors to extract from the imagereplaceColor
- the color to replace the overlay colors with. If
null, the overlay colors are not replacedpublic static java.util.Set<java.awt.Color> getCloseColorsFromImage(java.awt.image.BufferedImage image, java.awt.Color color)
image
- the imagecolor
- the initial colorpublic static java.util.Set<java.awt.Color> getColors(java.awt.image.BufferedImage img)
img
- a buffered imagepublic static java.awt.image.BufferedImage selectTransparentColors(java.awt.image.BufferedImage image, java.util.Set<java.awt.Color> colors)
image
- the original imagecolors
- the colors that should be transparent.