Esempio n. 1
0
        protected override void UpdateProperty(float requestValue, BindableValue <SKColor> prop)
        {
            prop.Value.ToHsv(out float h, out float s, out float v);
            var a = prop.Value.Alpha;
            var r = prop.Value.Red;
            var g = prop.Value.Green;
            var b = prop.Value.Blue;

            switch (PropType)
            {
            case ColorProperty.Hue:
            {
                var newVal = requestValue * 360;
                prop.RequestExplicitChange(SKColor.FromHsv(newVal, s, v, a));
                break;
            }

            case ColorProperty.Saturation:
            {
                prop.RequestExplicitChange(SKColor.FromHsv(h, requestValue, v, a));
                break;
            }

            case ColorProperty.Value:
            {
                prop.RequestExplicitChange(SKColor.FromHsv(h, s, requestValue, a));
                break;
            }

            case ColorProperty.Alpha:

            {
                var ret = GetForRgb(requestValue);
                prop.RequestExplicitChange(SKColor.FromHsv(h, s, v, ret));
                break;
            }

            case ColorProperty.Red:
            {
                var ret = GetForRgb(requestValue);
                prop.RequestExplicitChange(new SKColor(ret, g, b, a));
                break;
            }

            case ColorProperty.Green:
            {
                var ret = GetForRgb(requestValue);
                prop.RequestExplicitChange(new SKColor(r, ret, b, a));
                break;
            }

            case ColorProperty.Blue:
            {
                var ret = GetForRgb(requestValue);
                prop.RequestExplicitChange(new SKColor(r, g, ret, a));
                break;
            }

            default: { break; }
            }
        }