Java Doc for PackedColorModel.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.ColorModel
      java.awt.image.PackedColorModel

All known Subclasses:   java.awt.image.DirectColorModel,
PackedColorModel
abstract public class PackedColorModel extends ColorModel (Code)
The PackedColorModel class is an abstract ColorModel class that works with pixel values which represent color and alpha information as separate samples and which pack all samples for a single pixel into a single int, short, or byte quantity. This class can be used with an arbitrary ColorSpace . The number of color samples in the pixel values must be the same as the number of color components in the ColorSpace. There can be a single alpha sample. The array length is always 1 for those methods that use a primitive array pixel representation of type transferType. The transfer types supported are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, and DataBuffer.TYPE_INT. Color and alpha samples are stored in the single element of the array in bits indicated by bit masks. Each bit mask must be contiguous and masks must not overlap. The same masks apply to the single int pixel representation used by other methods. The correspondence of masks and color/alpha samples is as follows:
  • Masks are identified by indices running from 0 through ColorModel.getNumComponents getNumComponents  - 1.
  • The first ColorModel.getNumColorComponents getNumColorComponents indices refer to color samples.
  • If an alpha sample is present, it corresponds the last index.
  • The order of the color indices is specified by the ColorSpace. Typically, this reflects the name of the color space type (for example, TYPE_RGB), index 0 corresponds to red, index 1 to green, and index 2 to blue.

The translation from pixel values to color/alpha components for display or processing purposes is a one-to-one correspondence of samples to components. A PackedColorModel is typically used with image data that uses masks to define packed samples. For example, a PackedColorModel can be used in conjunction with a SinglePixelPackedSampleModel to construct a BufferedImage . Normally the masks used by the SampleModel and the ColorModel would be the same. However, if they are different, the color interpretation of pixel data is done according to the masks of the ColorModel.

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.

A subclass of PackedColorModel is DirectColorModel , which is similar to an X11 TrueColor visual.
See Also:   DirectColorModel
See Also:   SinglePixelPackedSampleModel
See Also:   BufferedImage
version:
   10 Feb 1997



Field Summary
 int[]maskArray
    
 int[]maskOffsets
    
 float[]scaleFactors
    

Constructor Summary
public  PackedColorModel(ColorSpace space, int bits, int[] colorMaskArray, int alphaMask, boolean isAlphaPremultiplied, int trans, int transferType)
     Constructs a PackedColorModel from a color mask array, which specifies which bits in an int pixel representation contain each of the color samples, and an alpha mask.
public  PackedColorModel(ColorSpace space, int bits, int rmask, int gmask, int bmask, int amask, boolean isAlphaPremultiplied, int trans, int transferType)
     Constructs a PackedColorModel from the specified masks which indicate which bits in an int pixel representation contain the alpha, red, green and blue color samples.

Method Summary
public  SampleModelcreateCompatibleSampleModel(int w, int h)
     Creates a SampleModel with the specified width and height that has a data layout compatible with this ColorModel.
public  booleanequals(Object obj)
     Tests if the specified Object is an instance of PackedColorModel and equals this PackedColorModel.
public  WritableRastergetAlphaRaster(WritableRaster raster)
     Returns a WritableRaster representing the alpha channel of an image, extracted from the input WritableRaster. This method assumes that WritableRaster objects associated with this ColorModel store the alpha band, if present, as the last band of image data.
final public  intgetMask(int index)
     Returns the mask indicating which bits in a pixel contain the specified color/alpha sample.
final public  int[]getMasks()
     Returns a mask array indicating which bits in a pixel contain the color and alpha samples.
public  booleanisCompatibleSampleModel(SampleModel sm)
     Checks if the specified SampleModel is compatible with this ColorModel.

Field Detail
maskArray
int[] maskArray(Code)



maskOffsets
int[] maskOffsets(Code)



scaleFactors
float[] scaleFactors(Code)




Constructor Detail
PackedColorModel
public PackedColorModel(ColorSpace space, int bits, int[] colorMaskArray, int alphaMask, boolean isAlphaPremultiplied, int trans, int transferType)(Code)
Constructs a PackedColorModel from a color mask array, which specifies which bits in an int pixel representation contain each of the color samples, and an alpha mask. Color components are in the specified ColorSpace. The length of colorMaskArray should be the number of components in the ColorSpace. All of the bits in each mask must be contiguous and fit in the specified number of least significant bits of an int pixel representation. If the alphaMask is 0, there is no alpha. If there is alpha, the boolean isAlphaPremultiplied specifies how to interpret color and alpha samples in pixel values. If the boolean is true, color samples are assumed to have been multiplied by the alpha sample. The transparency, trans, specifies what alpha values can be represented by this color model. The transfer type is the type of primitive array used to represent pixel values.
Parameters:
  space - the specified ColorSpace
