public class ImageUtilities extends Object
Constructor | Description |
---|---|
ImageUtilities() |
Modifier and Type | Method | Description |
---|---|---|
static BufferedImage |
copyImage(BufferedImage image) |
Produces a copy of the supplied image
|
static BufferedImage |
createCompatibleImage(int width,
int height) |
Creates an image compatible with the current display
|
static BufferedImage |
loadCompatibleImage(String imageURL) |
Loads an image in a format compatible with the current display
|
static BufferedImage |
renderComponentToImage(JComponent component) |
Renders a component into an image, which is useful for playing with the component's
resultant image in special effects or transitions
|
static BufferedImage |
renderTextToImage(Font font,
Color textColor,
String[] text,
int width) |
Renders multiple paragraphs of text in an array to an image (created and returned).
|
static BufferedImage |
renderTextToImage(Font font,
Color textColor,
String text,
int width) |
Renders a paragraph of text (line breaks ignored) to an image (created and returned).
|
static BufferedImage |
scaledImage(BufferedImage image,
int width,
int height) |
Produces a resized image that is of the given dimensions
|
public static BufferedImage createCompatibleImage(int width, int height)
public static BufferedImage loadCompatibleImage(String imageURL)
public static BufferedImage scaledImage(BufferedImage image, int width, int height)
image
- The original imagewidth
- The desired widthheight
- The desired heightpublic static BufferedImage copyImage(BufferedImage image)
image
- The original imagepublic static BufferedImage renderTextToImage(Font font, Color textColor, String text, int width)
font
- The font to usetextColor
- The color of the texttext
- The messagewidth
- The width the text should be limited topublic static BufferedImage renderTextToImage(Font font, Color textColor, String[] text, int width)
font
- The font to usetextColor
- The color of the texttext
- The message in an array of strings (one paragraph in eachwidth
- The width the text should be limited topublic static BufferedImage renderComponentToImage(JComponent component)
component
- The component to render