org.jhotdraw.util
Class Images
- java.lang.Object
-
- org.jhotdraw.util.Images
-
public class Images extends java.lang.ObjectImage processing methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static java.awt.ImagecreateImage(java.lang.Class baseClass, java.lang.String resourceName)static java.awt.ImagecreateImage(java.net.URL resource)static java.awt.image.BufferedImagegetScaledInstance(java.awt.Image image, int width, int height)Creates a scaled instanceof the image.static booleanhasAlpha(java.awt.Image image)This method returns true if the specified image has transparent pixels Code taken from the Java Developers Almanac 1.4 http://javaalmanac.com/egs/java.awt.image/HasAlpha.htmlstatic java.awt.image.BufferedImage[]split(java.awt.Image image, int count, boolean isHorizontal)Splits an image into count subimages.static java.awt.image.BufferedImagetoBufferedImage(java.awt.Image image)static java.awt.image.BufferedImagetoBufferedImage(java.awt.image.RenderedImage rImg)Converts an Image to BufferedImage.
-
-
-
Method Detail
-
createImage
public static java.awt.Image createImage(java.lang.Class baseClass, java.lang.String resourceName)
-
createImage
public static java.awt.Image createImage(java.net.URL resource)
-
toBufferedImage
public static java.awt.image.BufferedImage toBufferedImage(java.awt.image.RenderedImage rImg)
Converts an Image to BufferedImage. If the Image is already a BufferedImage, the same image is returned.- Parameters:
rImg- An Image.- Returns:
- A BufferedImage.
-
toBufferedImage
public static java.awt.image.BufferedImage toBufferedImage(java.awt.Image image)
-
hasAlpha
public static boolean hasAlpha(java.awt.Image image)
This method returns true if the specified image has transparent pixels Code taken from the Java Developers Almanac 1.4 http://javaalmanac.com/egs/java.awt.image/HasAlpha.html
-
split
public static java.awt.image.BufferedImage[] split(java.awt.Image image, int count, boolean isHorizontal)Splits an image into count subimages.
-
getScaledInstance
public static java.awt.image.BufferedImage getScaledInstance(java.awt.Image image, int width, int height)Creates a scaled instanceof the image.If either width or height is a negative number then a value is s ubstituted to maintain the aspect ratio of the original image dimensions. If both width and height are negative, then the original image dimensions are used.
On Mac OS X 10.6, this method has a much better performance than BufferedImage.getScaledInstance.
- Parameters:
image- the image.width- the width to which to scale the image.height- the height to which to scale the image.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG