java.awt.image

Class BufferedImage

public class BufferedImage extends Image implements WritableRenderedImage, Transparency

A buffered image always starts at coordinates (0, 0). The buffered image is not subdivided into multiple tiles. Instead, the image consists of one large tile (0,0) with the width and height of the image. This tile is always considered to be checked out.
Field Summary
static intTYPE_3BYTE_BGR
static intTYPE_4BYTE_ABGR
static intTYPE_4BYTE_ABGR_PRE
static intTYPE_BYTE_BINARY
static intTYPE_BYTE_GRAY
static intTYPE_BYTE_INDEXED
static intTYPE_CUSTOM
static intTYPE_INT_ARGB
static intTYPE_INT_ARGB_PRE
static intTYPE_INT_BGR
static intTYPE_INT_RGB
static intTYPE_USHORT_555_RGB
static intTYPE_USHORT_565_RGB
static intTYPE_USHORT_GRAY
Constructor Summary
BufferedImage(int width, int height, int type)
Creates a new BufferedImage with the specified width, height and type.
BufferedImage(int w, int h, int type, IndexColorModel indexcolormodel)
BufferedImage(ColorModel colormodel, WritableRaster writableraster, boolean premultiplied, Hashtable<?,?> properties)
Method Summary
voidaddTileObserver(TileObserver to)
Adds a tile observer.
voidcoerceData(boolean premultiplied)
WritableRastercopyData(WritableRaster dest)
Graphics2DcreateGraphics()
voidflush()
WritableRastergetAlphaRaster()
ColorModelgetColorModel()
RastergetData()
RastergetData(Rectangle rectangle)
GraphicsgetGraphics()
intgetHeight()
intgetHeight(ImageObserver imageobserver)
intgetMinTileX()
intgetMinTileY()
intgetMinX()
intgetMinY()
intgetNumXTiles()
intgetNumYTiles()
ObjectgetProperty(String string)
Returns the value of the specified property, or {@link Image#UndefinedProperty} if the property is not defined.
ObjectgetProperty(String string, ImageObserver imageobserver)
String[]getPropertyNames()
Returns null always.
WritableRastergetRaster()
intgetRGB(int x, int y)
int[]getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scanlineStride)
SampleModelgetSampleModel()
ImageProducergetSource()
Vector<RenderedImage>getSources()
BufferedImagegetSubimage(int x, int y, int w, int h)
RastergetTile(int tileX, int tileY)
intgetTileGridXOffset()
intgetTileGridYOffset()
intgetTileHeight()
intgetTileWidth()
intgetTransparency()
Return the transparency type.
intgetType()
intgetWidth()
intgetWidth(ImageObserver imageobserver)
WritableRastergetWritableTile(int tileX, int tileY)
Point[]getWritableTileIndices()
booleanhasTileWriters()
booleanisAlphaPremultiplied()
booleanisTileWritable(int tileX, int tileY)
voidreleaseWritableTile(int tileX, int tileY)
voidremoveTileObserver(TileObserver to)
Removes a tile observer.
voidsetData(Raster src)
voidsetRGB(int x, int y, int argb)
voidsetRGB(int startX, int startY, int w, int h, int[] argbArray, int offset, int scanlineStride)
StringtoString()

Field Detail

TYPE_3BYTE_BGR

public static final int TYPE_3BYTE_BGR

TYPE_4BYTE_ABGR

public static final int TYPE_4BYTE_ABGR

TYPE_4BYTE_ABGR_PRE

public static final int TYPE_4BYTE_ABGR_PRE

TYPE_BYTE_BINARY

public static final int TYPE_BYTE_BINARY

TYPE_BYTE_GRAY

public static final int TYPE_BYTE_GRAY

TYPE_BYTE_INDEXED

public static final int TYPE_BYTE_INDEXED

TYPE_CUSTOM

public static final int TYPE_CUSTOM

TYPE_INT_ARGB

public static final int TYPE_INT_ARGB

TYPE_INT_ARGB_PRE

public static final int TYPE_INT_ARGB_PRE

TYPE_INT_BGR

public static final int TYPE_INT_BGR

TYPE_INT_RGB

