|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Image
java.awt.image.BufferedImage
ch.aplu.util.GBitmap
public class GBitmap
GBitmap is a helper class derived from BufferedImage with some common bitmap transformation methods.
| Field Summary |
|---|
| Fields inherited from class java.awt.image.BufferedImage |
|---|
TYPE_3BYTE_BGR, TYPE_4BYTE_ABGR, TYPE_4BYTE_ABGR_PRE, TYPE_BYTE_BINARY, TYPE_BYTE_GRAY, TYPE_BYTE_INDEXED, TYPE_CUSTOM, TYPE_INT_ARGB, TYPE_INT_ARGB_PRE, TYPE_INT_BGR, TYPE_INT_RGB, TYPE_USHORT_555_RGB, TYPE_USHORT_565_RGB, TYPE_USHORT_GRAY |
| Fields inherited from class java.awt.Image |
|---|
SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty |
| Fields inherited from interface java.awt.Transparency |
|---|
BITMASK, OPAQUE, TRANSLUCENT |
| Constructor Summary | |
|---|---|
GBitmap(java.awt.image.ColorModel cm,
java.awt.image.WritableRaster raster,
boolean isRasterPremultiplied,
java.util.Hashtable properties)
Constructs a BufferedImage with a specified ColorModel and Raster. |
|
GBitmap(int width,
int height)
Constructs a BufferedImage of type BufferedImage.TYPE_INT_ARGB. |
|
GBitmap(int width,
int height,
int imageType)
Constructs a BufferedImage of one of the predefined image types. |
|
GBitmap(int width,
int height,
int imageType,
java.awt.image.IndexColorModel cm)
Constructs a BufferedImage of one of the predefined image types: TYPE_BYTE_BINARY or TYPE_BYTE_INDEXED. |
|
| Method Summary | |
|---|---|
static GBitmap |
crop(java.awt.image.BufferedImage bi,
int x1,
int y1,
int x2,
int y2)
Extracts the partial image if the given rectangular area. |
static GBitmap |
floodFill(java.awt.image.BufferedImage bi,
java.awt.Point pt,
java.awt.Color oldColor,
java.awt.Color newColor)
Fills a bounded single-colored region with the given color. |
static byte[] |
getByteArray(java.awt.image.BufferedImage sourceImage,
java.lang.String imageFormat)
Returns the image in a byte array. imageFormat is the informal name of the format (one of the strings returned by get SupportedImageFormats()). |
java.awt.Color |
getPixelColor(int[] pt)
Returns the color of the pixel at given point (defined as int array for Jython compatibility). |
java.awt.Color |
getPixelColor(int x,
int y)
Returns the color of the pixel at given x,y coordinates. |
java.lang.String |
getPixelColorStr(int[] pt)
Returns the X11 color name of the pixel at given point (defined as int array for Jython compatibility). |
java.lang.String |
getPixelColorStr(int x,
int y)
Returns the X11 color name of the pixel at given x,y coordinates. |
static java.lang.String[] |
getSupportedImageFormats()
Returns all supported image formats. |
static GBitmap |
paste(java.awt.image.BufferedImage original,
java.awt.image.BufferedImage replacement,
int xStart,
int yStart)
Returns a clone of the original image where a part is replaced by another image. |
static boolean |
save(java.awt.image.BufferedImage bi,
java.lang.String filename,
java.lang.String type)
Writes a image file of the given BufferedImage. |
static GBitmap |
scale(java.awt.image.BufferedImage bi,
double factor,
double angle)
Transforms the given buffered image by scaling by the given factor and rotating by the given angle. |
void |
setPixelColor(int[] pt,
java.awt.Color color)
Modifies the color of the pixel at given point (defined as int array for Jython compatibility). |
void |
setPixelColor(int x,
int y,
java.awt.Color color)
Modifies the color of the pixel at given x, y coordinates. |
void |
setPixelColorStr(int[] pt,
java.lang.String colorStr)
Modifies the color (defined as X11 color name) of the pixel at given point (defined as int array for Jython compatibility). |
void |
setPixelColorStr(int x,
int y,
java.lang.String colorStr)
Modifies the color (defined as X11 color name) of the pixel at given x, y coordinates. |
static GBitmap |
setTransparency(java.awt.image.BufferedImage bi,
double factor)
Returns a clone of the given image where each pixel has a new transparency value (alpha component in the ARGB color model). |
| Methods inherited from class java.awt.image.BufferedImage |
|---|
addTileObserver, coerceData, copyData, createGraphics, getAlphaRaster, getColorModel, getData, getData, getGraphics, getHeight, getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getNumXTiles, getNumYTiles, getProperty, getProperty, getPropertyNames, getRaster, getRGB, getRGB, getSampleModel, getSource, getSources, getSubimage, getTile, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getTransparency, getType, getWidth, getWidth, getWritableTile, getWritableTileIndices, hasTileWriters, isAlphaPremultiplied, isTileWritable, releaseWritableTile, removeTileObserver, setData, setRGB, setRGB, toString |
| Methods inherited from class java.awt.Image |
|---|
flush, getAccelerationPriority, getCapabilities, getScaledInstance, setAccelerationPriority |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public GBitmap(java.awt.image.ColorModel cm,
java.awt.image.WritableRaster raster,
boolean isRasterPremultiplied,
java.util.Hashtable properties)
public GBitmap(int width,
int height,
int imageType)
public GBitmap(int width,
int height)
public GBitmap(int width,
int height,
int imageType,
java.awt.image.IndexColorModel cm)
| Method Detail |
|---|
public java.awt.Color getPixelColor(int x,
int y)
public java.awt.Color getPixelColor(int[] pt)
public java.lang.String getPixelColorStr(int x,
int y)
public java.lang.String getPixelColorStr(int[] pt)
public void setPixelColor(int x,
int y,
java.awt.Color color)
public void setPixelColor(int[] pt,
java.awt.Color color)
public void setPixelColorStr(int x,
int y,
java.lang.String colorStr)
public void setPixelColorStr(int[] pt,
java.lang.String colorStr)
public static boolean save(java.awt.image.BufferedImage bi,
java.lang.String filename,
java.lang.String type)
bi - the given BufferedImage to copyfilename - the path to the image filetype - the image file format like "bmp", "gif", "jpg", "png" (all lowercase)
public static GBitmap floodFill(java.awt.image.BufferedImage bi,
java.awt.Point pt,
java.awt.Color oldColor,
java.awt.Color newColor)
bi - the BufferedImage containing the connected regionpt - a point inside the regionoldColor - the old color of the regionnewColor - the new color of the region
public static GBitmap setTransparency(java.awt.image.BufferedImage bi,
double factor)
bi - the original imagefactor - the transparency multiplier
public static GBitmap crop(java.awt.image.BufferedImage bi,
int x1,
int y1,
int x2,
int y2)
bi - the image where to extract the partial imagex1 - the x-coordinate of one of the rectangle vertexy1 - the y-coordinate of this vertexx2 - the x-coordinate of the opposite vertexy2 - the y-coordinate of this vertex
public static GBitmap paste(java.awt.image.BufferedImage original,
java.awt.image.BufferedImage replacement,
int xStart,
int yStart)
original - the original imagereplacement - the image to insertxStart - the upper left x-coordinate where the replacement startsyStart - the upper left y-coordinate where the replacement starts
public static GBitmap scale(java.awt.image.BufferedImage bi,
double factor,
double angle)
bi - the buffered image to transform (unchanged)factor - the zoom factor (>1 zoom-in, <1 zoom-out)angle - the rotation angle (in degrees clockwise)
public static java.lang.String[] getSupportedImageFormats()
public static byte[] getByteArray(java.awt.image.BufferedImage sourceImage,
java.lang.String imageFormat)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||