Class DiscreteAlphaIndexColorModel

  • All Implemented Interfaces:
    java.awt.Transparency

    public final class DiscreteAlphaIndexColorModel
    extends java.awt.image.ColorModel
    This class represents a hybrid between an IndexColorModel and a ComponentColorModel, 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 int extraSamples  
      private java.awt.image.IndexColorModel icm  
      private int samples  
      • Fields inherited from class java.awt.image.ColorModel

        pixel_bits, transferType
      • Fields inherited from interface java.awt.Transparency

        BITMASK, OPAQUE, TRANSLUCENT
    • Constructor Summary

      Constructors 
      Constructor Description
      DiscreteAlphaIndexColorModel​(java.awt.image.IndexColorModel icm)
      Creates a DiscreteAlphaIndexColorModel, delegating color map look-ups to the given IndexColorModel.
      DiscreteAlphaIndexColorModel​(java.awt.image.IndexColorModel icm, int extraSamples, boolean hasAlpha)
      Creates a DiscreteAlphaIndexColorModel, delegating color map look-ups to the given IndexColorModel.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.image.SampleModel createCompatibleSampleModel​(int w, int h)  
      java.awt.image.WritableRaster createCompatibleWritableRaster​(int w, int h)  
      private int[] createOffsets​(int samples)  
      boolean equals​(java.lang.Object obj)  
      int getAlpha​(int pixel)  
      int getAlpha​(java.lang.Object inData)  
      int getBlue​(int pixel)  
      int getBlue​(java.lang.Object inData)  
      int getGreen​(int pixel)  
      int getGreen​(java.lang.Object inData)  
      int getNumComponents()  
      int getRed​(int pixel)  
      int getRed​(java.lang.Object inData)  
      private int getSample​(java.lang.Object inData, int index)  
      boolean isCompatibleRaster​(java.awt.image.Raster raster)  
      boolean isCompatibleSampleModel​(java.awt.image.SampleModel sm)  
      java.lang.String toString()  
      • 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
      • Methods inherited from class java.lang.Object

        clone, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • icm

        private final java.awt.image.IndexColorModel icm
      • extraSamples

        private final int extraSamples
      • samples

        private final int samples
    • Constructor Detail

      • DiscreteAlphaIndexColorModel

        public DiscreteAlphaIndexColorModel​(java.awt.image.IndexColorModel icm)
        Creates a DiscreteAlphaIndexColorModel, delegating color map look-ups to the given IndexColorModel.
        Parameters:
        icm - The IndexColorModel delegate. 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 a DiscreteAlphaIndexColorModel, delegating color map look-ups to the given IndexColorModel.
        Parameters:
        icm - The IndexColorModel delegate. 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 - true if the extra samples contains alpha, otherwise false.
    • Method Detail

      • getNumComponents

        public int getNumComponents()
        Overrides:
        getNumComponents in class java.awt.image.ColorModel
      • getRed

        public int getRed​(int pixel)
        Specified by:
        getRed in class java.awt.image.ColorModel
      • getGreen

        public int getGreen​(int pixel)
        Specified by:
        getGreen in class java.awt.image.ColorModel
      • getBlue

        public int getBlue​(int pixel)
        Specified by:
        getBlue in class java.awt.image.ColorModel
      • getAlpha

        public int getAlpha​(int pixel)
        Specified by:
        getAlpha in class java.awt.image.ColorModel
      • getSample

        private int getSample​(java.lang.Object inData,
                              int index)
      • getRed

        public int getRed​(java.lang.Object inData)
        Overrides:
        getRed in class java.awt.image.ColorModel
      • getGreen

        public int getGreen​(java.lang.Object inData)
        Overrides:
        getGreen in class java.awt.image.ColorModel
      • getBlue

        public int getBlue​(java.lang.Object inData)
        Overrides:
        getBlue in class java.awt.image.ColorModel
      • getAlpha

        public int getAlpha​(java.lang.Object inData)
        Overrides:
        getAlpha in class java.awt.image.ColorModel
      • createCompatibleSampleModel

        public java.awt.image.SampleModel createCompatibleSampleModel​(int w,
                                                                      int h)
        Overrides:
        createCompatibleSampleModel in class java.awt.image.ColorModel
      • createOffsets

        private int[] createOffsets​(int samples)
      • isCompatibleSampleModel

        public boolean isCompatibleSampleModel​(java.awt.image.SampleModel sm)
        Overrides:
        isCompatibleSampleModel in class java.awt.image.ColorModel
      • createCompatibleWritableRaster

        public java.awt.image.WritableRaster createCompatibleWritableRaster​(int w,
                                                                            int h)
        Overrides:
        createCompatibleWritableRaster in class java.awt.image.ColorModel
      • isCompatibleRaster

        public boolean isCompatibleRaster​(java.awt.image.Raster raster)
        Overrides:
        isCompatibleRaster in class java.awt.image.ColorModel
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.awt.image.ColorModel
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.awt.image.ColorModel