Java Doc for BufferedImage.java in  » 6.0-JDK-Core » AWT » java » awt » image » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » AWT » java.awt.image 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.Image
      java.awt.image.BufferedImage

BufferedImage
public class BufferedImage extends java.awt.Image implements WritableRenderedImage,Transparency(Code)
The BufferedImage subclass describes an java.awt.Image Image with an accessible buffer of image data. A BufferedImage is comprised of a ColorModel and a Raster of image data. The number and types of bands in the SampleModel of the Raster must match the number and types required by the ColorModel to represent its color and alpha components. All BufferedImage objects have an upper left corner coordinate of (0, 0). Any Raster used to construct a BufferedImage must therefore have minX=0 and minY=0.

This class relies on the data fetching and setting methods of Raster, and on the color characterization methods of ColorModel.
See Also:   ColorModel
See Also:   Raster
See Also:   WritableRaster
version:
   10 Feb 1997



Field Summary
final public static  intTYPE_3BYTE_BGR
     Represents an image with 8-bit RGB color components, corresponding to a Windows-style BGR color model) with the colors Blue, Green, and Red stored in 3 bytes.
final public static  intTYPE_4BYTE_ABGR
     Represents an image with 8-bit RGBA color components with the colors Blue, Green, and Red stored in 3 bytes and 1 byte of alpha.
final public static  intTYPE_4BYTE_ABGR_PRE
     Represents an image with 8-bit RGBA color components with the colors Blue, Green, and Red stored in 3 bytes and 1 byte of alpha.
final public static  intTYPE_BYTE_BINARY
     Represents an opaque byte-packed 1, 2, or 4 bit image.
final public static  intTYPE_BYTE_GRAY
     Represents a unsigned byte grayscale image, non-indexed.
final public static  intTYPE_BYTE_INDEXED
     Represents an indexed byte image.
final public static  intTYPE_CUSTOM
     Image type is not recognized so it must be a customized image.
final public static  intTYPE_INT_ARGB
     Represents an image with 8-bit RGBA color components packed into integer pixels.
final public static  intTYPE_INT_ARGB_PRE
     Represents an image with 8-bit RGBA color components packed into integer pixels.
final public static  intTYPE_INT_BGR
     Represents an image with 8-bit RGB color components, corresponding to a Windows- or Solaris- style BGR color model, with the colors Blue, Green, and Red packed into integer pixels.
final public static  intTYPE_INT_RGB
     Represents an image with 8-bit RGB color components packed into integer pixels.
final public static  intTYPE_USHORT_555_RGB
     Represents an image with 5-5-5 RGB color components (5-bits red, 5-bits green, 5-bits blue) with no alpha.
final public static  intTYPE_USHORT_565_RGB
     Represents an image with 5-6-5 RGB color components (5-bits red, 6-bits green, 5-bits blue) with no alpha.
final public static  intTYPE_USHORT_GRAY
     Represents an unsigned short grayscale image, non-indexed).
 ColorModelcolorModel
    
 intimageType
    
 booleanisAlphaPremultiplied
    
 OffScreenImageSourceosis
    
 Hashtableproperties
    
 WritableRasterraster
    

Constructor Summary
public  BufferedImage(int width, int height, int imageType)
     Constructs a BufferedImage of one of the predefined image types.
public  BufferedImage(int width, int height, int imageType, IndexColorModel cm)
     Constructs a BufferedImage of one of the predefined image types: TYPE_BYTE_BINARY or TYPE_BYTE_INDEXED.

If the image type is TYPE_BYTE_BINARY, the number of entries in the color model is used to determine whether the image should have 1, 2, or 4 bits per pixel.

public  BufferedImage(ColorModel cm, WritableRaster raster, boolean isRasterPremultiplied, Hashtable properties)
     Constructs a new BufferedImage with a specified ColorModel and Raster.

Method Summary
public  voidaddTileObserver(TileObserver to)
     Adds a tile observer.
public  voidcoerceData(boolean isAlphaPremultiplied)
     Forces the data to match the state specified in the isAlphaPremultiplied variable.
public  WritableRastercopyData(WritableRaster outRaster)
     Computes an arbitrary rectangular region of the BufferedImage and copies it into a specified WritableRaster.
public  Graphics2DcreateGraphics()
     Creates a Graphics2D, which can be used to draw into this BufferedImage. a Graphics2D, used for drawing into thisimage.
