aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.BL/Entities/Rml.cs
blob: f79fb6c5b94d6ef8881fa697c3261c3e65b5a71a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using ColorMine.ColorSpaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace Tango.BL.Entities
{
    public partial class Rml : RmlBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Rml" /> class.
        /// </summary>
        public Rml() : base()
        {

        }

        protected override void OnWhitePointLChanged(double whitepointl)
        {
            base.OnWhitePointLChanged(whitepointl);
            UpdateColor();
        }

        protected override void OnWhitePointAChanged(double whitepointa)
        {
            base.OnWhitePointAChanged(whitepointa);
            UpdateColor();
        }

        protected override void OnWhitePointBChanged(double whitepointb)
        {
            base.OnWhitePointBChanged(whitepointb);
            UpdateColor();
        }

        private void UpdateColor()
        {
            RaisePropertyChanged(nameof(Color));
        }

        public Color Color
        {
            get
            {
                Lab lab = new Lab(WhitePointA, WhitePointA, WhitePointB);
                Rgb rgb = lab.To<Rgb>();
                return Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B);
            }
        }
    }
}