|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gif4j.ImageUtils
This class containts some useful image processing methods.
Constructor Summary | |
ImageUtils()
|
Method Summary | |
static java.awt.image.BufferedImage |
addInsets(java.awt.image.BufferedImage image,
java.awt.Insets insets,
java.awt.Paint paint)
Add the specified insets to the specified image and fill span between image and new borders with the specified Paint . |
static java.awt.image.BufferedImage |
borderWithPaint(java.awt.image.BufferedImage image,
int width,
int height,
java.awt.Paint paint)
Put the specified image into the center of rectangle (with the specified width and height) and fill span between image and rectangle's borders with the specified Paint .
|
static java.awt.image.BufferedImage |
scale(java.awt.image.BufferedImage source,
int newWidth,
int newHeight,
boolean proportionally)
Convenient static method to scale down (minimize) instance of BufferedImage to the specified size.
|
static java.awt.image.BufferedImage |
toBufferedImage(java.awt.Image image)
Convenient static method to convert Image instances to BufferedImage instances.
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ImageUtils()
Method Detail |
public static final java.awt.image.BufferedImage toBufferedImage(java.awt.Image image)
Image
instances to BufferedImage
instances.
If the specified image is already instance of BufferedImage
then it's returned without processing.
image
- image to convert if it's necessary
BufferedImage
or null if Image
loading process is failed
java.lang.NullPointerException
- image is nullImage
,
BufferedImage
public static final java.awt.image.BufferedImage scale(java.awt.image.BufferedImage source, int newWidth, int newHeight, boolean proportionally)
BufferedImage
to the specified size.
If source image size less then the specified then the method returns the source image without processing.
If 'proportionally' parameter is true then the specified image will scale proportionally and new size can be not exactly equal to the specified newWidth/newHeight.
source
- image to scale down (minimize)newWidth
- width which source image should be minimized to (the result image can have less width if 'proportionally' parameter set to true)newHeight
- height which source image should be minimized to (the result image can have less height if 'proportionally' parameter set to true)proportionally
- scale image proprotionally
BufferedImage
or source image if its' width and height less than the specified newWidth and newHeight
java.lang.NullPointerException
- If source image is nullBufferedImage
public static java.awt.image.BufferedImage borderWithPaint(java.awt.image.BufferedImage image, int width, int height, java.awt.Paint paint)
Paint
.
If image's size greater than the specified then the image is returned without processing.
image
- image to borderwidth
- rectangle width to put image intoheight
- rectangle height to put image intopaint
- paint to fill the span
BufferedImage
instance. If image's size greater than the specified then the image is returned without processing.
java.lang.NullPointerException
- If image is nullPaint
public static final java.awt.image.BufferedImage addInsets(java.awt.image.BufferedImage image, java.awt.Insets insets, java.awt.Paint paint)
Paint
.
image
- image to insetinsets
- instance of Insets
classpaint
- to fill the span
BufferedImage
instance with added insets.
java.lang.NullPointerException
- If image is nullInsets
,
Paint
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |