Java Doc for IndexColorModel.java in  » 6.0-JDK-Modules » j2me » java » 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 » j2me » java.awt.image 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.image.ColorModel
      java.awt.image.IndexColorModel

IndexColorModel
public class IndexColorModel extends ColorModel (Code)
The IndexColorModel class is a ColorModel class that works with pixel values consisting of a single sample that is an index into a fixed colormap in the default sRGB color space. The colormap specifies red, green, blue, and optional alpha components corresponding to each index. All components are represented in the colormap as 8-bit unsigned integral values. Some constructors allow the caller to specify "holes" in the colormap by indicating which colormap entries are valid and which represent unusable colors via the bits set in a BigInteger object. This color model is similar to an X11 PseudoColor visual.

Some constructors provide a means to specify an alpha component for each pixel in the colormap, while others either provide no such means or, in some cases, a flag to indicate whether the colormap data contains alpha values. If no alpha is supplied to the constructor, an opaque alpha component (alpha = 1.0) is assumed for each entry. An optional transparent pixel value can be supplied that indicates a completely transparent pixel, regardless of any alpha component supplied or assumed for that pixel value. Note that the color components in the colormap of an IndexColorModel objects are never pre-multiplied with the alpha components.

The transparency of an IndexColorModel object is determined by examining the alpha components of the colors in the colormap and choosing the most specific value after considering the optional alpha values and any transparent index specified. The transparency value is Transparency.OPAQUE only if all valid colors in the colormap are opaque and there is no valid transparent pixel. If all valid colors in the colormap are either completely opaque (alpha = 1.0) or completely transparent (alpha = 0.0), which typically occurs when a valid transparent pixel is specified, the value is Transparency.BITMASK. Otherwise, the value is Transparency.TRANSLUCENT, indicating that some valid color has an alpha component that is neither completely transparent nor completely opaque (0.0 < alpha < 1.0).

The index represented by a pixel value is stored in the least significant n bits of the pixel representations passed to the methods of this class, where n is the pixel size specified to the constructor for a particular IndexColorModel object; n must be between 1 and 16, inclusive. Higher order bits in pixel representations are assumed to be zero. For those methods that use a primitive array pixel representation of type transferType, the array length is always one. The transfer types supported are DataBuffer.TYPE_BYTE and DataBuffer.TYPE_USHORT. A single int pixel representation is valid for all objects of this class, since it is always possible to represent pixel values used with this class in a single int. Therefore, methods that use this representation do not throw an IllegalArgumentException due to an invalid pixel value.

Many of the methods in this class are final. The reason for this is that the underlying native graphics code makes assumptions about the layout and operation of this class and those assumptions are reflected in the implementations of the methods here that are marked final. You can subclass this class for other reaons, but you cannot override or modify the behaviour of those methods.
See Also:   ColorModel
See Also:   ColorSpace
See Also:   DataBuffer
version:
   10 Feb 1997




Constructor Summary
public  IndexColorModel(int bits, int size, byte r, byte g, byte b)
     Constructs an IndexColorModel from the specified arrays of red, green, and blue components.
public  IndexColorModel(int bits, int size, byte r, byte g, byte b, int trans)
     Constructs an IndexColorModel from the given arrays of red, green, and blue components.
public  IndexColorModel(int bits, int size, byte r, byte g, byte b, byte a)
     Constructs an IndexColorModel from the given arrays of red, green, blue and alpha components.
public  IndexColorModel(int bits, int size, byte cmap, int start, boolean hasalpha)
     Constructs an IndexColorModel from a single array of interleaved red, green, blue and optional alpha components.
public  IndexColorModel(int bits, int size, byte cmap, int start, boolean hasalpha, int trans)
     Constructs an IndexColorModel from a single array of interleaved red, green, blue and optional alpha components.

Method Summary
public  voidfinalize()
     Disposes of system resources associated with this ColorModel once this ColorModel is no longer referenced.
final public  intgetAlpha(int pixel)
     Returns the alpha component for the specified pixel, scaled from 0 to 255.
final public  voidgetAlphas(byte a)
     Copies the array of alpha transparency components into the specified array.
final public  intgetBlue(int pixel)
     Returns the blue color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
final public  voidgetBlues(byte b)
     Copies the array of blue color components into the specified array.
final public  intgetGreen(int pixel)
     Returns the green color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
final public  voidgetGreens(byte g)
     Copies the array of green color components into the specified array.
final public  intgetMapSize()
     Returns the size of the color/alpha component arrays in this IndexColorModel.
final public  intgetRGB(int pixel)
     Returns the color/alpha components of the pixel in the default RGB color model format.
final public  intgetRed(int pixel)
     Returns the red color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB.
final public  voidgetReds(byte r)
     Copies the array of red color components into the specified array.
final public  intgetTransparentPixel()
     Returns the index of the transparent pixel in this IndexColorModel or -1 if there is no transparent pixel.
