Java Doc for ByteComponentRaster.java in  » 6.0-JDK-Modules-sun » awt » sun » awt » image » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules sun » awt » sun.awt.image 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


sun.awt.image.SunWritableRaster
   sun.awt.image.ByteComponentRaster

All known Subclasses:   sun.awt.image.ByteInterleavedRaster,
ByteComponentRaster
public class ByteComponentRaster extends SunWritableRaster (Code)
This class defines a Raster with pixels consisting of one or more 8-bit data elements stored in close proximity to each other in a single byte array. The bit precision per data element is that of the data type (that is, the bit precision for this Raster is 8). There is only one pixel stride and one scanline stride for all bands. This type of Raster can be used with a ComponentColorModel if there are multiple bands, or an IndexColorModel if there is only one band.

For example, 3-3-2 RGB image data can be represented by a ByteComponentRaster using a SinglePixelPackedSampleModel and a ComponentColorModel.
version:
   10 Feb 1997



Field Summary
protected  intbandOffset
    
protected  byte[]data
     The image data array.
protected  int[]dataOffsets
     Data offsets for each band of image data.
protected  intpixelStride
     Pixel stride of the image data contained in this Raster.
protected  intscanlineStride
     Scanline stride of the image data contained in this Raster.
 inttype
    

Constructor Summary
public  ByteComponentRaster(SampleModel sampleModel, Point origin)
     Constructs a ByteComponentRaster with the given SampleModel. The Raster's upper left corner is origin and it is the same size as the SampleModel.
public  ByteComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin)
     Constructs a ByteComponentRaster with the given SampleModel and DataBuffer.
public  ByteComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point origin, ByteComponentRaster parent)
     Constructs a ByteComponentRaster with the given SampleModel, DataBuffer, and parent.

Method Summary
public  RastercreateChild(int x, int y, int width, int height, int x0, int y0, int[] bandList)
     Creates a subraster given a region of the raster.
public  WritableRastercreateCompatibleWritableRaster(int w, int h)
     Creates a Raster with the same layout but using a different width and height, and with new zeroed data arrays.
public  WritableRastercreateCompatibleWritableRaster()
     Creates a Raster with the same layout and the same width and height, and with new zeroed data arrays.
public  WritableRastercreateWritableChild(int x, int y, int width, int height, int x0, int y0, int[] bandList)
     Creates a Writable subRaster given a region of the Raster.
public  byte[]getByteData(int x, int y, int w, int h, int band, byte[] outData)
     Returns a byte array of data elements from the specified rectangular region for the specified band. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds.
 byte[] bandData = raster.getByteData(x, y, w, h, null);
 // To find the data element at location (x2, y2)
 byte bandElement = bandData[((y2-y)*w + (x2-x))];
 

Parameters:
  x - The X coordinate of the upper left pixel location.
Parameters:
  y - The Y coordinate of the upper left pixel location.
Parameters:
  width - Width of the pixel rectangle.
Parameters:
  height - Height of the pixel rectangle.
Parameters:
  band - The band to return.
Parameters:
  outData - If non-null, data elements for all bandsat the specified location are returned in this array.
public  byte[]getByteData(int x, int y, int w, int h, byte[] outData)
     Returns a byte array of data elements from the specified rectangular region. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds.
 byte[] bandData = raster.getByteData(x, y, w, h, null);
 int numDataElements = raster.getnumDataElements();
 byte[] pixel = new byte[numDataElements];
 // To find a data element at location (x2, y2)
 System.arraycopy(bandData, ((y2-y)*w + (x2-x))*numDataElements,
 pixel, 0, numDataElements);
 

Parameters:
  x - The X coordinate of the upper left pixel location.
Parameters:
  y - The Y coordinate of the upper left pixel location.
Parameters:
  width - Width of the pixel rectangle.
Parameters:
  height - Height of the pixel rectangle.
Parameters:
  outData - If non-null, data elements for all bandsat the specified location are returned in this array.
public  ObjectgetDataElements(int x, int y, Object obj)
     Returns the data elements for all bands at the specified location.
public  ObjectgetDataElements(int x, int y, int w, int h, Object obj)
     Returns an array of data elements from the specified rectangular region. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType.
 byte[] bandData = (byte[])raster.getDataElements(x, y, w, h, null);
 int numDataElements = raster.getNumDataElements();
 byte[] pixel = new byte[numDataElements];
 // To find a data element at location (x2, y2)
 System.arraycopy(bandData, ((y2-y)*w + (x2-x))*numDataElements,
 pixel, 0, numDataElements);
 

