public object ConvertBack(object value, Type targetType, object parameter, string language) { double currentValue = System.Convert.ToDouble(value); Debug.WriteLine(currentArray[0]); Debug.WriteLine(currentArray[1]); Debug.WriteLine(currentArray[2]); ColorConverters.RGBToHSL(currentArray[0], currentArray[1], currentArray[2], out double _h, out double _s, out double _l); switch (System.Convert.ToChar(parameter)) { case 'H': _h = currentValue; break; case 'S': _s = currentValue; break; case 'L': _l = currentValue; break; } Debug.WriteLine("val " + parameter); Debug.WriteLine("H " + _h); Debug.WriteLine("S " + _s); Debug.WriteLine("L " + _l); Color color = ColorConverters.HSLToRGB(_h, _s, _l); return(new int[] { color.R, color.G, color.B }); }
public object Convert(object value, Type targetType, object parameter, string language) { currentArray = (int[])value; ColorConverters.RGBToHSL(currentArray[0], currentArray[1], currentArray[2], out double _h, out double _s, out double _l); // currentHSL = new double[] { _h, _s, _l }; switch (System.Convert.ToChar(parameter)) { case 'H': //h *= 360.0f; // _h = Math.Round(_h, 0); return(_h); case 'S': // _s = Math.Round(_s, 2); return(_s); case 'L': // _l = Math.Round(_l, 2); return(_l); default: return(0); } }