public  StringtoString()
     Returns the String representation of the contents of this ColorModelobject.


Constructor Detail
IndexColorModel
public IndexColorModel(int bits, int size, byte r, byte g, byte b)(Code)
Constructs an IndexColorModel from the specified arrays of red, green, and blue components. Pixels described by this color model all have alpha components of 255 unnormalized (1.0 normalized), which means they are fully opaque. All of the arrays specifying the color components must have at least the specified number of entries. The ColorSpace is the default sRGB space. Since there is no alpha information in any of the arguments to this constructor, the transparency value is always Transparency.OPAQUE. The transfer type is the smallest of DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT that can hold a single pixel.
Parameters:
  bits - the number of bits each pixel occupies
Parameters:
  size - the size of the color component arrays
Parameters:
  r - the array of red color components
Parameters:
  g - the array of green color components
Parameters:
  b - the array of blue color components
throws:
  IllegalArgumentException - if bits is lessthan 1 or greater than 16
throws:
  IllegalArgumentException - if size is lessthan 1



IndexColorModel
public IndexColorModel(int bits, int size, byte r, byte g, byte b, int trans)(Code)
Constructs an IndexColorModel from the given arrays of red, green, and blue components. Pixels described by this color model all have alpha components of 255 unnormalized (1.0 normalized), which means they are fully opaque, except for the indicated transparent pixel. All of the arrays specifying the color components must have at least the specified number of entries. The ColorSpace is the default sRGB space. The transparency value may be Transparency.OPAQUE or Transparency.BITMASK depending on the arguments, as specified in the class description above. The transfer type is the smallest of DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT that can hold a single pixel.
Parameters:
  bits - the number of bits each pixel occupies
Parameters:
  size - the size of the color component arrays
Parameters:
  r - the array of red color components
Parameters:
  g - the array of green color components
Parameters:
  b - the array of blue color components
Parameters:
  trans - the index of the transparent pixel
throws:
  IllegalArgumentException - if bits is less than1 or greater than 16
throws:
  IllegalArgumentException - if size is less than1



IndexColorModel
public IndexColorModel(int bits, int size, byte r, byte g, byte b, byte a)(Code)
Constructs an IndexColorModel from the given arrays of red, green, blue and alpha components. All of the arrays specifying the components must have at least the specified number of entries. The ColorSpace is the default sRGB space. The transparency value may be any of Transparency.OPAQUE, Transparency.BITMASK, or Transparency.TRANSLUCENT depending on the arguments, as specified in the class description above. The transfer type is the smallest of DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT that can hold a single pixel.
Parameters:
  bits - the number of bits each pixel occupies
Parameters:
  size - the size of the color component arrays
Parameters:
  r - the array of red color components
Parameters:
  g - the array of green color components
Parameters:
  b - the array of blue color components
Parameters:
  a - the array of alpha value components
throws:
  IllegalArgumentException - if bits is lessthan 1 or greater than 16
throws:
  IllegalArgumentException - if size is lessthan 1



IndexColorModel
public IndexColorModel(int bits, int size, byte cmap, int start, boolean hasalpha)(Code)
Constructs an IndexColorModel from a single array of interleaved red, green, blue and optional alpha components. The array must have enough values in it to fill all of the needed component arrays of the specified size. The ColorSpace is the default sRGB space. The transparency value may be any of Transparency.OPAQUE, Transparency.BITMASK, or Transparency.TRANSLUCENT depending on the arguments, as specified in the class description above. The transfer type is the smallest of DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT that can hold a single pixel.
Parameters:
  bits - the number of bits each pixel occupies
Parameters:
  size - the size of the color component arrays
Parameters:
  cmap - the array of color components
Parameters:
  start - the starting offset of the first color component
Parameters:
  hasalpha - indicates whether alpha values are contained inthe cmap array
throws:
  IllegalArgumentException - if bits is lessthan 1 or greater than 16
throws:
  IllegalArgumentException - if size is lessthan 1



IndexColorModel
public IndexColorModel(int bits, int size, byte cmap, int start, boolean hasalpha, int trans)(Code)
Constructs an IndexColorModel from a single array of interleaved red, green, blue and optional alpha components. The specified transparent index represents a pixel that is considered entirely transparent regardless of any alpha value specified for it. The array must have enough values in it to fill all of the needed component arrays of the specified size. The ColorSpace is the default sRGB space. The transparency value may be any of Transparency.OPAQUE, Transparency.BITMASK, or Transparency.TRANSLUCENT depending on the arguments, as specified in the class description above. The transfer type is the smallest of DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT that can hold a single pixel.
Parameters:
  bits - the number of bits each pixel occupies
Parameters:
  size - the size of the color component arrays
Parameters:
  cmap - the array of color components
Parameters:
  start - the starting offset of the first color component
Parameters:
  hasalpha - indicates whether alpha values are contained inthe cmap array
