This decodes maps which are defined in the e-sRGB colorspace into the sRGB colorspace.
Inheritance: ColorSpaceMapper
Esempio n. 1
0
        /// <summary> Factory method for creating instances of this class.</summary>
        /// <param name="src">-- source of image data
        /// </param>
        /// <param name="csMap">-- provides colorspace info
        /// </param>
        /// <returns> ColorSpaceMapper instance
        /// </returns>
        /// <exception cref="IOException">profile access exception
        /// </exception>
        public static BlkImgDataSrc createInstance(BlkImgDataSrc src, ColorSpace csMap)
        {
            // Check parameters
            csMap.pl.checkList(OPT_PREFIX, CSJ2K.j2k.util.ParameterList.toNameArray(pinfo));

            // Perform ICCProfiling or ColorSpace tranfsormation.
            if (csMap.Method == ColorSpace.MethodEnum.ICC_PROFILED)
            {
                return(ICCProfiler.createInstance(src, csMap));
            }
            else
            {
                ColorSpace.CSEnum colorspace = csMap.getColorSpace();

                if (colorspace == ColorSpace.CSEnum.sRGB)
                {
                    return(EnumeratedColorSpaceMapper.createInstance(src, csMap));
                }
                else if (colorspace == ColorSpace.CSEnum.GreyScale)
                {
                    return(EnumeratedColorSpaceMapper.createInstance(src, csMap));
                }
                else if (colorspace == ColorSpace.CSEnum.sYCC)
                {
                    return(SYccColorSpaceMapper.createInstance(src, csMap));
                }
                if (colorspace == ColorSpace.CSEnum.esRGB)
                {
                    return(EsRgbColorSpaceMapper.createInstance(src, csMap));
                }
                else if (colorspace == ColorSpace.CSEnum.Unknown)
                {
                    return(null);
                }
                else
                {
                    throw new ColorSpaceException("Bad color space specification in image");
                }
            }
        }