Java Doc for ComponentSampleModelJAI.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » javax » media » jai » 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 » Java Advanced Imaging » javax.media.jai 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.media.jai.ComponentSampleModelJAI

ComponentSampleModelJAI
public class ComponentSampleModelJAI extends ComponentSampleModel (Code)
This class represents image data which is stored such that each sample of a pixel occupies one data element of the DataBuffer. It stores the N samples which make up a pixel in N separate data array elements. Different bands may be in different banks of the DataBuffer. Accessor methods are provided so that image data can be manipulated directly. This class can support different kinds of interleaving, e.g. band interleaving, scanline interleaving, and pixel interleaving. Pixel stride is the number of data array elements between two samples for the same band on the same scanline. Scanline stride is the number of data array elements between a given sample and the corresponding sample in the same column of the next scanline. Band offsets denote the number of data array elements from the first data array element of the bank of the DataBuffer holding each band to the first sample of the band. The bands are numbered from 0 to N-1. This class can represent image data for the dataTypes enumerated in java.awt.image.DataBuffer (all samples of a given ComponentSampleModel are stored with the same precision) . This class adds support for Double and Float data types in addition to those supported by the ComponentSampleModel class in Java 2D. All strides and offsets must be non-negative.
See Also:   java.awt.image.ComponentSampleModel



Constructor Summary
public  ComponentSampleModelJAI(int dataType, int w, int h, int pixelStride, int scanlineStride, int bandOffsets)
     Constructs a ComponentSampleModel with the specified parameters.
public  ComponentSampleModelJAI(int dataType, int w, int h, int pixelStride, int scanlineStride, int bankIndices, int bandOffsets)
     Constructs a ComponentSampleModel with the specified parameters.

Method Summary
public  SampleModelcreateCompatibleSampleModel(int w, int h)
     Creates a new ComponentSampleModel with the specified width and height.
public  DataBuffercreateDataBuffer()
     Creates a DataBuffer that corresponds to this ComponentSampleModel.
public  SampleModelcreateSubsetSampleModel(int bands)
     This creates a new ComponentSampleModel with a subset of the bands of this ComponentSampleModel.
public  ObjectgetDataElements(int x, int y, Object obj, DataBuffer data)
     Returns data for a single pixel in a primitive array of type TransferType.
public  ObjectgetDataElements(int x, int y, int w, int h, Object obj, DataBuffer data)
     Returns the pixel data for the specified rectangle of pixels in a primitive array of type TransferType. For image data supported by the Java 2D API, this will be one of the dataTypes supported by java.awt.image.DataBuffer. Data may be returned in a packed format, thus increasing efficiency for data transfers.
public  double[]getPixels(int x, int y, int w, int h, double dArray, DataBuffer data)
     Returns all samples for a rectangle of pixels in a double array, one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
Parameters:
  x - The X coordinate of the upper left pixel location.
Parameters:
  y - The Y coordinate of the upper left pixel location.
Parameters:
  w - The width of the pixel rectangle.
Parameters:
  h - The height of the pixel rectangle.
Parameters:
  dArray - If non-null, returns the samples in this array.
Parameters:
  data - The DataBuffer containing the image data.
public  doublegetSampleDouble(int x, int y, int b, DataBuffer data)
     Returns the sample in a specified band for a pixel located at (x,y) as a double. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  b - The band to return.
Parameters:
  data - The DataBuffer containing the image data.
public  floatgetSampleFloat(int x, int y, int b, DataBuffer data)
     Returns the sample in a specified band for the pixel located at (x,y) as a float. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  b - The band to return.
Parameters:
  data - The DataBuffer containing the image data.
public  voidsetDataElements(int x, int y, Object obj, DataBuffer data)
     Sets the data for a single pixel in the specified DataBuffer from a primitive array of type TransferType.
public  voidsetDataElements(int x, int y, int w, int h, Object obj, DataBuffer data)
     Sets the data for a rectangle of pixels in the specified DataBuffer from a primitive array of type TransferType.
public  voidsetSample(int x, int y, int b, float s, DataBuffer data)
     Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a float for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  b - The band to set.
Parameters:
  s - The input sample as a float.
Parameters:
  data - The DataBuffer containing the image data.
public  voidsetSample(int x, int y, int b, double s, DataBuffer data)
     Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a double for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  b - The band to set.
Parameters:
  s - The input sample as a double.
Parameters:
  data - The DataBuffer containing the image data.
public  StringtoString()
     Returns a String containing the values of all valid fields.


Constructor Detail
ComponentSampleModelJAI
public ComponentSampleModelJAI(int dataType, int w, int h, int pixelStride, int scanlineStride, int bandOffsets)(Code)
Constructs a ComponentSampleModel with the specified parameters. The number of bands will be given by the length of the bandOffsets array. All bands will be stored in the first bank of the DataBuffer.
Parameters:
  dataType - The data type for storing samples.
Parameters:
  w - The width (in pixels) of the region ofimage data described.
Parameters:
  h - The height (in pixels) of the region ofimage data described.