Parameters:
  bits - the number of bits in the pixel values
Parameters:
  colorMaskArray - array that specifies the masks representingthe bits of the pixel values that represent the colorcomponents
Parameters:
  alphaMask - specifies the mask representingthe bits of the pixel values that represent the alphacomponent
Parameters:
  isAlphaPremultiplied - true if color samples arepremultiplied by the alpha sample; false otherwise
Parameters:
  trans - specifies the alpha value that can be represented bythis color model
Parameters:
  transferType - the type of array used to represent pixel values
throws:
  IllegalArgumentException - if bits is less than1 or greater than 32



PackedColorModel
public PackedColorModel(ColorSpace space, int bits, int rmask, int gmask, int bmask, int amask, boolean isAlphaPremultiplied, int trans, int transferType)(Code)
Constructs a PackedColorModel from the specified masks which indicate which bits in an int pixel representation contain the alpha, red, green and blue color samples. Color components are in the specified ColorSpace, which must be of type ColorSpace.TYPE_RGB. All of the bits in each mask must be contiguous and fit in the specified number of least significant bits of an int pixel representation. If amask is 0, there is no alpha. If there is alpha, the boolean isAlphaPremultiplied specifies how to interpret color and alpha samples in pixel values. If the boolean is true, color samples are assumed to have been multiplied by the alpha sample. The transparency, trans, specifies what alpha values can be represented by this color model. The transfer type is the type of primitive array used to represent pixel values.
Parameters:
  space - the specified ColorSpace
Parameters:
  bits - the number of bits in the pixel values
Parameters:
  rmask - specifies the mask representingthe bits of the pixel values that represent the redcolor component
Parameters:
  gmask - specifies the mask representingthe bits of the pixel values that represent the green color component
Parameters:
  bmask - specifies the mask representingthe bits of the pixel values that represent the blue color component
Parameters:
  amask - specifies the mask representingthe bits of the pixel values that represent the alpha component
Parameters:
  isAlphaPremultiplied - true if color samples arepremultiplied by the alpha sample; false otherwise
Parameters:
  trans - specifies the alpha value that can be represented bythis color model
Parameters:
  transferType - the type of array used to represent pixel values
throws:
  IllegalArgumentException - if space is not aTYPE_RGB space
See Also:   ColorSpace




Method Detail
createCompatibleSampleModel
public SampleModel createCompatibleSampleModel(int w, int h)(Code)
Creates a SampleModel with the specified width and height that has a data layout compatible with this ColorModel.
Parameters:
  w - the width (in pixels) of the region of the image datadescribed
Parameters:
  h - the height (in pixels) of the region of the image datadescribed the newly created SampleModel.
throws:
  IllegalArgumentException - if w orh is not greater than 0
See Also:   SampleModel



equals
public boolean equals(Object obj)(Code)
Tests if the specified Object is an instance of PackedColorModel and equals this PackedColorModel.
Parameters:
  obj - the Object to test for equality true if the specified Objectis an instance of PackedColorModel and equals thisPackedColorModel; false otherwise.



getAlphaRaster
public WritableRaster getAlphaRaster(WritableRaster raster)(Code)
Returns a WritableRaster representing the alpha channel of an image, extracted from the input WritableRaster. This method assumes that WritableRaster objects associated with this ColorModel store the alpha band, if present, as the last band of image data. Returns null if there is no separate spatial alpha channel associated with this ColorModel. This method creates a new WritableRaster, but shares the data array.
Parameters:
  raster - a WritableRaster containing an image a WritableRaster that represents the alphachannel of the image contained in raster.



getMask
final public int getMask(int index)(Code)
Returns the mask indicating which bits in a pixel contain the specified color/alpha sample. For color samples, index corresponds to the placement of color sample names in the color space. Thus, an index equal to 0 for a CMYK ColorSpace would correspond to Cyan and an index equal to 1 would correspond to Magenta. If there is alpha, the alpha index would be:
 alphaIndex = numComponents() - 1;
 

Parameters:
  index - the specified color or alpha sample the mask, which indicates which bits of the int pixel representation contain the color or alpha sample specifiedby index.
throws:
  ArrayIndexOutOfBoundsException - if index isgreater than the number of components minus 1 in this PackedColorModel or if index isless than zero



getMasks
final public int[] getMasks()(Code)
Returns a mask array indicating which bits in a pixel contain the color and alpha samples. the mask array , which indicates which bits of the int pixelrepresentation contain the color or alpha samples.



isCompatibleSampleModel
public boolean isCompatibleSampleModel(SampleModel sm)(Code)
Checks if the specified SampleModel is compatible with this ColorModel. If sm is null, this method returns false.
Parameters:
  sm - the specified SampleModel, or null true if the specified SampleModelis compatible with this ColorModel; false otherwise.