public static final int TYPE_INT_RGB

TYPE_USHORT_555_RGB

public static final int TYPE_USHORT_555_RGB

TYPE_USHORT_565_RGB

public static final int TYPE_USHORT_565_RGB

TYPE_USHORT_GRAY

public static final int TYPE_USHORT_GRAY

Constructor Detail

BufferedImage

public BufferedImage(int width, int height, int type)
Creates a new BufferedImage with the specified width, height and type. Valid type values are:

Parameters: width the width (must be > 0). height the height (must be > 0). type the image type (see the list of valid types above).

Throws: IllegalArgumentException if width or height is less than or equal to zero. IllegalArgumentException if type is not one of the specified values.

BufferedImage

public BufferedImage(int w, int h, int type, IndexColorModel indexcolormodel)

BufferedImage

public BufferedImage(ColorModel colormodel, WritableRaster writableraster, boolean premultiplied, Hashtable<?,?> properties)

Method Detail

addTileObserver

public void addTileObserver(TileObserver to)
Adds a tile observer. If the observer is already present, it receives multiple notifications.

Parameters: to The TileObserver to add.

coerceData

public void coerceData(boolean premultiplied)

copyData

public WritableRaster copyData(WritableRaster dest)

createGraphics

public Graphics2D createGraphics()

flush

public void flush()

getAlphaRaster

public WritableRaster getAlphaRaster()

getColorModel

public ColorModel getColorModel()

getData

public Raster getData()

getData

public Raster getData(Rectangle rectangle)

getGraphics

public Graphics getGraphics()

getHeight

public int getHeight()

getHeight

public int getHeight(ImageObserver imageobserver)

getMinTileX

public int getMinTileX()

getMinTileY

public int getMinTileY()

getMinX

public int getMinX()

getMinY

public int getMinY()

getNumXTiles

public int getNumXTiles()

getNumYTiles

public int getNumYTiles()

getProperty

public Object getProperty(String string)
Returns the value of the specified property, or {@link Image#UndefinedProperty} if the property is not defined.

Parameters: string the property key (null not permitted).

Returns: The property value.

Throws: NullPointerException if string is null.

getProperty

public Object getProperty(String string, ImageObserver imageobserver)

getPropertyNames

public String[] getPropertyNames()
Returns null always.

Returns: null always.

getRaster

public WritableRaster getRaster()

getRGB

public int getRGB(int x, int y)

getRGB

public int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scanlineStride)

getSampleModel

public SampleModel getSampleModel()

getSource

public ImageProducer getSource()

getSources

public Vector<RenderedImage> getSources()

getSubimage

public BufferedImage getSubimage(int x, int y, int w, int h)

getTile

public Raster getTile(int tileX, int tileY)

getTileGridXOffset

public int getTileGridXOffset()

getTileGridYOffset

public int getTileGridYOffset()

getTileHeight

public int getTileHeight()

getTileWidth

public int getTileWidth()

getTransparency

public int getTransparency()
Return the transparency type.

Returns: One of {@link #OPAQUE}, {@link #BITMASK}, or {@link #TRANSLUCENT}.

Since: 1.5

See Also: getTransparency

getType

public int getType()

getWidth

public int getWidth()

getWidth

public int getWidth(ImageObserver imageobserver)

getWritableTile

public WritableRaster getWritableTile(int tileX, int tileY)

getWritableTileIndices

public Point[] getWritableTileIndices()

hasTileWriters

public boolean hasTileWriters()

isAlphaPremultiplied

public boolean isAlphaPremultiplied()

isTileWritable

public boolean isTileWritable(int tileX, int tileY)

releaseWritableTile

public void releaseWritableTile(int tileX, int tileY)

removeTileObserver

public void removeTileObserver(TileObserver to)
Removes a tile observer. If the observer was not registered, nothing happens. If the observer was registered for multiple notifications, it is now registered for one fewer notification.

Parameters: to The TileObserver to remove.

setData

public void setData(Raster src)

setRGB

public void setRGB(int x, int y, int argb)

setRGB

public void setRGB(int startX, int startY, int w, int h, int[] argbArray, int offset, int scanlineStride)

toString

public String toString()