public  WritableRastergetAlphaRaster()
     Returns a WritableRaster representing the alpha channel for BufferedImage objects with ColorModel objects that support a separate spatial alpha channel, such as ComponentColorModel and DirectColorModel.
public  ColorModelgetColorModel()
     Returns the ColorModel.
public  RastergetData()
     Returns the image as one large tile.
public  RastergetData(Rectangle rect)
     Computes and returns an arbitrary region of the BufferedImage.
public  java.awt.GraphicsgetGraphics()
     This method returns a Graphics2D , but is here for backwards compatibility.
public  intgetHeight()
     Returns the height of the BufferedImage.
public  intgetHeight(ImageObserver observer)
     Returns the height of the BufferedImage.
public  intgetMinTileX()
     Returns the minimum tile index in the x direction.
public  intgetMinTileY()
     Returns the minimum tile index in the y direction.
public  intgetMinX()
     Returns the minimum x coordinate of this BufferedImage.
public  intgetMinY()
     Returns the minimum y coordinate of this BufferedImage.
public  intgetNumXTiles()
     Returns the number of tiles in the x direction.
public  intgetNumYTiles()
     Returns the number of tiles in the y direction.
public  ObjectgetProperty(String name, ImageObserver observer)
     Returns a property of the image by name.
public  ObjectgetProperty(String name)
     Returns a property of the image by name.
Parameters:
  name - the property name an Object that is the property referred to bythe specified name.
public  String[]getPropertyNames()
     Returns an array of names recognized by BufferedImage.getProperty(String) getProperty(String) or null, if no property names are recognized.
public  intgetRGB(int x, int y)
     Returns an integer pixel in the default RGB color model (TYPE_INT_ARGB) and default sRGB colorspace.
public  int[]getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)
     Returns an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space, from a portion of the image data.
public  WritableRastergetRaster()
     Returns the WritableRaster .
public  SampleModelgetSampleModel()
     Returns the SampleModel associated with this BufferedImage.
public  ImageProducergetSource()
     Returns the object that produces the pixels for the image.
public  Vector<RenderedImage>getSources()
     Returns a Vector of RenderedImage objects that are the immediate sources, not the sources of these immediate sources, of image data for this BufferedImage.
public  BufferedImagegetSubimage(int x, int y, int w, int h)
     Returns a subimage defined by a specified rectangular region. The returned BufferedImage shares the same data array as the original image.
Parameters:
  x - the X coordinate of the upper-left corner of thespecified rectangular region
Parameters:
  y - the Y coordinate of the upper-left corner of thespecified rectangular region
Parameters:
  w - the width of the specified rectangular region
Parameters:
  h - the height of the specified rectangular region a BufferedImage that is the subimage of thisBufferedImage.
public  RastergetTile(int tileX, int tileY)
     Returns tile (tileXtileY).
public  intgetTileGridXOffset()
     Returns the x offset of the tile grid relative to the origin, For example, the x coordinate of the location of tile (0, 0).
public  intgetTileGridYOffset()
     Returns the y offset of the tile grid relative to the origin, For example, the y coordinate of the location of tile (0, 0).
public  intgetTileHeight()
     Returns the tile height in pixels.
public  intgetTileWidth()
     Returns the tile width in pixels.
public  intgetTransparency()
     Returns the transparency.
public  intgetType()
     Returns the image type.
public  intgetWidth()
     Returns the width of the BufferedImage.
public  intgetWidth(ImageObserver observer)
     Returns the width of the BufferedImage.
public  WritableRastergetWritableTile(int tileX, int tileY)
     Checks out a tile for writing.
public  Point[]getWritableTileIndices()
     Returns an array of Point objects indicating which tiles are checked out for writing.
public  booleanhasTileWriters()
     Returns whether or not any tile is checked out for writing. Semantically equivalent to
 (getWritableTileIndices() != null).
 
true if any tile is checked out for writing;false otherwise.
public  booleanisAlphaPremultiplied()
     Returns whether or not the alpha has been premultiplied.
public  booleanisTileWritable(int tileX, int tileY)
     Returns whether or not a tile is currently checked out for writing.
Parameters:
  tileX - the x index of the tile.
Parameters:
  tileY - the y index of the tile.
public  voidreleaseWritableTile(int tileX, int tileY)
     Relinquishes permission to write to a tile.
public  voidremoveTileObserver(TileObserver to)
     Removes a tile observer.
public  voidsetData(Raster r)
     Sets a rectangular region of the image to the contents of the specified Raster r, which is assumed to be in the same coordinate space as the BufferedImage.