Parameters:
  pixelStride - The pixel stride of the region of imagedata described.
Parameters:
  scanlineStride - The line stride of the region of imagedata described.
Parameters:
  bandOffsets - The offsets of all bands.



ComponentSampleModelJAI
public ComponentSampleModelJAI(int dataType, int w, int h, int pixelStride, int scanlineStride, int bankIndices, int bandOffsets)(Code)
Constructs a ComponentSampleModel with the specified parameters. The number of bands will be given by the length of the bandOffsets array. Different bands may be stored in different banks of the DataBuffer.
Parameters:
  dataType - The data type for storing samples.
Parameters:
  w - The width (in pixels) of the region ofimage data described.
Parameters:
  h - The height (in pixels) of the region ofimage data described.
Parameters:
  pixelStride - The pixel stride of the region of imagedata described.
Parameters:
  scanlineStride - The line stride of the region of imagedata described.
Parameters:
  bankIndices - The bank indices of all bands.
Parameters:
  bandOffsets - The band offsets of all bands.




Method Detail
createCompatibleSampleModel
public SampleModel createCompatibleSampleModel(int w, int h)(Code)
Creates a new ComponentSampleModel with the specified width and height. The new SampleModel will have the same number of bands, storage data type, interleaving scheme, and pixel stride as this SampleModel.
Parameters:
  w - The width in pixels.
Parameters:
  h - The height in pixels



createDataBuffer
public DataBuffer createDataBuffer()(Code)
Creates a DataBuffer that corresponds to this ComponentSampleModel. The DataBuffer's data type, number of banks, and size will be consistent with this ComponentSampleModel.



createSubsetSampleModel
public SampleModel createSubsetSampleModel(int bands)(Code)
This creates a new ComponentSampleModel with a subset of the bands of this ComponentSampleModel. The new ComponentSampleModel can be used with any DataBuffer that the existing ComponentSampleModel can be used with. The new ComponentSampleModel/DataBuffer combination will represent an image with a subset of the bands of the original ComponentSampleModel/DataBuffer combination.
Parameters:
  bands - subset of bands of this ComponentSampleModel



getDataElements
public Object getDataElements(int x, int y, Object obj, DataBuffer data)(Code)
Returns data for a single pixel in a primitive array of type TransferType. For a ComponentSampleModel, this will be the same as the data type, and samples will be returned one per array element. Generally, obj should be passed in as null, so that the Object will be created automatically and will be of the right primitive data type.

The following code illustrates transferring data for one pixel from DataBuffer db1, whose storage layout is described by ComponentSampleModel csm1, to DataBuffer db2, whose storage layout is described by ComponentSampleModel csm2. The transfer will generally be more efficient than using getPixel/setPixel.

 ComponentSampleModel csm1, csm2;
 DataBufferInt db1, db2;
 csm2.setDataElements(x, y,
 csm1.getDataElements(x, y, null, db1), db2);
 
Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands, corresponding bands have the same number of bits per sample, and the TransferTypes are the same.


Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  obj - If non-null, a primitive array in which to returnthe pixel data.
Parameters:
  data - The DataBuffer containing the image data. ClassCastException if obj is non-null and is nota primitive array of type TransferType. ArrayIndexOutOfBoundsException if the coordinatesare not in bounds, or if obj is non-null and is not large enough to hold the pixel data.




getDataElements
public Object getDataElements(int x, int y, int w, int h, Object obj, DataBuffer data)(Code)
Returns the pixel data for the specified rectangle of pixels in a primitive array of type TransferType. For image data supported by the Java 2D API, this will be one of the dataTypes supported by java.awt.image.DataBuffer. Data may be returned in a packed format, thus increasing efficiency for data transfers. Generally, obj should be passed in as null, so that the Object will be created automatically and will be of the right primitive data type.

The following code illustrates transferring data for a rectangular region of pixels from DataBuffer db1, whose storage layout is described by SampleModel sm1, to DataBuffer db2, whose storage layout is described by SampleModel sm2. The transfer will generally be more efficient than using getPixels/setPixels.

 SampleModel sm1, sm2;
 DataBuffer db1, db2;
 sm2.setDataElements(x, y, w, h, sm1.getDataElements(x, y, w,
 h, null, db1), db2);
 
Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands, corresponding bands have the same number of bits per sample, and the TransferTypes are the same.


Parameters:
  x - The minimum X coordinate of the pixel rectangle.
Parameters:
  y - The minimum Y coordinate of the pixel rectangle.
Parameters:
  w - The width of the pixel rectangle.
Parameters:
  h - The height of the pixel rectangle.
Parameters:
  obj - If non-null, a primitive array in which to returnthe pixel data.
Parameters:
  data - The DataBuffer containing the image data.
See Also:   ComponentSampleModelJAI.getNumDataElements
See Also:   ComponentSampleModelJAI.getTransferType
See Also:   java.awt.image.DataBuffer ClassCastException if obj is non-null and is nota primitive array of type TransferType. ArrayIndexOutOfBoundsException if the coordinatesare not in bounds, or if obj is non-null and is not large enough to hold the pixel data.




