|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectau.com.zip.cs.ImageUtil
public class ImageUtil
Assorted utility operations for Images.
| Field Summary | |
|---|---|
static int |
CENTER
|
static int |
EAST
|
static int |
NORTH
|
static int |
NORTHEAST
|
static int |
NORTHWEST
|
static int |
SOUTH
|
static int |
SOUTHEAST
|
static int |
SOUTHWEST
|
static int |
WEST
|
| Constructor Summary | |
|---|---|
ImageUtil()
|
|
| Method Summary | |
|---|---|
static Point |
alignTopLeft(int x,
int y,
int width,
int height,
int orientation)
Compute the top left Point for a rectangle
of the specified width and height
aligned with repect to the specified location (x,y)
using the supplied orientation. |
static BufferedImage |
copyImage(Image image)
Return a new BufferedImage containing a copy of the current contents of the supplied Image. |
static int |
getHeight(Image image)
Return the height of an Image. |
static Image |
getImage(String pathname)
Return a new Image attached to image file supplied. |
static int |
getWidth(Image image)
Return the width of an Image. |
static void |
label(Graphics g,
String text,
int x,
int y,
Color bg,
Color outline,
int orientation)
Write a text label for the specified coordinates. |
static void |
label(Image im,
String text,
double x,
double y,
Color fg,
Color bg,
Color outline,
int orientation)
Write a text label for the specified coordinates. |
static Rectangle |
labelBounds(Graphics g,
String text,
int x,
int y,
boolean outlined,
int orientation)
Compute the bounds of a text label for the specified coordinates aligned as for label(Graphics,String,int,int,Color,Color,int). |
static Rectangle |
labelBounds(Image im,
String text,
double x,
double y,
boolean outlined,
int orientation)
Compute the bounds of a text label for the specified coordinates aligned as for label(Graphics,String,int,int,Color,Color,int). |
static Image |
loadImage(String pathname)
Return a new Image attached to the image file supplied
but don't return until all pixels have been loaded. |
static int |
parseOrientation(String hint)
|
static RenderedImage |
renderImage(Image image)
Return a new RenderedImage from the supplied Image. |
static boolean |
saveImage(Image image,
String pathname,
String format)
Just a wrapper for ImageIO.write(RenderedImage,String,File)
that will accept an Image. |
static void |
waitFor(Image image,
int infoflags)
Wait for the specified flags to be available for this Image. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int CENTER
public static final int NORTH
public static final int SOUTH
public static final int EAST
public static final int WEST
public static final int NORTHEAST
public static final int NORTHWEST
public static final int SOUTHEAST
public static final int SOUTHWEST
| Constructor Detail |
|---|
public ImageUtil()
| Method Detail |
|---|
public static final Image getImage(String pathname)
Image attached to image file supplied.
pathname - the Image file pathname
public static final Image loadImage(String pathname)
Image attached to the image file supplied
but don't return until all pixels have been loaded.
pathname - the Image file pathname
null if interrupted
public static final void waitFor(Image image,
int infoflags)
throws InterruptedException
Image.
image - the Imageinfoflags - the property bitmask
InterruptedExceptionImageObserverThread,
ImageObserver
public static final boolean saveImage(Image image,
String pathname,
String format)
throws IOException,
InterruptedException
ImageIO.write(RenderedImage,String,File)
that will accept an Image.
image - the Image to savepathname - the pathname of the file in which to save
P@aram format the format of the file
IOException
InterruptedException
public static final int getWidth(Image image)
throws InterruptedException
Image.
Waits for the width to be available if necessary.
image - the Image
InterruptedException
public static final int getHeight(Image image)
throws InterruptedException
Image.
Waits for the height to be available if necessary.
image - the Image
InterruptedExceptionpublic static final RenderedImage renderImage(Image image)
RenderedImage from the supplied Image.
If the supplied image is a RenderedImage,
simply return it rather than making a new one.
image - the Image to render
null if interruptedpublic static final BufferedImage copyImage(Image image)
BufferedImage containing a copy of the current contents of the supplied Image.
image - the Image to copy
null if interruptedpublic static final int parseOrientation(String hint)
public static final void label(Image im,
String text,
double x,
double y,
Color fg,
Color bg,
Color outline,
int orientation)
throws InterruptedException
bg is not null.
Draw an outline for the rectangle if the outline is not null.
Align label according to the specified orientation,
which is an integer from the constants
CENTER,
NORTH,
SOUTH,
EAST,
WEST,
NORTHEAST,
NORTHWEST,
SOUTHEAST
or SOUTHWEST.
im - the Image on which to drawtext - the label to writex - the left location of the label rectangle, a ratio in the range 0.0 to 1.0y - the bottom location of the label rectangle, a ratio in the range 0.0 to 1.0fg - the foreground (text) Colorbg - the background Color, if anyoutline - the outline Color, if anyorientation - the orientation hint
InterruptedException
public static final void label(Graphics g,
String text,
int x,
int y,
Color bg,
Color outline,
int orientation)
bg is not null.
Draw an outline for the rectangle if the outline is not null.
Align label according to the specified orientation,
which is an integer from the constants
CENTER,
NORTH,
SOUTH,
EAST,
WEST,
NORTHEAST,
NORTHWEST,
SOUTHEAST
or SOUTHWEST.
g - the Graphics contexttext - the label to writex - the left location of the label rectangley - the bottom location of the label rectanglebg - the background Color, if anyoutline - the outline Color, if anyorientation - the orientation hint
public static final Rectangle labelBounds(Image im,
String text,
double x,
double y,
boolean outlined,
int orientation)
throws InterruptedException
label(Graphics,String,int,int,Color,Color,int).
im - the Image on which the label would be drawntext - the label to writex - the left location of the label rectangle, a ratio from 0.0 to 1.0y - the bottom location of the label rectangle, a ratio from 0.0 to 1.0outlined - whether the label is outlinedorientation - the orientation hint
InterruptedException
public static final Rectangle labelBounds(Graphics g,
String text,
int x,
int y,
boolean outlined,
int orientation)
label(Graphics,String,int,int,Color,Color,int).
g - the Graphics contexttext - the label to writex - the left location of the label rectangley - the bottom location of the label rectangleoutlined - whether the label is outlinedorientation - the orientation hint
public static final Point alignTopLeft(int x,
int y,
int width,
int height,
int orientation)
Point for a rectangle
of the specified width and height
aligned with repect to the specified location (x,y)
using the supplied orientation.
x - the horizontal ordinate of the alignment locationy - the vertical ordinate of the alignment locationwidth - the width of the rectangleheight - the height of the rectangleorientation - the orientation hint
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||