public synchronized  voidsetRGB(int x, int y, int rgb)
     Sets a pixel in this BufferedImage to the specified RGB value.
public  voidsetRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)
     Sets an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space, into a portion of the image data.
public  StringtoString()
     Returns a String representation of this BufferedImage object and its values.

Field Detail
TYPE_3BYTE_BGR
final public static int TYPE_3BYTE_BGR(Code)
Represents an image with 8-bit RGB color components, corresponding to a Windows-style BGR color model) with the colors Blue, Green, and Red stored in 3 bytes. There is no alpha. The image has a ComponentColorModel. When data with non-opaque alpha is stored in an image of this type, the color data must be adjusted to a non-premultiplied form and the alpha discarded, as described in the java.awt.AlphaComposite documentation.



TYPE_4BYTE_ABGR
final public static int TYPE_4BYTE_ABGR(Code)
Represents an image with 8-bit RGBA color components with the colors Blue, Green, and Red stored in 3 bytes and 1 byte of alpha. The image has a ComponentColorModel with alpha. The color data in this image is considered not to be premultiplied with alpha. The byte data is interleaved in a single byte array in the order A, B, G, R from lower to higher byte addresses within each pixel.



TYPE_4BYTE_ABGR_PRE
final public static int TYPE_4BYTE_ABGR_PRE(Code)
Represents an image with 8-bit RGBA color components with the colors Blue, Green, and Red stored in 3 bytes and 1 byte of alpha. The image has a ComponentColorModel with alpha. The color data in this image is considered to be premultiplied with alpha. The byte data is interleaved in a single byte array in the order A, B, G, R from lower to higher byte addresses within each pixel.



TYPE_BYTE_BINARY
final public static int TYPE_BYTE_BINARY(Code)
Represents an opaque byte-packed 1, 2, or 4 bit image. The image has an IndexColorModel without alpha. When this type is used as the imageType argument to the BufferedImage constructor that takes an imageType argument but no ColorModel argument, a 1-bit image is created with an IndexColorModel with two colors in the default sRGB ColorSpace: {0, 0, 0} and {255, 255, 255}.

Images with 2 or 4 bits per pixel may be constructed via the BufferedImage constructor that takes a ColorModel argument by supplying a ColorModel with an appropriate map size.

Images with 8 bits per pixel should use the image types TYPE_BYTE_INDEXED or TYPE_BYTE_GRAY depending on their ColorModel.

When color data is stored in an image of this type, the closest color in the colormap is determined by the IndexColorModel and the resulting index is stored. Approximation and loss of alpha or color components can result, depending on the colors in the IndexColorModel colormap.




TYPE_BYTE_GRAY
final public static int TYPE_BYTE_GRAY(Code)
Represents a unsigned byte grayscale image, non-indexed. This image has a ComponentColorModel with a CS_GRAY ColorSpace . When data with non-opaque alpha is stored in an image of this type, the color data must be adjusted to a non-premultiplied form and the alpha discarded, as described in the java.awt.AlphaComposite documentation.



TYPE_BYTE_INDEXED
final public static int TYPE_BYTE_INDEXED(Code)
Represents an indexed byte image. When this type is used as the imageType argument to the BufferedImage constructor that takes an imageType argument but no ColorModel argument, an IndexColorModel is created with a 256-color 6/6/6 color cube palette with the rest of the colors from 216-255 populated by grayscale values in the default sRGB ColorSpace.

When color data is stored in an image of this type, the closest color in the colormap is determined by the IndexColorModel and the resulting index is stored. Approximation and loss of alpha or color components can result, depending on the colors in the IndexColorModel colormap.




TYPE_CUSTOM
final public static int TYPE_CUSTOM(Code)
Image type is not recognized so it must be a customized image. This type is only used as a return value for the getType() method.



TYPE_INT_ARGB
final public static int TYPE_INT_ARGB(Code)
Represents an image with 8-bit RGBA color components packed into integer pixels. The image has a DirectColorModel with alpha. The color data in this image is considered not to be premultiplied with alpha. When this type is used as the imageType argument to a BufferedImage constructor, the created image is consistent with images created in the JDK1.1 and earlier releases.



TYPE_INT_ARGB_PRE
final public static int TYPE_INT_ARGB_PRE(Code)
Represents an image with 8-bit RGBA color components packed into integer pixels. The image has a DirectColorModel with alpha. The color data in this image is considered to be premultiplied with alpha.



