Esempio n. 1
0
        public static Color GetOpaqueRGBMaxColorForIntents(IIntentStates states)
        {
            byte R = 0;
            byte G = 0;
            byte B = 0;

            foreach (IIntentState intentState in states.AsList())
            {
                if (intentState is IIntentState <LightingValue> state)
                {
                    var lv = state.GetValue();
                    if (lv.Intensity > 0)
                    {
                        Color intentColor = lv.FullColor;
                        R = Math.Max(R, intentColor.R);
                        G = Math.Max(G, intentColor.G);
                        B = Math.Max(B, intentColor.B);
                    }
                }
                else if (intentState is IIntentState <RGBValue> rgbState)
                {
                    var rv = rgbState.GetValue();
                    R = Math.Max(R, rv.R);
                    G = Math.Max(G, rv.G);
                    B = Math.Max(B, rv.B);
                }
            }

            return(Color.FromArgb(R, G, B));
        }
Esempio n. 2
0
        public List<Color> GetAlphaAffectedColor(IIntentStates states)
        {
            _colorMap.Clear();
            _colors.Clear();
            foreach (var intentState in states.AsList())
            {
                intentState.Dispatch(this);
            }
            foreach (var d in _colorMap)
            {
                var c = d.Key;
                _colors.Add(Color.FromArgb((byte)(d.Value * 255), c.R, c.G, c.B));
            }

            return _colors;
        }
Esempio n. 3
0
        public List <Color> GetAlphaAffectedColor(IIntentStates states)
        {
            _colorMap.Clear();
            _colors.Clear();
            foreach (var intentState in states.AsList())
            {
                intentState.Dispatch(this);
            }
            foreach (var d in _colorMap)
            {
                var c = d.Key;
                _colors.Add(Color.FromArgb((byte)(d.Value * 255), c.R, c.G, c.B));
            }

            return(_colors);
        }
Esempio n. 4
0
 private List <IIntentState> GetCombinedState(IIntentStates states)
 {
     return(_stateCombinator.Combine(states.AsList()));
 }