Example #1
0
        public XYZColor ToXYZ(LChabColor color)
        {
            if (color == null)
            {
                throw new ArgumentNullException("color");
            }

            // conversion to Lab
            var      labConverter = new LChabToLabConverter();
            LabColor labColor     = labConverter.Convert(color);

            // conversion to XYZ (incl. adaptation)
            XYZColor result = ToXYZ(labColor);

            return(result);
        }
        public LabColor ToLab(LChabColor color)
        {
            if (color == null)
            {
                throw new ArgumentNullException("color");
            }

            // conversion (perserving white point)
            var      converter = new LChabToLabConverter();
            LabColor unadapted = converter.Convert(color);

            if (!IsChromaticAdaptationPerformed)
            {
                return(unadapted);
            }

            // adaptation to target lab white point (LabWhitePoint)
            LabColor adapted = Adapt(unadapted);

            return(adapted);
        }