Parameters:
  x - The X coordinate of the upper left pixel location.
Parameters:
  y - The Y coordinate of the upper left pixel location.
Parameters:
  width - Width of the pixel rectangle.
Parameters:
  height - Height of the pixel rectangle.
Parameters:
  outData - An object reference to an array of type defined bygetTransferType() and length w*h*getNumDataElements().If null an array of appropriate type and size will beallocated.
public  intgetDataOffset(int band)
     Returns the data offset for the specified band.
public  int[]getDataOffsets()
     Returns a copy of the data offsets array.
public  byte[]getDataStorage()
     Returns a reference to the data array.
public  intgetPixelStride()
     Returns pixel stride -- the number of data array elements between two samples for the same band on the same scanline.
public  intgetScanlineStride()
     Returns the scanline stride -- the number of data array elements between a given sample and the sample in the same column of the next row in the same band.
public  voidputByteData(int x, int y, int w, int h, int band, byte[] inData)
     Stores a byte array of data elements into the specified rectangular region for the specified band. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds. The data elements in the data array are assumed to be packed.
public  voidputByteData(int x, int y, int w, int h, byte[] inData)
     Stores a byte array of data elements into the specified rectangular region. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds. The data elements in the data array are assumed to be packed.
public  voidsetDataElements(int x, int y, Object obj)
     Stores the data elements for all bands at the specified location.
public  voidsetDataElements(int x, int y, Raster inRaster)
     Stores the Raster data at the specified location.
public  voidsetDataElements(int x, int y, int w, int h, Object obj)
     Stores an array of data elements into the specified rectangular region. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType. The data elements in the data array are assumed to be packed.
public  StringtoString()
    

Field Detail
bandOffset
protected int bandOffset(Code)
private band offset for use by native code



data
protected byte[] data(Code)
The image data array.



dataOffsets
protected int[] dataOffsets(Code)
Data offsets for each band of image data.



pixelStride
protected int pixelStride(Code)
Pixel stride of the image data contained in this Raster.



scanlineStride
protected int scanlineStride(Code)
Scanline stride of the image data contained in this Raster.



type
int type(Code)




Constructor Detail
ByteComponentRaster
public ByteComponentRaster(SampleModel sampleModel, Point origin)(Code)
Constructs a ByteComponentRaster with the given SampleModel. The Raster's upper left corner is origin and it is the same size as the SampleModel. A DataBuffer large enough to describe the Raster is automatically created. SampleModel must be of type SinglePixelPackedSampleModel or ComponentSampleModel.
Parameters:
  sampleModel - The SampleModel that specifies the layout.
Parameters:
  origin - The Point that specified the origin.



ByteComponentRaster
public ByteComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin)(Code)
Constructs a ByteComponentRaster with the given SampleModel and DataBuffer. The Raster's upper left corner is origin and it is the same size as the SampleModel. The DataBuffer is not initialized and must be a DataBufferByte compatible with SampleModel. SampleModel must be of type SinglePixelPackedSampleModel or ComponentSampleModel.
Parameters:
  sampleModel - The SampleModel that specifies the layout.
Parameters:
  dataBuffer - The DataBufferShort that contains the image data.
Parameters:
  origin - The Point that specifies the origin.