TYPE_INT_BGR
final public static int TYPE_INT_BGR(Code)
Represents an image with 8-bit RGB color components, corresponding to a Windows- or Solaris- style BGR color model, with the colors Blue, Green, and Red packed into integer pixels. There is no alpha. The image has a DirectColorModel . When data with non-opaque alpha is stored in an image of this type, the color data must be adjusted to a non-premultiplied form and the alpha discarded, as described in the java.awt.AlphaComposite documentation.



TYPE_INT_RGB
final public static int TYPE_INT_RGB(Code)
Represents an image with 8-bit RGB color components packed into integer pixels. The image has a DirectColorModel without alpha. When data with non-opaque alpha is stored in an image of this type, the color data must be adjusted to a non-premultiplied form and the alpha discarded, as described in the java.awt.AlphaComposite documentation.



TYPE_USHORT_555_RGB
final public static int TYPE_USHORT_555_RGB(Code)
Represents an image with 5-5-5 RGB color components (5-bits red, 5-bits green, 5-bits blue) with no alpha. This image has a DirectColorModel. When data with non-opaque alpha is stored in an image of this type, the color data must be adjusted to a non-premultiplied form and the alpha discarded, as described in the java.awt.AlphaComposite documentation.



TYPE_USHORT_565_RGB
final public static int TYPE_USHORT_565_RGB(Code)
Represents an image with 5-6-5 RGB color components (5-bits red, 6-bits green, 5-bits blue) with no alpha. This image has a DirectColorModel. When data with non-opaque alpha is stored in an image of this type, the color data must be adjusted to a non-premultiplied form and the alpha discarded, as described in the java.awt.AlphaComposite documentation.



TYPE_USHORT_GRAY
final public static int TYPE_USHORT_GRAY(Code)
Represents an unsigned short grayscale image, non-indexed). This image has a ComponentColorModel with a CS_GRAY ColorSpace. When data with non-opaque alpha is stored in an image of this type, the color data must be adjusted to a non-premultiplied form and the alpha discarded, as described in the java.awt.AlphaComposite documentation.



colorModel
ColorModel colorModel(Code)



imageType
int imageType(Code)



isAlphaPremultiplied
boolean isAlphaPremultiplied(Code)



osis
OffScreenImageSource osis(Code)



properties
Hashtable properties(Code)



raster
WritableRaster raster(Code)




Constructor Detail
BufferedImage
public BufferedImage(int width, int height, int imageType)(Code)
Constructs a BufferedImage of one of the predefined image types. The ColorSpace for the image is the default sRGB space.
Parameters:
  width - width of the created image
Parameters:
  height - height of the created image
Parameters:
  imageType - type of the created image
See Also:   ColorSpace
See Also:   BufferedImage.TYPE_INT_RGB
See Also:   BufferedImage.TYPE_INT_ARGB
See Also:   BufferedImage.TYPE_INT_ARGB_PRE
See Also:   BufferedImage.TYPE_INT_BGR
See Also:   BufferedImage.TYPE_3BYTE_BGR
See Also:   BufferedImage.TYPE_4BYTE_ABGR
See Also:   BufferedImage.TYPE_4BYTE_ABGR_PRE
See Also:   BufferedImage.TYPE_BYTE_GRAY
See Also:   BufferedImage.TYPE_USHORT_GRAY
See Also:   BufferedImage.TYPE_BYTE_BINARY
See Also:   BufferedImage.TYPE_BYTE_INDEXED
See Also:   BufferedImage.TYPE_USHORT_565_RGB
See Also:   BufferedImage.TYPE_USHORT_555_RGB



BufferedImage
public BufferedImage(int width, int height, int imageType, IndexColorModel cm)(Code)
Constructs a BufferedImage of one of the predefined image types: TYPE_BYTE_BINARY or TYPE_BYTE_INDEXED.

If the image type is TYPE_BYTE_BINARY, the number of entries in the color model is used to determine whether the image should have 1, 2, or 4 bits per pixel. If the color model has 1 or 2 entries, the image will have 1 bit per pixel. If it has 3 or 4 entries, the image with have 2 bits per pixel. If it has between 5 and 16 entries, the image will have 4 bits per pixel. Otherwise, an IllegalArgumentException will be thrown.
Parameters:
  width - width of the created image
Parameters:
  height - height of the created image
Parameters:
  imageType - type of the created image
Parameters:
  cm - IndexColorModel of the created image
throws:
  IllegalArgumentException - if the imageType is notTYPE_BYTE_BINARY or TYPE_BYTE_INDEXED or if the imageType isTYPE_BYTE_BINARY and the color map has more than 16 entries.