getPixels
public double[] getPixels(int x, int y, int w, int h, double dArray, DataBuffer data)(Code)
Returns all samples for a rectangle of pixels in a double array, one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
Parameters:
  x - The X coordinate of the upper left pixel location.
Parameters:
  y - The Y coordinate of the upper left pixel location.
Parameters:
  w - The width of the pixel rectangle.
Parameters:
  h - The height of the pixel rectangle.
Parameters:
  dArray - If non-null, returns the samples in this array.
Parameters:
  data - The DataBuffer containing the image data. ArrayIndexOutOfBoundsException if coordinates are not in bounds



getSampleDouble
public double getSampleDouble(int x, int y, int b, DataBuffer data)(Code)
Returns the sample in a specified band for a pixel located at (x,y) as a double. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  b - The band to return.
Parameters:
  data - The DataBuffer containing the image data. sample The double sample value ArrayIndexOutOfBoundsException if coordinates are not in bounds



getSampleFloat
public float getSampleFloat(int x, int y, int b, DataBuffer data)(Code)
Returns the sample in a specified band for the pixel located at (x,y) as a float. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  b - The band to return.
Parameters:
  data - The DataBuffer containing the image data. sample The floating point sample value ArrayIndexOutOfBoundsException if coordinates are not in bounds



setDataElements
public void setDataElements(int x, int y, Object obj, DataBuffer data)(Code)
Sets the data for a single pixel in the specified DataBuffer from a primitive array of type TransferType. For a ComponentSampleModel, this will be the same as the data type, and samples are transferred one per array element.

The following code illustrates transferring data for one pixel from DataBuffer db1, whose storage layout is described by ComponentSampleModel csm1, to DataBuffer db2, whose storage layout is described by ComponentSampleModel csm2. The transfer will generally be more efficient than using getPixel/setPixel.

 ComponentSampleModel csm1, csm2;
 DataBufferInt db1, db2;
 csm2.setDataElements(x, y, csm1.getDataElements(x, y, null, db1),
 db2);
 
Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands, corresponding bands have the same number of bits per sample, and the TransferTypes are the same.


Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  obj - A primitive array containing pixel data.
Parameters:
  data - The DataBuffer containing the image data. ClassCastException if obj is non-null and is nota primitive array of type TransferType. ArrayIndexOutOfBoundsException if the coordinatesare not in bounds, or if obj is non-null and is not large enough to hold the pixel data.




setDataElements
public void setDataElements(int x, int y, int w, int h, Object obj, DataBuffer data)(Code)
Sets the data for a rectangle of pixels in the specified DataBuffer from a primitive array of type TransferType. For image data supported by the Java 2D API, this will be one of the dataTypes supported by java.awt.image.DataBuffer. Data in the array may be in a packed format, thus increasing efficiency for data transfers.

The following code illustrates transferring data for a rectangular region of pixels from DataBuffer db1, whose storage layout is described by SampleModel sm1, to DataBuffer db2, whose storage layout is described by SampleModel sm2. The transfer will generally be more efficient than using getPixels/setPixels.

 SampleModel sm1, sm2;
 DataBuffer db1, db2;
 sm2.setDataElements(x, y, w, h, sm1.getDataElements(x, y, w, h,
 null, db1), db2);
 
Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands, corresponding bands have the same number of bits per sample, and the TransferTypes are the same.


Parameters:
  x - The minimum X coordinate of the pixel rectangle.
Parameters:
  y - The minimum Y coordinate of the pixel rectangle.
Parameters:
  w - The width of the pixel rectangle.
Parameters:
  h - The height of the pixel rectangle.
Parameters:
  obj - A primitive array containing pixel data.
Parameters:
  data - The DataBuffer containing the image data. ClassCastException if obj is non-null and is nota primitive array of type TransferType. ArrayIndexOutOfBoundsException if the coordinatesare not in bounds, or if obj is non-null and is not large enough to hold the pixel data.
See Also:   ComponentSampleModelJAI.getNumDataElements
See Also:   ComponentSampleModelJAI.getTransferType
See Also:   java.awt.image.DataBuffer




setSample
public void setSample(int x, int y, int b, float s, DataBuffer data)(Code)
Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a float for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  b - The band to set.
Parameters:
  s - The input sample as a float.
Parameters:
  data - The DataBuffer containing the image data. ArrayIndexOutOfBoundsException if coordinates are not in bounds



setSample
public void setSample(int x, int y, int b, double s, DataBuffer data)(Code)
Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using a double for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.
Parameters:
  x - The X coordinate of the pixel location.
Parameters:
  y - The Y coordinate of the pixel location.
Parameters:
  b - The band to set.
Parameters:
  s - The input sample as a double.
Parameters:
  data - The DataBuffer containing the image data. ArrayIndexOutOfBoundsException if coordinates are not in bounds



toString
public String toString()(Code)
Returns a String containing the values of all valid fields.



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