2 using System.Collections.Generic;
5 using DirectOutput.Cab.Out;
6 using DirectOutput.General;
7 using System.Xml.Serialization;
8 using DirectOutput.General.Analog;
10 namespace DirectOutput.Cab.Toys.Layer
25 public LayerDictionary<AnalogAlpha> Layers {
get;
private set; }
31 protected int GetResultingValue()
37 foreach (KeyValuePair<int, AnalogAlpha> KV
in Layers)
39 int Alpha = KV.Value.Alpha;
42 Value = AlphaMappingTable.AlphaMapping[255 - Alpha, (int)Value] + AlphaMappingTable.AlphaMapping[Alpha, KV.Value.Value];
67 public string OutputName {
get;
set; }
73 private string _FadingCurveName =
"Linear";
75 protected Curve FadingCurve = null;
84 public string FadingCurveName
86 get {
return _FadingCurveName; }
87 set { _FadingCurveName = value; }
92 if (Cabinet.
Curves.Contains(FadingCurveName))
94 FadingCurve = Cabinet.
Curves[FadingCurveName];
96 else if (!FadingCurveName.IsNullOrWhiteSpace())
101 Enum.TryParse(FadingCurveName, out T);
102 FadingCurve =
new Curve(T);
107 Cabinet.
Curves.Add(FadingCurveName);
128 public override void Init(Cabinet Cabinet)
130 this.Cabinet = Cabinet;
131 InitOutputs(Cabinet);
132 InitFadingCurve(Cabinet);
135 private void InitOutputs(Cabinet Cabinet)
153 public override void UpdateOutputs()
158 Output.
Value = FadingCurve.MapValue(GetResultingValue());
166 public override void Finish()
179 public override void Reset()
193 Layers =
new LayerDictionary<AnalogAlpha>();