See Also:   BufferedImage.TYPE_BYTE_BINARY
See Also:   BufferedImage.TYPE_BYTE_INDEXED




BufferedImage
public BufferedImage(ColorModel cm, WritableRaster raster, boolean isRasterPremultiplied, Hashtable properties)(Code)
Constructs a new BufferedImage with a specified ColorModel and Raster. If the number and types of bands in the SampleModel of the Raster do not match the number and types required by the ColorModel to represent its color and alpha components, a RasterFormatException is thrown. This method can multiply or divide the color Raster data by alpha to match the alphaPremultiplied state in the ColorModel. Properties for this BufferedImage can be established by passing in a Hashtable of String/Object pairs.
Parameters:
  cm - ColorModel for the new image
Parameters:
  raster - Raster for the image data
Parameters:
  isRasterPremultiplied - if true, the data inthe raster has been premultiplied with alpha.
Parameters:
  properties - Hashtable ofString/Object pairs. RasterFormatException if the number andtypes of bands in the SampleModel of theRaster do not match the number and types required bythe ColorModel to represent its color and alphacomponents. IllegalArgumentException if raster is incompatible with cm
See Also:   ColorModel
See Also:   Raster
See Also:   WritableRaster




Method Detail
addTileObserver
public void addTileObserver(TileObserver to)(Code)
Adds a tile observer. If the observer is already present, it receives multiple notifications.
Parameters:
  to - the specified TileObserver



coerceData
public void coerceData(boolean isAlphaPremultiplied)(Code)
Forces the data to match the state specified in the isAlphaPremultiplied variable. It may multiply or divide the color raster data by alpha, or do nothing if the data is in the correct state.
Parameters:
  isAlphaPremultiplied - true if the alpha has beenpremultiplied; false otherwise.



copyData
public WritableRaster copyData(WritableRaster outRaster)(Code)
Computes an arbitrary rectangular region of the BufferedImage and copies it into a specified WritableRaster. The region to be computed is determined from the bounds of the specified WritableRaster. The specified WritableRaster must have a SampleModel that is compatible with this image. If outRaster is null, an appropriate WritableRaster is created.
Parameters:
  outRaster - a WritableRaster to hold the returnedpart of the image, or null a reference to the supplied or createdWritableRaster.



createGraphics
public Graphics2D createGraphics()(Code)
Creates a Graphics2D, which can be used to draw into this BufferedImage. a Graphics2D, used for drawing into thisimage.



getAlphaRaster
public WritableRaster getAlphaRaster()(Code)
Returns a WritableRaster representing the alpha channel for BufferedImage objects with ColorModel objects that support a separate spatial alpha channel, such as ComponentColorModel and DirectColorModel. Returns null if there is no alpha channel associated with the ColorModel in this image. This method assumes that for all ColorModel objects other than IndexColorModel, if the ColorModel supports alpha, there is a separate alpha channel which is stored as the last band of image data. If the image uses an IndexColorModel that has alpha in the lookup table, this method returns null since there is no spatially discrete alpha channel. This method creates a new WritableRaster, but shares the data array. a WritableRaster or null if thisBufferedImage has no alpha channel associatedwith its ColorModel.



getColorModel
public ColorModel getColorModel()(Code)
Returns the ColorModel. the ColorModel of thisBufferedImage.



getData
public Raster getData()(Code)
Returns the image as one large tile. The Raster returned is a copy of the image data is not updated if the image is changed. a Raster that is a copy of the image data.
See Also:   BufferedImage.setData(Raster)



getData
public Raster getData(Rectangle rect)(Code)
Computes and returns an arbitrary region of the BufferedImage. The Raster returned is a copy of the image data and is not updated if the image is changed.
Parameters:
  rect - the region of the BufferedImage to bereturned. a Raster that is a copy of the image data ofthe specified region of the BufferedImage
See Also:   BufferedImage.setData(Raster)



getGraphics
public java.awt.Graphics getGraphics()(Code)
This method returns a Graphics2D , but is here for backwards compatibility. BufferedImage.createGraphics() createGraphics is more convenient, since it is declared to return a Graphics2D. a Graphics2D, which can be used to draw intothis image.



getHeight
public int getHeight()(Code)
Returns the height of the BufferedImage. the height of this BufferedImage



getHeight
public int getHeight(ImageObserver observer)(Code)
Returns the height of the BufferedImage.
Parameters:
  observer - ignored the height of this BufferedImage



