Package org.geotools.image.util
Class ComponentColorModelJAI
- Object
-
- ColorModel
-
- ComponentColorModel
-
- ComponentColorModelJAI
-
- All Implemented Interfaces:
Transparency
public class ComponentColorModelJAI extends ComponentColorModel
AComponentColorModel
modified for interoperability with Java Advanced Imaging. JAI 1.1 was designed for use with J2SE 1.3 and is not aware of new features in J2SE 1.4. This leads to the following problems:ComponentColorModel
supportsfloat
anddouble
datatypes since J2SE 1.4 only. The workaround for J2SE 1.3 is to use theFloatDoubleColorModel
provided with JAI 1.1.FloatDoubleColorModel
ignores the new API inColorSpace
, especially thegetMinValue
andgetMaxValue
methods. Consequently, rendering of any image using our customScaledColorSpace
is wrong.ComponentColorModel
usesDataBufferFloat
andDataBufferDouble
, which are unknown to JAI 1.1. Consequently, trying to useRectIter
with one of those will throwClassCastException
.
ComponentColorModel
(which work with our customColorSpace
) and override itscreateCompatibleSampleModel
in order to returnsComponentSampleModelJAI
instead ofComponentSampleModel
whenfloat
ordouble
datatype is requested.- Since:
- 2.0
- Author:
- Martin Desruisseaux (IRD)
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
ENABLED
Whatever usage of this class should be enabled or not.-
Fields inherited from class ColorModel
pixel_bits, transferType
-
Fields inherited from interface Transparency
BITMASK, OPAQUE, TRANSLUCENT
-
-
Constructor Summary
Constructors Constructor Description ComponentColorModelJAI(ColorSpace colorSpace, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType)
Construct a new color model.ComponentColorModelJAI(ColorSpace colorSpace, int[] bits, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType)
Construct a new color model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SampleModel
createCompatibleSampleModel(int w, int h)
Returns a compatible sample model.String
toString()
Returns theString
representation of the contents of thisColorModel
object.-
Methods inherited from class ComponentColorModel
coerceData, createCompatibleWritableRaster, equals, getAlpha, getAlpha, getAlphaRaster, getBlue, getBlue, getComponents, getComponents, getDataElement, getDataElement, getDataElements, getDataElements, getDataElements, getGreen, getGreen, getNormalizedComponents, getNormalizedComponents, getRed, getRed, getRGB, getRGB, getUnnormalizedComponents, hashCode, isCompatibleRaster, isCompatibleSampleModel
-
Methods inherited from class ColorModel
finalize, getColorSpace, getComponentSize, getComponentSize, getNumColorComponents, getNumComponents, getPixelSize, getRGBdefault, getTransferType, getTransparency, hasAlpha, isAlphaPremultiplied
-
-
-
-
Field Detail
-
ENABLED
public static final boolean ENABLED
Whatever usage of this class should be enabled or not.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ComponentColorModelJAI
public ComponentColorModelJAI(ColorSpace colorSpace, int[] bits, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType)
Construct a new color model.
-
ComponentColorModelJAI
public ComponentColorModelJAI(ColorSpace colorSpace, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType)
Construct a new color model.
-
-
Method Detail
-
createCompatibleSampleModel
public SampleModel createCompatibleSampleModel(int w, int h)
Returns a compatible sample model. This implementation is nearly identical to default J2SE's implementation, except that it construct a JAI color model instead of a J2SE one.- Overrides:
createCompatibleSampleModel
in classComponentColorModel
-
toString
public String toString()
Returns theString
representation of the contents of thisColorModel
object.- Overrides:
toString
in classColorModel
- Returns:
- a
String
representing the contents of thisColorModel
object.
-
-