Package com.twelvemonkeys.imageio.color
Class DiscreteAlphaIndexColorModel
- java.lang.Object
-
- java.awt.image.ColorModel
-
- com.twelvemonkeys.imageio.color.DiscreteAlphaIndexColorModel
-
- All Implemented Interfaces:
java.awt.Transparency
public final class DiscreteAlphaIndexColorModel extends java.awt.image.ColorModelThis class represents a hybrid between anIndexColorModeland aComponentColorModel, having both a color map and a full, discrete alpha channel and/or one or more "extra" channels. The color map entries are assumed to be fully opaque and should have no transparent index.ColorSpace will always be the default sRGB color space (as with
IndexColorModel).Component order is always I, A, X1, X2... Xn, where I is a palette index, A is the alpha value and Xn are extra samples (ignored for display).
- See Also:
IndexColorModel,ComponentColorModel
-
-
Field Summary
Fields Modifier and Type Field Description private intextraSamplesprivate java.awt.image.IndexColorModelicmprivate intsamples
-
Constructor Summary
Constructors Constructor Description DiscreteAlphaIndexColorModel(java.awt.image.IndexColorModel icm)Creates aDiscreteAlphaIndexColorModel, delegating color map look-ups to the givenIndexColorModel.DiscreteAlphaIndexColorModel(java.awt.image.IndexColorModel icm, int extraSamples, boolean hasAlpha)Creates aDiscreteAlphaIndexColorModel, delegating color map look-ups to the givenIndexColorModel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.SampleModelcreateCompatibleSampleModel(int w, int h)java.awt.image.WritableRastercreateCompatibleWritableRaster(int w, int h)private int[]createOffsets(int samples)booleanequals(java.lang.Object obj)intgetAlpha(int pixel)intgetAlpha(java.lang.Object inData)intgetBlue(int pixel)intgetBlue(java.lang.Object inData)intgetGreen(int pixel)intgetGreen(java.lang.Object inData)intgetNumComponents()intgetRed(int pixel)intgetRed(java.lang.Object inData)private intgetSample(java.lang.Object inData, int index)booleanisCompatibleRaster(java.awt.image.Raster raster)booleanisCompatibleSampleModel(java.awt.image.SampleModel sm)java.lang.StringtoString()-
Methods inherited from class java.awt.image.ColorModel
coerceData, finalize, getAlphaRaster, getColorSpace, getComponents, getComponents, getComponentSize, getComponentSize, getDataElement, getDataElement, getDataElements, getDataElements, getDataElements, getNormalizedComponents, getNormalizedComponents, getNumColorComponents, getPixelSize, getRGB, getRGB, getRGBdefault, getTransferType, getTransparency, getUnnormalizedComponents, hasAlpha, hashCode, isAlphaPremultiplied
-
-
-
-
Constructor Detail
-
DiscreteAlphaIndexColorModel
public DiscreteAlphaIndexColorModel(java.awt.image.IndexColorModel icm)
Creates aDiscreteAlphaIndexColorModel, delegating color map look-ups to the givenIndexColorModel.- Parameters:
icm- TheIndexColorModeldelegate. Color map entries are assumed to be fully opaque, any transparency or transparent index will be ignored.
-
DiscreteAlphaIndexColorModel
public DiscreteAlphaIndexColorModel(java.awt.image.IndexColorModel icm, int extraSamples, boolean hasAlpha)Creates aDiscreteAlphaIndexColorModel, delegating color map look-ups to the givenIndexColorModel.- Parameters:
icm- TheIndexColorModeldelegate. Color map entries are assumed to be fully opaque, any transparency or transparent index will be ignored.extraSamples- the number of extra samples in the color model.hasAlpha-trueif the extra samples contains alpha, otherwisefalse.
-
-
Method Detail
-
getNumComponents
public int getNumComponents()
- Overrides:
getNumComponentsin classjava.awt.image.ColorModel
-
getRed
public int getRed(int pixel)
- Specified by:
getRedin classjava.awt.image.ColorModel
-
getGreen
public int getGreen(int pixel)
- Specified by:
getGreenin classjava.awt.image.ColorModel
-
getBlue
public int getBlue(int pixel)
- Specified by:
getBluein classjava.awt.image.ColorModel
-
getAlpha
public int getAlpha(int pixel)
- Specified by:
getAlphain classjava.awt.image.ColorModel
-
getSample
private int getSample(java.lang.Object inData, int index)
-
getRed
public int getRed(java.lang.Object inData)
- Overrides:
getRedin classjava.awt.image.ColorModel
-
getGreen
public int getGreen(java.lang.Object inData)
- Overrides:
getGreenin classjava.awt.image.ColorModel
-
getBlue
public int getBlue(java.lang.Object inData)
- Overrides:
getBluein classjava.awt.image.ColorModel
-
getAlpha
public int getAlpha(java.lang.Object inData)
- Overrides:
getAlphain classjava.awt.image.ColorModel
-
createCompatibleSampleModel
public java.awt.image.SampleModel createCompatibleSampleModel(int w, int h)- Overrides:
createCompatibleSampleModelin classjava.awt.image.ColorModel
-
createOffsets
private int[] createOffsets(int samples)
-
isCompatibleSampleModel
public boolean isCompatibleSampleModel(java.awt.image.SampleModel sm)
- Overrides:
isCompatibleSampleModelin classjava.awt.image.ColorModel
-
createCompatibleWritableRaster
public java.awt.image.WritableRaster createCompatibleWritableRaster(int w, int h)- Overrides:
createCompatibleWritableRasterin classjava.awt.image.ColorModel
-
isCompatibleRaster
public boolean isCompatibleRaster(java.awt.image.Raster raster)
- Overrides:
isCompatibleRasterin classjava.awt.image.ColorModel
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.awt.image.ColorModel
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.awt.image.ColorModel
-
-