getMinTileX
public int getMinTileX()(Code)
Returns the minimum tile index in the x direction. This is always zero. the minimum tile index in the x direction.



getMinTileY
public int getMinTileY()(Code)
Returns the minimum tile index in the y direction. This is always zero. the mininum tile index in the y direction.



getMinX
public int getMinX()(Code)
Returns the minimum x coordinate of this BufferedImage. This is always zero. the minimum x coordinate of thisBufferedImage.



getMinY
public int getMinY()(Code)
Returns the minimum y coordinate of this BufferedImage. This is always zero. the minimum y coordinate of thisBufferedImage.



getNumXTiles
public int getNumXTiles()(Code)
Returns the number of tiles in the x direction. This is always one. the number of tiles in the x direction.



getNumYTiles
public int getNumYTiles()(Code)
Returns the number of tiles in the y direction. This is always one. the number of tiles in the y direction.



getProperty
public Object getProperty(String name, ImageObserver observer)(Code)
Returns a property of the image by name. Individual property names are defined by the various image formats. If a property is not defined for a particular image, this method returns the UndefinedProperty field. If the properties for this image are not yet known, then this method returns null and the ImageObserver object is notified later. The property name "comment" should be used to store an optional comment that can be presented to the user as a description of the image, its source, or its author.
Parameters:
  name - the property name
Parameters:
  observer - the ImageObserver that receivesnotification regarding image information an Object that is the property referred to by thespecified name or null if the properties of this image are not yet known. NullPointerException if the property name is null.
See Also:   ImageObserver
See Also:   java.awt.Image.UndefinedProperty



getProperty
public Object getProperty(String name)(Code)
Returns a property of the image by name.
Parameters:
  name - the property name an Object that is the property referred to bythe specified name. NullPointerException if the property name is null.



getPropertyNames
public String[] getPropertyNames()(Code)
Returns an array of names recognized by BufferedImage.getProperty(String) getProperty(String) or null, if no property names are recognized. a String array containing all of the propertynames that getProperty(String) recognizes;or null if no property names are recognized.



getRGB
public int getRGB(int x, int y)(Code)
Returns an integer pixel in the default RGB color model (TYPE_INT_ARGB) and default sRGB colorspace. Color conversion takes place if this default model does not match the image ColorModel. There are only 8-bits of precision for each color component in the returned data when using this method.

An ArrayOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
  x - the X coordinate of the pixel from which to getthe pixel in the default RGB color model and sRGBcolor space
Parameters:
  y - the Y coordinate of the pixel from which to getthe pixel in the default RGB color model and sRGBcolor space an integer pixel in the default RGB color model anddefault sRGB colorspace.
See Also:   BufferedImage.setRGB(int,int,int)
See Also:   BufferedImage.setRGB(int,int,int,int,int[],int,int)




getRGB
public int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)(Code)
Returns an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space, from a portion of the image data. Color conversion takes place if the default model does not match the image ColorModel. There are only 8-bits of precision for each color component in the returned data when using this method. With a specified coordinate (x, y) in the image, the ARGB pixel can be accessed in this way:

 pixel   = rgbArray[offset + (y-startY)*scansize + (x-startX)]; 

An ArrayOutOfBoundsException may be thrown if the region is not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
  startX - the starting X coordinate
Parameters:
  startY - the starting Y coordinate
Parameters:
  w - width of region
Parameters:
  h - height of region
Parameters:
  rgbArray - if not null, the rgb pixels are written here
Parameters:
  offset - offset into the rgbArray
Parameters:
  scansize - scanline stride for the rgbArray array of RGB pixels.
See Also:   BufferedImage.setRGB(int,int,int)
See Also:   BufferedImage.setRGB(int,int,int,int,int[],int,int)




getRaster
public WritableRaster getRaster()(Code)
Returns the WritableRaster . the WriteableRaster of thisBufferedImage.



getSampleModel
public SampleModel getSampleModel()(Code)
Returns the SampleModel associated with this BufferedImage. the SampleModel of thisBufferedImage.



getSource
public ImageProducer getSource()(Code)
Returns the object that produces the pixels for the image. the ImageProducer that is used to produce thepixels for this image.
See Also:   ImageProducer



getSources
public Vector<RenderedImage> getSources()(Code)
Returns a Vector of RenderedImage objects that are the immediate sources, not the sources of these immediate sources, of image data for this BufferedImage. This method returns null if the BufferedImage has no information about its immediate sources. It returns an empty Vector if the BufferedImage has no immediate sources. a Vector containing immediate sources ofthis BufferedImage object's image date, ornull if this BufferedImage hasno information about its immediate sources, or an emptyVector if this BufferedImage has no immediate sources.



getSubimage
public BufferedImage getSubimage(int x, int y, int w, int h)(Code)
Returns a subimage defined by a specified rectangular region. The returned BufferedImage shares the same data array as the original image.
Parameters:
  x - the X coordinate of the upper-left corner of thespecified rectangular region
Parameters:
  y - the Y coordinate of the upper-left corner of thespecified rectangular region
Parameters:
  w - the width of the specified rectangular region
Parameters:
  h - the height of the specified rectangular region a BufferedImage that is the subimage of thisBufferedImage. RasterFormatException if the specifiedarea is not contained within this BufferedImage.



getTile
public Raster getTile(int tileX, int tileY)(Code)
Returns tile (tileXtileY). Note that tileX and tileY are indices into the tile array, not pixel locations. The Raster that is returned is live, which means that it is updated if the image is changed.
Parameters:
  tileX - the x index of the requested tile in the tile array
Parameters:
  tileY - the y index of the requested tile in the tile array a Raster that is the tile defined by thearguments tileX and tileY. ArrayIndexOutOfBoundsException if bothtileX and tileY are notequal to 0



getTileGridXOffset
public int getTileGridXOffset()(Code)
Returns the x offset of the tile grid relative to the origin, For example, the x coordinate of the location of tile (0, 0). This is always zero. the x offset of the tile grid.



getTileGridYOffset
public int getTileGridYOffset()(Code)
Returns the y offset of the tile grid relative to the origin, For example, the y coordinate of the location of tile (0, 0). This is always zero. the y offset of the tile grid.



getTileHeight
public int getTileHeight()(Code)
Returns the tile height in pixels. the tile height in pixels.



getTileWidth
public int getTileWidth()(Code)
Returns the tile width in pixels. the tile width in pixels.



getTransparency
public int getTransparency()(Code)
Returns the transparency. Returns either OPAQUE, BITMASK, or TRANSLUCENT. the transparency of this BufferedImage.
See Also:   Transparency.OPAQUE
See Also:   Transparency.BITMASK
See Also:   Transparency.TRANSLUCENT
since:
   1.5



getType
public int getType()(Code)
Returns the image type. If it is not one of the known types, TYPE_CUSTOM is returned. the image type of this BufferedImage.
See Also:   BufferedImage.TYPE_INT_RGB
See Also:   BufferedImage.TYPE_INT_ARGB
See Also:   BufferedImage.TYPE_INT_ARGB_PRE
See Also:   BufferedImage.TYPE_INT_BGR
See Also:   BufferedImage.TYPE_3BYTE_BGR
See Also:   BufferedImage.TYPE_4BYTE_ABGR
See Also:   BufferedImage.TYPE_4BYTE_ABGR_PRE
See Also:   BufferedImage.TYPE_BYTE_GRAY
See Also:   BufferedImage.TYPE_BYTE_BINARY
See Also:   BufferedImage.TYPE_BYTE_INDEXED
See Also:   BufferedImage.TYPE_USHORT_GRAY
See Also:   BufferedImage.TYPE_USHORT_565_RGB
See Also:   BufferedImage.TYPE_USHORT_555_RGB
See Also:   BufferedImage.TYPE_CUSTOM



getWidth
public int getWidth()(Code)
Returns the width of the BufferedImage. the width of this BufferedImage



getWidth
public int getWidth(ImageObserver observer)(Code)
Returns the width of the BufferedImage.
Parameters:
  observer - ignored the width of this BufferedImage



getWritableTile
public WritableRaster getWritableTile(int tileX, int tileY)(Code)
Checks out a tile for writing. All registered TileObservers are notified when a tile goes from having no writers to having one writer.
Parameters:
  tileX - the x index of the tile
Parameters:
  tileY - the y index of the tile a WritableRaster that is the tile, indicated bythe specified indices, to be checked out for writing.



getWritableTileIndices
public Point[] getWritableTileIndices()(Code)
Returns an array of Point objects indicating which tiles are checked out for writing. Returns null if none are checked out. a Point array that indicates the tiles thatare checked out for writing, or null if notiles are checked out for writing.



hasTileWriters
public boolean hasTileWriters()(Code)
Returns whether or not any tile is checked out for writing. Semantically equivalent to
 (getWritableTileIndices() != null).
 
true if any tile is checked out for writing;false otherwise.