See Also:   SampleModel
See Also:   



Fields inherited from java.awt.image.ColorModel
ColorSpace colorSpace(Code)(Java Doc)
int colorSpaceType(Code)(Java Doc)
static Map g16Tos8Map(Code)(Java Doc)
static Map g8Tos8Map(Code)(Java Doc)
boolean isAlphaPremultiplied(Code)(Java Doc)
boolean is_sRGB(Code)(Java Doc)
static byte[] l16Tos8(Code)(Java Doc)
static byte[] l8Tos8(Code)(Java Doc)
static Map lg16Toog16Map(Code)(Java Doc)
static Map lg16Toog8Map(Code)(Java Doc)
int maxBits(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)
static short[] s8Tol16(Code)(Java Doc)
static byte[] s8Tol8(Code)(Java Doc)
boolean supportsAlpha(Code)(Java Doc)
protected int transferType(Code)(Java Doc)
int transparency(Code)(Java Doc)

Methods inherited from java.awt.image.ColorModel
public ColorModel coerceData(WritableRaster raster, boolean isAlphaPremultiplied)(Code)(Java Doc)
public SampleModel createCompatibleSampleModel(int w, int h)(Code)(Java Doc)
public WritableRaster createCompatibleWritableRaster(int w, int h)(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
public void finalize()(Code)(Java Doc)
abstract public int getAlpha(int pixel)(Code)(Java Doc)
public int getAlpha(Object inData)(Code)(Java Doc)
public WritableRaster getAlphaRaster(WritableRaster raster)(Code)(Java Doc)
abstract public int getBlue(int pixel)(Code)(Java Doc)
public int getBlue(Object inData)(Code)(Java Doc)
final public ColorSpace getColorSpace()(Code)(Java Doc)
public int getComponentSize(int componentIdx)(Code)(Java Doc)
public int[] getComponentSize()(Code)(Java Doc)
public int[] getComponents(int pixel, int[] components, int offset)(Code)(Java Doc)
public int[] getComponents(Object pixel, int[] components, int offset)(Code)(Java Doc)
public int getDataElement(int[] components, int offset)(Code)(Java Doc)
public int getDataElement(float[] normComponents, int normOffset)(Code)(Java Doc)
public Object getDataElements(int rgb, Object pixel)(Code)(Java Doc)
public Object getDataElements(int[] components, int offset, Object obj)(Code)(Java Doc)
public Object getDataElements(float[] normComponents, int normOffset, Object obj)(Code)(Java Doc)
static int getDefaultTransferType(int pixel_bits)(Code)(Java Doc)
static byte[] getGray16TosRGB8LUT(ICC_ColorSpace grayCS)(Code)(Java Doc)
static byte[] getGray8TosRGB8LUT(ICC_ColorSpace grayCS)(Code)(Java Doc)
abstract public int getGreen(int pixel)(Code)(Java Doc)
public int getGreen(Object inData)(Code)(Java Doc)
static short[] getLinearGray16ToOtherGray16LUT(ICC_ColorSpace grayCS)(Code)(Java Doc)
static byte[] getLinearGray16ToOtherGray8LUT(ICC_ColorSpace grayCS)(Code)(Java Doc)
static byte[] getLinearRGB16TosRGB8LUT()(Code)(Java Doc)
static byte[] getLinearRGB8TosRGB8LUT()(Code)(Java Doc)
public float[] getNormalizedComponents(int[] components, int offset, float[] normComponents, int normOffset)(Code)(Java Doc)
public float[] getNormalizedComponents(Object pixel, float[] normComponents, int normOffset)(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 int getRGB(Object inData)(Code)(Java Doc)
public static ColorModel getRGBdefault()(Code)(Java Doc)
abstract public int getRed(int pixel)(Code)(Java Doc)
public int getRed(Object inData)(Code)(Java Doc)
final public int getTransferType()(Code)(Java Doc)
public int getTransparency()(Code)(Java Doc)
public int[] getUnnormalizedComponents(float[] normComponents, int normOffset, int[] components, int offset)(Code)(Java Doc)
static short[] getsRGB8ToLinearRGB16LUT()(Code)(Java Doc)
static byte[] getsRGB8ToLinearRGB8LUT()(Code)(Java Doc)
final public boolean hasAlpha()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public boolean isAlphaPremultiplied()(Code)(Java Doc)
public boolean isCompatibleRaster(Raster raster)(Code)(Java Doc)
public boolean isCompatibleSampleModel(SampleModel sm)(Code)(Java Doc)
static boolean isLinearGRAYspace(ColorSpace cs)(Code)(Java Doc)
static boolean isLinearRGBspace(ColorSpace cs)(Code)(Java Doc)
static void loadLibraries()(Code)(Java Doc)
public String toString()(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.