Class ImageUtilities
- java.lang.Object
-
- org.pushingpixels.radiance.theming.extras.internal.contrib.blogofbug.utility.ImageUtilities
-
public class ImageUtilities extends java.lang.Object
Static class with utility methods for images
-
-
Constructor Summary
Constructors Constructor Description ImageUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.image.BufferedImage
copyImage(java.awt.image.BufferedImage image)
Produces a copy of the supplied imagestatic java.awt.image.BufferedImage
createCompatibleImage(int width, int height)
Creates an image compatible with the current displaystatic java.awt.image.BufferedImage
loadCompatibleImage(java.lang.String imageURL)
Loads an image in a format compatible with the current displaystatic java.awt.image.BufferedImage
renderComponentToImage(javax.swing.JComponent component)
Renders a component into an image, which is useful for playing with the component's resultant image in special effects or transitionsstatic java.awt.image.BufferedImage
renderTextToImage(java.awt.Font font, java.awt.Color textColor, java.lang.String[] text, int width)
Renders multiple paragraphs of text in an array to an image (created and returned).static java.awt.image.BufferedImage
renderTextToImage(java.awt.Font font, java.awt.Color textColor, java.lang.String text, int width)
Renders a paragraph of text (line breaks ignored) to an image (created and returned).static java.awt.image.BufferedImage
scaledImage(java.awt.image.BufferedImage image, int width, int height)
Produces a resized image that is of the given dimensions
-
-
-
Method Detail
-
createCompatibleImage
public static java.awt.image.BufferedImage createCompatibleImage(int width, int height)
Creates an image compatible with the current display- Parameters:
width
- Image widthheight
- Image height- Returns:
- A BufferedImage with the appropriate color model
-
loadCompatibleImage
public static java.awt.image.BufferedImage loadCompatibleImage(java.lang.String imageURL)
Loads an image in a format compatible with the current display- Parameters:
imageURL
- Image URL- Returns:
- A BufferedImage with the appropriate color model
-
scaledImage
public static java.awt.image.BufferedImage scaledImage(java.awt.image.BufferedImage image, int width, int height)
Produces a resized image that is of the given dimensions- Parameters:
image
- The original imagewidth
- The desired widthheight
- The desired height- Returns:
- The new BufferedImage
-
copyImage
public static java.awt.image.BufferedImage copyImage(java.awt.image.BufferedImage image)
Produces a copy of the supplied image- Parameters:
image
- The original image- Returns:
- The new BufferedImage
-
renderTextToImage
public static java.awt.image.BufferedImage renderTextToImage(java.awt.Font font, java.awt.Color textColor, java.lang.String text, int width)
Renders a paragraph of text (line breaks ignored) to an image (created and returned).- Parameters:
font
- The font to usetextColor
- The color of the texttext
- The messagewidth
- The width the text should be limited to- Returns:
- An image with the text rendered into it
-
renderTextToImage
public static java.awt.image.BufferedImage renderTextToImage(java.awt.Font font, java.awt.Color textColor, java.lang.String[] text, int width)
Renders multiple paragraphs of text in an array to an image (created and returned).- Parameters:
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 to- Returns:
- An image with the text rendered into it
-
renderComponentToImage
public static java.awt.image.BufferedImage renderComponentToImage(javax.swing.JComponent component)
Renders a component into an image, which is useful for playing with the component's resultant image in special effects or transitions- Parameters:
component
- The component to render- Returns:
- A buffered image with the rendered component.
-
-