Parameters:
  trans - the index of the fully transparent pixel
throws:
  IllegalArgumentException - if bits is less than1 or greater than 16
throws:
  IllegalArgumentException - if size is less than1




Method Detail
finalize
public void finalize()(Code)
Disposes of system resources associated with this ColorModel once this ColorModel is no longer referenced.



getAlpha
final public int getAlpha(int pixel)(Code)
Returns the alpha component for the specified pixel, scaled from 0 to 255. The pixel value is specified as an int.
Parameters:
  pixel - the specified pixel the value of the alpha component for the specified pixel



getAlphas
final public void getAlphas(byte a)(Code)
Copies the array of alpha transparency components into the specified array. Only the initial entries of the array as specified by getMapSize are written.
Parameters:
  a - the specified array into which the elements of the array of alpha components are copied



getBlue
final public int getBlue(int pixel)(Code)
Returns the blue color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. The pixel value is specified as an int. The returned value is a non pre-multiplied value.
Parameters:
  pixel - the specified pixel the value of the blue color component for the specified pixel



getBlues
final public void getBlues(byte b)(Code)
Copies the array of blue color components into the specified array. Only the initial entries of the array as specified by getMapSize are written.
Parameters:
  b - the specified array into which the elements of the array of blue color components are copied



getGreen
final public int getGreen(int pixel)(Code)
Returns the green color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. The pixel value is specified as an int. The returned value is a non pre-multiplied value.
Parameters:
  pixel - the specified pixel the value of the green color component for the specified pixel



getGreens
final public void getGreens(byte g)(Code)
Copies the array of green color components into the specified array. Only the initial entries of the array as specified by getMapSize are written.
Parameters:
  g - the specified array into which the elements of the array of green color components are copied



getMapSize
final public int getMapSize()(Code)
Returns the size of the color/alpha component arrays in this IndexColorModel. the size of the color and alpha component arrays.



getRGB
final public int getRGB(int pixel)(Code)
Returns the color/alpha components of the pixel in the default RGB color model format. The pixel value is specified as an int. The returned value is in a non pre-multiplied format.
Parameters:
  pixel - the specified pixel the color and alpha components of the specified pixel
See Also:   ColorModel.getRGBdefault



getRed
final public int getRed(int pixel)(Code)
Returns the red color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. The pixel value is specified as an int. The returned value is a non pre-multiplied value.
Parameters:
  pixel - the specified pixel the value of the red color component for the specified pixel



getReds
final public void getReds(byte r)(Code)
Copies the array of red color components into the specified array. Only the initial entries of the array as specified by IndexColorModel.getMapSize() getMapSize are written.
Parameters:
  r - the specified array into which the elements of the array of red color components are copied



getTransparentPixel
final public int getTransparentPixel()(Code)
Returns the index of the transparent pixel in this IndexColorModel or -1 if there is no transparent pixel. the index of this IndexColorModel object'stransparent pixel, or -1 if there is no such pixel.



toString
public String toString()(Code)
Returns the String representation of the contents of this ColorModelobject. a String representing the contents of thisColorModel object.



Fields inherited from java.awt.image.ColorModel
ColorSpace colorSpace(Code)(Java Doc)
boolean isAlphaPremultiplied(Code)(Java Doc)
int nBits(Code)(Java Doc)
int numColorComponents(Code)(Java Doc)
int numComponents(Code)(Java Doc)
protected int pixel_bits(Code)(Java Doc)
boolean supportsAlpha(Code)(Java Doc)
int transparency(Code)(Java Doc)

Methods inherited from java.awt.image.ColorModel
public boolean equals(Object obj)(Code)(Java Doc)
public void finalize()(Code)(Java Doc)
abstract public int getAlpha(int pixel)(Code)(Java Doc)
abstract public int getBlue(int pixel)(Code)(Java Doc)
final public ColorSpace getColorSpace()(Code)(Java Doc)
public int getComponentSize(int componentIdx)(Code)(Java Doc)
public int[] getComponentSize()(Code)(Java Doc)
final static int getDefaultTransferType(int pixel_bits)(Code)(Java Doc)
abstract public int getGreen(int pixel)(Code)(Java Doc)
public int getNumColorComponents()(Code)(Java Doc)
public int getNumComponents()(Code)(Java Doc)
public int getPixelSize()(Code)(Java Doc)
public int getRGB(int pixel)(Code)(Java Doc)
public static ColorModel getRGBdefault()(Code)(Java Doc)
abstract public int getRed(int pixel)(Code)(Java Doc)
final public int getTransferType()(Code)(Java Doc)
public int getTransparency()(Code)(Java Doc)
final public boolean hasAlpha()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public boolean isAlphaPremultiplied()(Code)(Java Doc)
public String toString()(Code)(Java Doc)

Methods inherited from java.lang.Object
public boolean equals(Object obj)(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.