isAlphaPremultiplied
public boolean isAlphaPremultiplied()(Code)
Returns whether or not the alpha has been premultiplied. It returns false if there is no alpha. true if the alpha has been premultiplied; false otherwise.



isTileWritable
public boolean isTileWritable(int tileX, int tileY)(Code)
Returns whether or not a tile is currently checked out for writing.
Parameters:
  tileX - the x index of the tile.
Parameters:
  tileY - the y index of the tile. true if the tile specified by the specifiedindices is checked out for writing; falseotherwise. ArrayIndexOutOfBoundsException if bothtileX and tileY are not equalto 0



releaseWritableTile
public void releaseWritableTile(int tileX, int tileY)(Code)
Relinquishes permission to write to a tile. If the caller continues to write to the tile, the results are undefined. Calls to this method should only appear in matching pairs with calls to BufferedImage.getWritableTile(int,int) getWritableTile(int, int) . Any other leads to undefined results. All registered TileObservers are notified when a tile goes from having one writer to having no writers.
Parameters:
  tileX - the x index of the tile
Parameters:
  tileY - the y index of the tile



removeTileObserver
public void removeTileObserver(TileObserver to)(Code)
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 specified TileObserver.



setData
public void setData(Raster r)(Code)
Sets a rectangular region of the image to the contents of the specified Raster r, which is assumed to be in the same coordinate space as the BufferedImage. The operation is clipped to the bounds of the BufferedImage.
Parameters:
  r - the specified Raster
See Also:   BufferedImage.getData
See Also:   BufferedImage.getData(Rectangle)



setRGB
public synchronized void setRGB(int x, int y, int rgb)(Code)
Sets a pixel in this BufferedImage to the specified RGB value. The pixel is assumed to be in the default RGB color model, TYPE_INT_ARGB, and default sRGB color space. For images with an IndexColorModel, the index with the nearest color is chosen.

An ArrayOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
  x - the X coordinate of the pixel to set
Parameters:
  y - the Y coordinate of the pixel to set
Parameters:
  rgb - the RGB value
See Also:   BufferedImage.getRGB(int,int)
See Also:   BufferedImage.getRGB(int,int,int,int,int[],int,int)




setRGB
public void setRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)(Code)
Sets an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space, into a portion of the image data. Color conversion takes place if the default model does not match the image ColorModel. There are only 8-bits of precision for each color component in the returned data when using this method. With a specified coordinate (x, y) in the this image, the ARGB pixel can be accessed in this way:
 pixel   = rgbArray[offset + (y-startY)*scansize + (x-startX)];
 
WARNING: No dithering takes place.

An ArrayOutOfBoundsException may be thrown if the region is not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
  startX - the starting X coordinate
Parameters:
  startY - the starting Y coordinate
Parameters:
  w - width of the region
Parameters:
  h - height of the region
Parameters:
  rgbArray - the rgb pixels
Parameters:
  offset - offset into the rgbArray
Parameters:
  scansize - scanline stride for the rgbArray
See Also:   BufferedImage.getRGB(int,int)
See Also:   BufferedImage.getRGB(int,int,int,int,int[],int,int)




toString
public String toString()(Code)
Returns a String representation of this BufferedImage object and its values. a String representing thisBufferedImage.



Fields inherited from java.awt.Image
final public static int SCALE_AREA_AVERAGING(Code)(Java Doc)
final public static int SCALE_DEFAULT(Code)(Java Doc)
final public static int SCALE_FAST(Code)(Java Doc)
final public static int SCALE_REPLICATE(Code)(Java Doc)
final public static int SCALE_SMOOTH(Code)(Java Doc)
final public static Object UndefinedProperty(Code)(Java Doc)
protected float accelerationPriority(Code)(Java Doc)

Methods inherited from java.awt.Image
public void flush()(Code)(Java Doc)
public float getAccelerationPriority()(Code)(Java Doc)
public ImageCapabilities getCapabilities(GraphicsConfiguration gc)(Code)(Java Doc)
abstract public Graphics getGraphics()(Code)(Java Doc)
abstract public int getHeight(ImageObserver observer)(Code)(Java Doc)
abstract public Object getProperty(String name, ImageObserver observer)(Code)(Java Doc)
public Image getScaledInstance(int width, int height, int hints)(Code)(Java Doc)
abstract public ImageProducer getSource()(Code)(Java Doc)
abstract public int getWidth(ImageObserver observer)(Code)(Java Doc)
public void setAccelerationPriority(float priority)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.