public class BufferedImage extends Image implements WritableRenderedImage, Transparency
| Modifier and Type | Field and Description |
|---|---|
static int |
TYPE_3BYTE_BGR |
static int |
TYPE_4BYTE_ABGR |
static int |
TYPE_4BYTE_ABGR_PRE |
static int |
TYPE_BYTE_BINARY |
static int |
TYPE_BYTE_GRAY |
static int |
TYPE_BYTE_INDEXED |
static int |
TYPE_CUSTOM |
static int |
TYPE_INT_ARGB |
static int |
TYPE_INT_ARGB_PRE |
static int |
TYPE_INT_BGR |
static int |
TYPE_INT_RGB |
static int |
TYPE_USHORT_555_RGB |
static int |
TYPE_USHORT_565_RGB |
static int |
TYPE_USHORT_GRAY |
accelerationPriority, SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedPropertyBITMASK, OPAQUE, TRANSLUCENT| Constructor and Description |
|---|
BufferedImage(ColorModel colormodel,
WritableRaster writableraster,
boolean premultiplied,
Hashtable<?,?> properties) |
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) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTileObserver(TileObserver to)
Adds a tile observer.
|
void |
coerceData(boolean premultiplied) |
WritableRaster |
copyData(WritableRaster dest) |
Graphics2D |
createGraphics() |
void |
flush()
Flushes (that is, destroys) any resources used for this image.
|
WritableRaster |
getAlphaRaster() |
ColorModel |
getColorModel() |
Raster |
getData() |
Raster |
getData(Rectangle rectangle) |
Graphics |
getGraphics()
Returns a graphics context object for drawing an off-screen object.
|
int |
getHeight() |
int |
getHeight(ImageObserver imageobserver)
Returns the height of the image, or -1 if it is unknown.
|
int |
getMinTileX() |
int |
getMinTileY() |
int |
getMinX() |
int |
getMinY() |
int |
getNumXTiles() |
int |
getNumYTiles() |
Object |
getProperty(String string)
Returns the value of the specified property, or
Image.UndefinedProperty if the property is not defined. |
Object |
getProperty(String string,
ImageObserver imageobserver)
This method requests a named property for an object.
|
String[] |
getPropertyNames()
Returns
null always. |
WritableRaster |
getRaster() |
int |
getRGB(int x,
int y) |
int[] |
getRGB(int startX,
int startY,
int w,
int h,
int[] rgbArray,
int offset,
int scanlineStride) |
SampleModel |
getSampleModel() |
ImageProducer |
getSource()
Returns the image producer object for this object.
|
Vector<RenderedImage> |
getSources() |
BufferedImage |
getSubimage(int x,
int y,
int w,
int h) |
Raster |
getTile(int tileX,
int tileY) |
int |
getTileGridXOffset() |
int |
getTileGridYOffset() |
int |
getTileHeight() |
int |
getTileWidth() |
int |
getTransparency()
Return the transparency type.
|
int |
getType() |
int |
getWidth() |
int |
getWidth(ImageObserver imageobserver)
Returns the width of the image, or -1 if it is unknown.
|
WritableRaster |
getWritableTile(int tileX,
int tileY) |
Point[] |
getWritableTileIndices() |
boolean |
hasTileWriters() |
boolean |
isAlphaPremultiplied() |
boolean |
isTileWritable(int tileX,
int tileY) |
void |
releaseWritableTile(int tileX,
int tileY) |
void |
removeTileObserver(TileObserver to)
Removes a tile observer.
|
void |
setData(Raster src) |
void |
setRGB(int x,
int y,
int argb) |
void |
setRGB(int startX,
int startY,
int w,
int h,
int[] argbArray,
int offset,
int scanlineStride) |
String |
toString()
Convert this Object to a human-readable String.
|
getAccelerationPriority, getScaledInstance, setAccelerationPrioritypublic static final int TYPE_CUSTOM
public static final int TYPE_INT_RGB
public static final int TYPE_INT_ARGB
public static final int TYPE_INT_ARGB_PRE
public static final int TYPE_INT_BGR
public static final int TYPE_3BYTE_BGR
public static final int TYPE_4BYTE_ABGR
public static final int TYPE_4BYTE_ABGR_PRE
public static final int TYPE_USHORT_565_RGB
public static final int TYPE_USHORT_555_RGB
public static final int TYPE_BYTE_GRAY
public static final int TYPE_USHORT_GRAY
public static final int TYPE_BYTE_BINARY
public static final int TYPE_BYTE_INDEXED
public BufferedImage(int width, int height, int type)
BufferedImage with the specified width, height
and type. Valid type values are:
width - the width (must be > 0).height - the height (must be > 0).type - the image type (see the list of valid types above).IllegalArgumentException - if width or
height is less than or equal to zero.IllegalArgumentException - if type is not one of the
specified values.public BufferedImage(int w, int h, int type, IndexColorModel indexcolormodel)
public BufferedImage(ColorModel colormodel, WritableRaster writableraster, boolean premultiplied, Hashtable<?,?> properties)
public void coerceData(boolean premultiplied)
public WritableRaster copyData(WritableRaster dest)
copyData in interface RenderedImagepublic Graphics2D createGraphics()
public void flush()
Imagepublic WritableRaster getAlphaRaster()
public ColorModel getColorModel()
getColorModel in interface RenderedImagepublic Raster getData()
getData in interface RenderedImagepublic Raster getData(Rectangle rectangle)
getData in interface RenderedImagepublic Graphics getGraphics()
ImagegetGraphics in class Imagepublic int getHeight()
getHeight in interface RenderedImagepublic int getHeight(ImageObserver imageobserver)
ImagegetHeight in class Imageimageobserver - the image observer for this objectImage.getWidth(ImageObserver)public int getMinTileX()
getMinTileX in interface RenderedImagepublic int getMinTileY()
getMinTileY in interface RenderedImagepublic int getMinX()
getMinX in interface RenderedImagepublic int getMinY()
getMinY in interface RenderedImagepublic int getNumXTiles()
getNumXTiles in interface RenderedImagepublic int getNumYTiles()
getNumYTiles in interface RenderedImagepublic Object getProperty(String string)
Image.UndefinedProperty if the property is not defined.getProperty in interface RenderedImagestring - the property key (null not permitted).NullPointerException - if string is null.public Object getProperty(String string, ImageObserver imageobserver)
ImageUndefinedProperty is
returned if there is no property with the specified name. The value
null is returned if the properties for the object are
not yet known. In this case, the specified image observer is notified
when the properties are known.getProperty in class Imagestring - the requested property nameimageobserver - the image observer for this objectImage.UndefinedPropertypublic String[] getPropertyNames()
null always.getPropertyNames in interface RenderedImagenull always.public int getRGB(int x, int y)
public int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scanlineStride)
public WritableRaster getRaster()
public SampleModel getSampleModel()
getSampleModel in interface RenderedImagepublic ImageProducer getSource()
Imagepublic Vector<RenderedImage> getSources()
getSources in interface RenderedImagepublic BufferedImage getSubimage(int x, int y, int w, int h)
public Raster getTile(int tileX, int tileY)
getTile in interface RenderedImagepublic int getTileGridXOffset()
getTileGridXOffset in interface RenderedImagepublic int getTileGridYOffset()
getTileGridYOffset in interface RenderedImagepublic int getTileHeight()
getTileHeight in interface RenderedImagepublic int getTileWidth()
getTileWidth in interface RenderedImagepublic int getType()
public int getWidth()
getWidth in interface RenderedImagepublic int getWidth(ImageObserver imageobserver)
ImagegetWidth in class Imageimageobserver - the image observer for this objectImage.getHeight(ImageObserver)public WritableRaster getWritableTile(int tileX, int tileY)
getWritableTile in interface WritableRenderedImagepublic Point[] getWritableTileIndices()
getWritableTileIndices in interface WritableRenderedImagepublic boolean hasTileWriters()
hasTileWriters in interface WritableRenderedImagepublic boolean isAlphaPremultiplied()
public boolean isTileWritable(int tileX, int tileY)
isTileWritable in interface WritableRenderedImagepublic void releaseWritableTile(int tileX, int tileY)
releaseWritableTile in interface WritableRenderedImagepublic void setData(Raster src)
setData in interface WritableRenderedImagepublic void setRGB(int x, int y, int argb)
public void setRGB(int startX, int startY, int w, int h, int[] argbArray, int offset, int scanlineStride)
public String toString()
ObjectSystem.out.println()
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a RuntimeException.
This method will be called when performing string
concatenation with this object. If the result is
null, string concatenation will instead
use "null".
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode()).
toString in class ObjectObject.getClass(),
Object.hashCode(),
Class.getName(),
Integer.toHexString(int)public void addTileObserver(TileObserver to)
addTileObserver in interface WritableRenderedImageto - The TileObserver to add.public void removeTileObserver(TileObserver to)
removeTileObserver in interface WritableRenderedImageto - The TileObserver to remove.public int getTransparency()
getTransparency in interface TransparencyTransparency.OPAQUE, Transparency.BITMASK, or Transparency.TRANSLUCENT.Transparency.getTransparency()