|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.ui.ImageUtils
public class ImageUtils
Provides a set of image manipulation utilities
| Field Summary | |
|---|---|
static boolean |
debug
debug flag |
| Constructor Summary | |
|---|---|
ImageUtils()
|
|
| Method Summary | |
|---|---|
static BufferedImage |
clip(BufferedImage image,
int[] ul,
int[] lr)
Clip the image |
static String |
convertImageTo(String file,
String newType)
Convert an image to a new type |
static JEditorPane |
getEditor(JEditorPane editor,
String html,
int width,
Color transparentColor,
Font font)
Make a editor pane from the html |
static JEditorPane |
getEditor(String html,
int width,
Color transparentColor,
Font font)
Make a editor pane from the html |
static Image |
getImage(Component component)
Get the screen image from the component |
static Image |
getImage(JEditorPane editor,
Color transparentColor)
Get an image from the component |
static Image |
getImageFile(String file)
Read in the image from the given filename or url |
static Image |
gridImages(List images,
int space,
Color bg,
int columns)
Merge images |
static boolean |
hasAlpha(Image image)
Check to see if the image has alpha |
static BufferedImage |
horizontalflip(BufferedImage img)
Flip the image horizontally From: Josiah Hester - http://www.javalobby.org/articles/ultimate-image |
static boolean |
isImage(String file)
Is the file name an image |
static void |
main(String[] args)
Read in the image. |
static BufferedImage |
makeColorTransparent(Image im,
Color c)
Make a color in the image transparent |
static BufferedImage |
makeColorTransparent(Image im,
int[] redRange,
int[] greenRange,
int[] blueRange)
Set the colors taht are within the given red, green and blue ranges to be transparent. |
static BufferedImage |
matte(BufferedImage image,
int top,
int bottom,
int left,
int right,
Color bg)
Add a matte border around the image |
static Image |
mergeImages(List images,
int space,
Color bg)
Merge images |
static Point |
parsePoint(String s,
Rectangle r)
Parse the string specification of a point with respect to the rectangle. |
static Image |
readImage(String imagePath)
Read and image |
static Image |
readImage(String imagePath,
boolean cache)
Read and image |
static Image |
readImage(String imagePath,
boolean cache,
boolean returnNullIfNotFound)
Read and image |
static BufferedImage |
removeRedeye(Image im,
int x1,
int y1,
int x2,
int y2)
Remove the brighter red from the image |
static Image |
renderHtml(String html,
int width,
Color transparentColor,
Font font)
Render the given html and return an image |
static Image |
resize(Image image,
int width,
int height)
Resize an image |
static BufferedImage |
rotate90(BufferedImage img,
boolean left)
Rotate the image 90 degrees |
static BufferedImage |
setAlpha(Image im,
double percent)
Set the alpha channel to the given transparency percent |
static int |
toAlpha(double percent)
Change the transparency percentage into an int alpha value |
static BufferedImage |
toBufferedImage(Image image)
This method returns a buffered image with the contents of an image |
static BufferedImage |
toBufferedImage(Image image,
boolean force)
This method returns a buffered image with the contents of an image |
static BufferedImage |
toBufferedImage(Image image,
int type)
Create a BufferedImage from the given image |
static Point |
toPoint(Point2D p)
convenience to convert to a Point |
static BufferedImage |
verticalflip(BufferedImage img)
Flip the image vertically From: Josiah Hester - http://www.javalobby.org/articles/ultimate-image |
static Image |
waitOnImage(Image image)
Wait until it is loaded in. |
static void |
writeAvi(List imageFiles,
double frameRateInFPS,
File outFile)
Write an AVI file |
static boolean |
writeImage(JDialog window,
String file)
Make a screen capture of the window. |
static boolean |
writeImage(JFrame window,
String file)
Make a screen capture of the window. |
static void |
writeImageToFile(Component component,
String saveFile)
Take a screen snapshot of the component. |
static void |
writeImageToFile(Image image,
File saveFile)
Write a Buffered image to a file |
static void |
writeImageToFile(Image image,
String saveFile)
Write a Buffered image to a file |
static void |
writeImageToFile(Image image,
String saveFile,
float quality)
Write a Buffered image to a file at a particular quality |
static void |
writeImageToFile(Image image,
String saveFile,
OutputStream os,
float quality)
Write a Buffered image to a file at a particular quality |
static void |
writePDF(OutputStream out,
JComponent comp)
test code |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static boolean debug
| Constructor Detail |
|---|
public ImageUtils()
| Method Detail |
|---|
public static BufferedImage matte(BufferedImage image,
int top,
int bottom,
int left,
int right,
Color bg)
image - The imagetop - top spacebottom - bottom spaceleft - left spaceright - right spacebg - Background color
public static BufferedImage clip(BufferedImage image,
int[] ul,
int[] lr)
image - The imageul - upper leftlr - lower right
public static Image readImage(String imagePath)
imagePath - the path to the image
public static Image readImage(String imagePath,
boolean cache)
imagePath - the path to the imagecache - Cache the image
public static Image readImage(String imagePath,
boolean cache,
boolean returnNullIfNotFound)
imagePath - the path to the imagecache - Cache the imagereturnNullIfNotFound - if true, return null if the image does not exist
public static Image waitOnImage(Image image)
image - the image
public static BufferedImage makeColorTransparent(Image im,
Color c)
im - imagec - the color to make transparent
public static BufferedImage makeColorTransparent(Image im,
int[] redRange,
int[] greenRange,
int[] blueRange)
im - The imageredRange - red rangegreenRange - green rangeblueRange - blue range
public static BufferedImage removeRedeye(Image im,
int x1,
int y1,
int x2,
int y2)
im - imagex1 - boundsy1 - boundsx2 - boundsy2 - bounds
public static int toAlpha(double percent)
percent - the percent transparent 0-1.0
public static BufferedImage setAlpha(Image im,
double percent)
im - imagepercent - Percent transparent 0-1.0
public static Point toPoint(Point2D p)
p - point
public static Point parsePoint(String s,
Rectangle r)
ul um ur ml mm mr ll lm lrWhere u=upper,m=middle,l=lower r=right,l=left
s - Stirng specr - Reference rect
public static BufferedImage toBufferedImage(Image image)
image - the image
public static BufferedImage toBufferedImage(Image image,
boolean force)
image - the imageforce - If false then just return the image argument if its a BufferedImage
public static Image mergeImages(List images,
int space,
Color bg)
images - list of imagesspace - space between imagesbg - background color
public static Image gridImages(List images,
int space,
Color bg,
int columns)
images - list of imagesspace - space between imagesbg - background colorcolumns - number of columns
public static BufferedImage toBufferedImage(Image image,
int type)
image - The imagetype - BufferedImage type
public static boolean hasAlpha(Image image)
image - the image
public static Image getImage(Component component)
throws Exception
component - The component.
Exception
public static void writeImageToFile(Image image,
File saveFile)
throws Exception
image - image to writesaveFile - file to write to
Exception - problem writing file
public static void writeImageToFile(Image image,
String saveFile)
throws Exception
image - image to writesaveFile - file to write to
Exception - problem writing filepublic static BufferedImage horizontalflip(BufferedImage img)
img - image
public static BufferedImage verticalflip(BufferedImage img)
img - image
public static BufferedImage rotate90(BufferedImage img,
boolean left)
img - imageleft - rotate counter clockwise
public static String convertImageTo(String file,
String newType)
file - image filenewType - new image type
public static void writeImageToFile(Image image,
String saveFile,
float quality)
throws Exception
image - image to writesaveFile - file to write toquality - image quality (if supported)
Exception - problem writing file
public static void writeImageToFile(Image image,
String saveFile,
OutputStream os,
float quality)
throws Exception
image - image to writeos - output streamquality - image quality (if supported)
Exception - problem writing filepublic static boolean isImage(String file)
file - file
public static boolean writeImage(JDialog window,
String file)
throws Exception
window - The windowfile - The file
Exception
public static boolean writeImage(JFrame window,
String file)
throws Exception
window - The windowfile - The file
Exception
public static void writeImageToFile(Component component,
String saveFile)
throws Exception
component - The component.saveFile - The file.
Exception
public static void writeAvi(List imageFiles,
double frameRateInFPS,
File outFile)
throws IOException
imageFiles - list of filesframeRateInFPS - frame rateoutFile - output file
IOException - problem writing AVI
public static Image resize(Image image,
int width,
int height)
image - the imagewidth - new widthheight - new height
public static Image getImage(JEditorPane editor,
Color transparentColor)
throws Exception
editor - componenttransparentColor - if non null then set this color to be transparent
Exception - on badness
public static Image renderHtml(String html,
int width,
Color transparentColor,
Font font)
throws Exception
html - html to renderwidth - image widthtransparentColor - if non null set this color in the image to be transparentfont - font to render with
Exception - on badness
public static JEditorPane getEditor(String html,
int width,
Color transparentColor,
Font font)
throws Exception
html - htmlwidth - widthtransparentColor - what color to set as transparentfont - font
Exception - on badness
public static JEditorPane getEditor(JEditorPane editor,
String html,
int width,
Color transparentColor,
Font font)
throws Exception
editor - Initial editorhtml - htmlwidth - widthtransparentColor - what color to set as transparentfont - font
Exception - on badness
public static void writePDF(OutputStream out,
JComponent comp)
throws IOException
out - testcomp - test
IOException - test
public static void main(String[] args)
throws Exception
args - args
Exception - problem with this
public static Image getImageFile(String file)
throws Exception
file - File or url
Exception - On badness
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||