public class ImageUtils extends Object
Modifier and Type | Field and Description |
---|---|
static Color |
COLOR_TRANSPARENT |
Constructor and Description |
---|
ImageUtils() |
Modifier and Type | Method and Description |
---|---|
static BufferedImage |
BufferedImage(Image img)
|
static BufferedImage |
BufferedImage(Image img,
ImageObserver observer,
int type)
Convert a
Image in a BufferedImage |
static BufferedImage |
BufferedImage(Image img,
int type)
Uses
ImageIcon to ensure that the image is completely loaded. |
static void |
clearImage(BufferedImage img,
Color clear)
Clear a
BufferedImage with the given color. |
static void |
clearImage(Graphics2D g2d,
int width,
int height,
Color clear)
Clears a
Graphics2D object with the given Color. |
static BufferedImage |
colorize(BufferedImage img,
Color c)
The given
BufferedImage will be colorized with the given Color . |
static BufferedImage |
copy(BufferedImage image)
Create a copy of an
BufferedImage . |
static Cursor |
createEmptyCursor(String name)
Create an invisible cursor
|
static BufferedImage |
createSprite(int frameWidth,
int frameHeight,
BufferedImage... frames)
Fetch single frames and connect them, so that you get a single sprite image.
|
static BufferedImage |
deepCopy(BufferedImage image)
Create a deep copy of an
BufferedImage . |
static BufferedImage |
getScaledInstance(Image img,
int width,
int height,
ImageObserver observer)
|
static BufferedImage |
getScaledInstance(Image img,
int width,
int height,
int type,
ImageObserver observer)
Get a scaled version of an image
|
static BufferedImage |
mirror(BufferedImage img,
boolean mirrorX,
boolean mirrorY)
Mirror a
BufferedImage . |
static BufferedImage |
shapeToImage(Shape shape,
Color shapeColor,
boolean fill)
Converts a
Shape into a BufferedImage |
static BufferedImage |
transform(BufferedImage img,
AffineTransform transformation)
Transform a
BufferedImage using an AffineTransform . |
public static final Color COLOR_TRANSPARENT
public static BufferedImage BufferedImage(Image img)
BufferedImage(Image, int)
public static BufferedImage BufferedImage(Image img, int type)
ImageIcon
to ensure that the image is completely loaded.BufferedImage(Image, ImageObserver, int)
public static BufferedImage BufferedImage(Image img, ImageObserver observer, int type)
Image
in a BufferedImage
img
- Image to convertobserver
- ImageObserver
type
- BufferedImage.TYPE_INT_ARGB
etc.public static BufferedImage getScaledInstance(Image img, int width, int height, ImageObserver observer)
public static BufferedImage getScaledInstance(Image img, int width, int height, int type, ImageObserver observer)
img
- The image to scalewidth
- New widthheight
- New heighttype
- The image type e.g. BufferedImage.TYPE_INT_ARGB
observer
- ImageObserver
public static void clearImage(BufferedImage img, Color clear)
BufferedImage
with the given color.img
- Image to be clearedclear
- Color used for clearing this object. Only this color will be presentclearImage(Graphics2D, int, int, Color)
public static void clearImage(Graphics2D g2d, int width, int height, Color clear)
Graphics2D
object with the given Color. Alpha values will replace the
current alpha. The resulting Graphics2D
object will be transparent.g2d
- Graphics2D
object to be clearedwidth
- Width of the areaheight
- Height of the areaclear
- Color used for clearing this object. Only this color will be presentpublic static BufferedImage shapeToImage(Shape shape, Color shapeColor, boolean fill)
Shape
into a BufferedImage
shape
- Shape do be drawnshapeColor
- Color in which the shape will be drawnfill
- if true the shape will be filled in. Otherwise only the outlines will be painted.public static BufferedImage deepCopy(BufferedImage image)
BufferedImage
. Properties will be dismissed. May fail.image
- Image to be copiedpublic static BufferedImage copy(BufferedImage image)
BufferedImage
.image
- Image to be copiedpublic static BufferedImage transform(BufferedImage img, AffineTransform transformation)
BufferedImage
using an AffineTransform
. The returned image is the
same as passed as Argument. All work is done direct on the image.public static BufferedImage mirror(BufferedImage img, boolean mirrorX, boolean mirrorY)
BufferedImage
. The returned image is a new BufferedImage.public static BufferedImage colorize(BufferedImage img, Color c)
BufferedImage
will be colorized with the given Color
. Brightness
will be used to modify the given color. public static BufferedImage createSprite(int frameWidth, int frameHeight, BufferedImage... frames)
frameWidth
- Width of one single frameframeHeight
- Height of one single frameframes
- The frames for the spriteCopyright © 2017. All rights reserved.