ByteComponentRaster
public ByteComponentRaster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point origin, ByteComponentRaster parent)(Code)
Constructs a ByteComponentRaster with the given SampleModel, DataBuffer, and parent. DataBuffer must be a DataBufferByte and SampleModel must be of type SinglePixelPackedSampleModel or ComponentSampleModel. When translated into the base Raster's coordinate system, aRegion must be contained by the base Raster. Origin is the coordinate in the new Raster's coordinate system of the origin of the base Raster. (The base Raster is the Raster's ancestor which has no parent.) Note that this constructor should generally be called by other constructors or create methods, it should not be used directly.
Parameters:
  sampleModel - The SampleModel that specifies the layout.
Parameters:
  dataBuffer - The DataBufferShort that contains the image data.
Parameters:
  aRegion - The Rectangle that specifies the image area.
Parameters:
  origin - The Point that specifies the origin.
Parameters:
  parent - The parent (if any) of this raster.




Method Detail
createChild
public Raster createChild(int x, int y, int width, int height, int x0, int y0, int[] bandList)(Code)
Creates a subraster given a region of the raster. The x and y coordinates specify the horizontal and vertical offsets from the upper-left corner of this raster to the upper-left corner of the subraster. A subset of the bands of the parent Raster may be specified. If this is null, then all the bands are present in the subRaster. A translation to the subRaster may also be specified. Note that the subraster will reference the same DataBuffer as the parent raster, but using different offsets.
Parameters:
  x - X offset.
Parameters:
  y - Y offset.
Parameters:
  width - Width (in pixels) of the subraster.
Parameters:
  height - Height (in pixels) of the subraster.
Parameters:
  x0 - Translated X origin of the subraster.
Parameters:
  y0 - Translated Y origin of the subraster.
Parameters:
  bandList - Array of band indices.
exception:
  RasterFormatException - if the specified bounding box is outside of the parent raster.



createCompatibleWritableRaster
public WritableRaster createCompatibleWritableRaster(int w, int h)(Code)
Creates a Raster with the same layout but using a different width and height, and with new zeroed data arrays.



createCompatibleWritableRaster
public WritableRaster createCompatibleWritableRaster()(Code)
Creates a Raster with the same layout and the same width and height, and with new zeroed data arrays. If the Raster is a subRaster, this will call createCompatibleRaster(width, height).



createWritableChild
public WritableRaster createWritableChild(int x, int y, int width, int height, int x0, int y0, int[] bandList)(Code)
Creates a Writable subRaster given a region of the Raster. The x and y coordinates specify the horizontal and vertical offsets from the upper-left corner of this Raster to the upper-left corner of the subRaster. A subset of the bands of the parent Raster may be specified. If this is null, then all the bands are present in the subRaster. A translation to the subRaster may also be specified. Note that the subRaster will reference the same DataBuffer as the parent Raster, but using different offsets.
Parameters:
  x - X offset.
Parameters:
  y - Y offset.
Parameters:
  width - Width (in pixels) of the subraster.
Parameters:
  height - Height (in pixels) of the subraster.
Parameters:
  x0 - Translated X origin of the subraster.
Parameters:
  y0 - Translated Y origin of the subraster.
Parameters:
  bandList - Array of band indices.
exception:
  RasterFormatException - if the specified bounding box is outside of the parent Raster.



getByteData
public byte[] getByteData(int x, int y, int w, int h, int band, byte[] outData)(Code)
Returns a byte array of data elements from the specified rectangular region for the specified band. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds.
 byte[] bandData = raster.getByteData(x, y, w, h, null);
 // To find the data element at location (x2, y2)
 byte bandElement = bandData[((y2-y)*w + (x2-x))];
 

Parameters:
  x - The X coordinate of the upper left pixel location.
Parameters:
  y - The Y coordinate of the upper left pixel location.
Parameters:
  width - Width of the pixel rectangle.
Parameters:
  height - Height of the pixel rectangle.
Parameters:
  band - The band to return.
Parameters:
  outData - If non-null, data elements for all bandsat the specified location are returned in this array. Data array with data elements for all bands.



getByteData
public byte[] getByteData(int x, int y, int w, int h, byte[] outData)(Code)
Returns a byte array of data elements from the specified rectangular region. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds.
 byte[] bandData = raster.getByteData(x, y, w, h, null);
 int numDataElements = raster.getnumDataElements();
 byte[] pixel = new byte[numDataElements];
 // To find a data element at location (x2, y2)
 System.arraycopy(bandData, ((y2-y)*w + (x2-x))*numDataElements,
 pixel, 0, numDataElements);
 

Parameters:
  x - The X coordinate of the upper left pixel location.
Parameters:
  y - The Y coordinate of the upper left pixel location.
Parameters:
  width - Width of the pixel rectangle.
Parameters:
  height - Height of the pixel rectangle.
Parameters:
  outData - If non-null, data elements for all bandsat the specified location are returned in this array. Data array with data elements for all bands.



getDataElements
public Object getDataElements(int x, int y, Object obj)(Code)
Returns the data elements for all bands at the specified location. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinate is out of bounds. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType.
Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  outData - An object reference to an array of type defined bygetTransferType() and length getNumDataElements().If null an array of appropriate type and size will beallocated. An object reference to an array of type defined bygetTransferType() with the request pixel data.



getDataElements
public Object getDataElements(int x, int y, int w, int h, Object obj)(Code)
Returns an array of data elements from the specified rectangular region. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType.
 byte[] bandData = (byte[])raster.getDataElements(x, y, w, h, null);
 int numDataElements = raster.getNumDataElements();
 byte[] pixel = new byte[numDataElements];
 // To find a data element at location (x2, y2)
 System.arraycopy(bandData, ((y2-y)*w + (x2-x))*numDataElements,
 pixel, 0, numDataElements);
 

Parameters:
  x - The X coordinate of the upper left pixel location.
Parameters:
  y - The Y coordinate of the upper left pixel location.
Parameters:
  width - Width of the pixel rectangle.
Parameters:
  height - Height of the pixel rectangle.
Parameters:
  outData - An object reference to an array of type defined bygetTransferType() and length w*h*getNumDataElements().If null an array of appropriate type and size will beallocated. An object reference to an array of type defined bygetTransferType() with the request pixel data.



getDataOffset
public int getDataOffset(int band)(Code)
Returns the data offset for the specified band. The data offset is the index into the data array in which the first sample of the first scanline is stored.
Parameters:
  band - The band whose offset is returned.



getDataOffsets
public int[] getDataOffsets()(Code)
Returns a copy of the data offsets array. For each band the data offset is the index into the band's data array, of the first sample of the band.



getDataStorage
public byte[] getDataStorage()(Code)
Returns a reference to the data array.



getPixelStride
public int getPixelStride()(Code)
Returns pixel stride -- the number of data array elements between two samples for the same band on the same scanline.



getScanlineStride
public int getScanlineStride()(Code)
Returns the scanline stride -- the number of data array elements between a given sample and the sample in the same column of the next row in the same band.



putByteData
public void putByteData(int x, int y, int w, int h, int band, byte[] inData)(Code)
Stores a byte array of data elements into the specified rectangular region for the specified band. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds. The data elements in the data array are assumed to be packed. That is, a data element at location (x2, y2) would be found at:
 inData[((y2-y)*w + (x2-x)) + n]
 

Parameters:
  x - The X coordinate of the upper left pixel location.
Parameters:
  y - The Y coordinate of the upper left pixel location.
Parameters:
  w - Width of the pixel rectangle.
Parameters:
  h - Height of the pixel rectangle.
Parameters:
  band - The band to set.
Parameters:
  inData - The data elements to be stored.



putByteData
public void putByteData(int x, int y, int w, int h, byte[] inData)(Code)
Stores a byte array of data elements into the specified rectangular region. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds. The data elements in the data array are assumed to be packed. That is, a data element for the nth band at location (x2, y2) would be found at:
 inData[((y2-y)*w + (x2-x))*numDataElements + n]
 

Parameters:
  x - The X coordinate of the upper left pixel location.
Parameters:
  y - The Y coordinate of the upper left pixel location.
Parameters:
  w - Width of the pixel rectangle.
Parameters:
  h - Height of the pixel rectangle.
Parameters:
  inData - The data elements to be stored.



setDataElements
public void setDataElements(int x, int y, Object obj)(Code)
Stores the data elements for all bands at the specified location. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinate is out of bounds. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType.
Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  inData - An object reference to an array of type defined bygetTransferType() and length getNumDataElements()containing the pixel data to place at x,y.



setDataElements
public void setDataElements(int x, int y, Raster inRaster)(Code)
Stores the Raster data at the specified location. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds.
Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  inRaster - Raster of data to place at x,y location.



setDataElements
public void setDataElements(int x, int y, int w, int h, Object obj)(Code)
Stores an array of data elements into the specified rectangular region. An ArrayIndexOutOfBounds exception will be thrown at runtime if the pixel coordinates are out of bounds. A ClassCastException will be thrown if the input object is non null and references anything other than an array of transferType. The data elements in the data array are assumed to be packed. That is, a data element for the nth band at location (x2, y2) would be found at:
 inData[((y2-y)*w + (x2-x))*numDataElements + n]
 

Parameters:
  x - The X coordinate of the upper left pixel location.
Parameters:
  y - The Y coordinate of the upper left pixel location.
Parameters:
  w - Width of the pixel rectangle.
Parameters:
  h - Height of the pixel rectangle.
Parameters:
  inData - An object reference to an array of type defined bygetTransferType() and length w*h*getNumDataElements()containing the pixel data to place between x,y andx+h, y+h.



toString
public String toString()(Code)



Methods inherited from sun.awt.image.SunWritableRaster
public static void markDirty(DataBuffer db)(Code)(Java Doc)
public static void markDirty(WritableRaster wr)(Code)(Java Doc)
public static void markDirty(Image img)(Code)(Java Doc)
final public void markDirty()(Code)(Java Doc)
public static void setDataStealer(DataStealer ds)(Code)(Java Doc)
public static byte[] stealData(DataBufferByte dbb, int bank)(Code)(Java Doc)
public static short[] stealData(DataBufferUShort dbus, int bank)(Code)(Java Doc)
public static int[] stealData(DataBufferInt dbi, int bank)(Code)(Java Doc)
public static StateTrackableDelegate stealTrackable(DataBuffer db)(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.