|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthelma.image.ImageWrapper
public class ImageWrapper
Abstract base class for Image Wrappers.
Field Summary | |
---|---|
protected ImageGenerator |
generator
|
protected int |
height
|
protected java.awt.Image |
image
|
protected int |
width
|
Constructor Summary | |
---|---|
ImageWrapper(java.awt.Image image,
ImageGenerator generator)
|
|
ImageWrapper(java.awt.Image image,
int width,
int height,
ImageGenerator generator)
Creates a new ImageWrapper object. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Creates and returns a copy of this image. |
void |
crop(int x,
int y,
int w,
int h)
Crops the image. |
void |
dispose()
Dispose the Graphics context and null out the image. |
void |
drawImage(ImageWrapper image,
java.awt.geom.AffineTransform at)
Draws another image to this image. |
void |
drawImage(ImageWrapper image,
int x,
int y)
Draws another image to this image. |
void |
drawImage(java.lang.String filename,
int x,
int y)
Draws another image to this image. |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draws a line to this image from x1/y1 to x2/y2. |
void |
drawRect(int x,
int y,
int w,
int h)
Draws a rectangle to this image. |
void |
drawString(java.lang.String str,
int x,
int y)
Draws a string to this image at the given coordinates. |
void |
fillRect(int x,
int y,
int w,
int h)
Draws a filled rectangle to this image. |
java.awt.image.BufferedImage |
getBufferedImage()
Converts the internal image object to a BufferedImage (if it's not already) and returns it. |
java.awt.Graphics2D |
getGraphics()
Returns the Graphics object to directly paint to this Image. |
int |
getHeight()
Returns the height of this image. |
java.awt.Image |
getImage()
Returns the Image object represented by this ImageWrapper. |
int |
getPixel(int x,
int y)
Returns the pixel at x, y. |
java.awt.image.ImageProducer |
getSource()
Returns the ImageProducer of the wrapped image |
int |
getWidth()
Returns the width of this image. |
void |
reduceColors(int colors)
Reduces the colors used in the image. |
void |
reduceColors(int colors,
boolean dither)
Reduces the colors used in the image. |
void |
reduceColors(int colors,
boolean dither,
boolean alphaToBitmask)
Reduce the colors used in this image. |
void |
resize(int w,
int h)
Resize the image |
protected void |
resize(int w,
int h,
boolean smooth)
resizes the image using the Graphics2D approach |
void |
resizeFast(int w,
int h)
Resize the image, using a fast and cheap algorithm |
void |
saveAs(java.io.OutputStream out,
java.lang.String mimeType)
Saves the image. |
void |
saveAs(java.io.OutputStream out,
java.lang.String mimeType,
float quality)
Saves the image. |
void |
saveAs(java.io.OutputStream out,
java.lang.String mimeType,
float quality,
boolean alpha)
Saves the image. |
void |
saveAs(java.lang.String filename)
Save the image. |
void |
saveAs(java.lang.String filename,
float quality)
Saves the image. |
void |
saveAs(java.lang.String filename,
float quality,
boolean alpha)
Saves the image. |
void |
setColor(java.awt.Color color)
Sets the color used to write/paint to this image. |
void |
setColor(int color)
Sets the color used to write/paint to this image. |
void |
setColor(int red,
int green,
int blue)
Sets the color used to write/paint to this image. |
void |
setColor(java.lang.String color)
Sets the color used to write/paint to this image. |
void |
setFont(java.lang.String name,
int style,
int size)
Set the font used to write on this image. |
protected void |
setImage(java.awt.Image img)
Sets the internal image and clears the stored graphics object. |
void |
setTransparentPixel(int trans)
Sets the palette index of the transparent color for Images with an IndexColorModel. |
void |
trim(int x,
int y)
Trims the image. |
void |
trim(int x,
int y,
boolean trimLeft,
boolean trimTop,
boolean trimRight,
boolean trimBottom)
Trims the image. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.awt.Image image
protected int width
protected int height
protected ImageGenerator generator
Constructor Detail |
---|
public ImageWrapper(java.awt.Image image, int width, int height, ImageGenerator generator)
image
- ...width
- ...height
- ...public ImageWrapper(java.awt.Image image, ImageGenerator generator)
Method Detail |
---|
public java.awt.image.BufferedImage getBufferedImage()
public java.awt.Graphics2D getGraphics()
protected void setImage(java.awt.Image img)
public java.lang.Object clone()
clone
in class java.lang.Object
public java.awt.Image getImage()
public java.awt.image.ImageProducer getSource()
public void dispose()
public void setFont(java.lang.String name, int style, int size)
public void setColor(int red, int green, int blue)
red
- ...green
- ...blue
- ...public void setColor(int color)
color
- ...public void setColor(java.awt.Color color)
color
- ...public void setColor(java.lang.String color)
color
- ...public void drawString(java.lang.String str, int x, int y)
str
- ...x
- ...y
- ...public void drawLine(int x1, int y1, int x2, int y2)
x1
- ...y1
- ...x2
- ...y2
- ...public void drawRect(int x, int y, int w, int h)
x
- ...y
- ...w
- ...h
- ...public void drawImage(java.lang.String filename, int x, int y) throws java.io.IOException
filename
- ...x
- ...y
- ...
java.io.IOException
public void drawImage(ImageWrapper image, int x, int y) throws java.io.IOException
image
- ...x
- ...y
- ...
java.io.IOException
public void drawImage(ImageWrapper image, java.awt.geom.AffineTransform at) throws java.io.IOException
image
- ...at
- ...
java.io.IOException
public void fillRect(int x, int y, int w, int h)
x
- ...y
- ...w
- ...h
- ...public int getWidth()
public int getHeight()
public void crop(int x, int y, int w, int h)
x
- ...y
- ...w
- ...h
- ...public void trim(int x, int y)
x
- the x-coordinate of the pixel specifying the background colory
- the y-coordinate of the pixel specifying the background colorpublic void trim(int x, int y, boolean trimLeft, boolean trimTop, boolean trimRight, boolean trimBottom)
x
- y
- trimLeft
- trimTop
- trimRight
- trimBottom
- protected void resize(int w, int h, boolean smooth)
public void resize(int w, int h)
w
- ...h
- ...public void resizeFast(int w, int h)
w
- ...h
- ...public void reduceColors(int colors)
colors
- colors the number of colors to use, usually <= 256.public void reduceColors(int colors, boolean dither)
colors
- colors the number of colors to use, usually <= 256.dither
- ...public void reduceColors(int colors, boolean dither, boolean alphaToBitmask)
colors
- the number of colors to use, usually <= 256.dither
- ...alphaToBitmask
- ...public void saveAs(java.lang.String filename) throws java.io.IOException
filename
- ...
java.io.IOException
public void saveAs(java.lang.String filename, float quality) throws java.io.IOException
filename
- ...quality
- ...
java.io.IOException
public void saveAs(java.lang.String filename, float quality, boolean alpha) throws java.io.IOException
filename
- ...quality
- ...alpha
- ...
java.io.IOException
public void saveAs(java.io.OutputStream out, java.lang.String mimeType) throws java.io.IOException
out
- ...mimeType
- ...
java.io.IOException
public void saveAs(java.io.OutputStream out, java.lang.String mimeType, float quality) throws java.io.IOException
out
- ...mimeType
- ...quality
- ...
java.io.IOException
public void saveAs(java.io.OutputStream out, java.lang.String mimeType, float quality, boolean alpha) throws java.io.IOException
out
- ...mimeType
- ...quality
- ...alpha
- ...
java.io.IOException
public void setTransparentPixel(int trans)
getPixel(int, int)
.
public int getPixel(int x, int y)
x
- the x coordinate of the pixely
- the y coordinate of the pixel
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |