Class ComponentColorModelJAI

Object
ColorModel
ComponentColorModel
ComponentColorModelJAI
All Implemented Interfaces:
Transparency

public class ComponentColorModelJAI extends ComponentColorModel
A ComponentColorModel 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 supports float and double datatypes since J2SE 1.4 only. The workaround for J2SE 1.3 is to use the FloatDoubleColorModel provided with JAI 1.1.
  • FloatDoubleColorModel ignores the new API in ColorSpace, especially the getMinValue and getMaxValue methods. Consequently, rendering of any image using our custom ScaledColorSpace is wrong.
  • ComponentColorModel uses DataBufferFloat and DataBufferDouble, which are unknown to JAI 1.1. Consequently, trying to use RectIter with one of those will throw ClassCastException.
The work around is to use J2SE's ComponentColorModel (which work with our custom ColorSpace) and override its createCompatibleSampleModel in order to returns ComponentSampleModelJAI instead of ComponentSampleModel when float or double datatype is requested.
Since:
2.0
Author:
Martin Desruisseaux (IRD)
  • Field Details

    • ENABLED

      public static final boolean ENABLED
      Whatever usage of this class should be enabled or not.
      See Also:
  • Constructor Details

    • 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 Details

    • 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 class ComponentColorModel
    • toString

      public String toString()
      Returns the String representation of the contents of this ColorModelobject.
      Overrides:
      toString in class ColorModel
      Returns:
      a String representing the contents of this ColorModel object.