DirectOuput Framework R2
DirectOutput framework R2 for virtual pinball cabinets
Go to:
Overview 
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros Pages
AnalogAlphaMatrixShiftEffect.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using DirectOutput.Cab.Toys.Layer;
6 using DirectOutput.General.Analog;
7 
8 namespace DirectOutput.FX.MatrixFX
9 {
10  public class AnalogAlphaMatrixShiftEffect : MatrixShiftEffectBase<AnalogAlpha>
11  {
12  private const int RefreshIntervalMs = 30;
13 
14  private AnalogAlpha _ActiveValue = new AnalogAlpha(0xff, 0xff);
15 
23  public AnalogAlpha ActiveValue
24  {
25  get { return _ActiveValue; }
26  set { _ActiveValue = value; }
27  }
28 
29  private AnalogAlpha _InactiveValue = new AnalogAlpha(0, 0);
30 
38  public AnalogAlpha InactiveValue
39  {
40  get { return _InactiveValue; }
41  set { _InactiveValue = value; }
42  }
43 
44 
45 
51  protected override AnalogAlpha GetEffectValue(int TriggerValue)
52  {
53  AnalogAlpha D = new AnalogAlpha();
54 
55  int V = TriggerValue.Limit(0, 255);
56  D.Value = InactiveValue.Value + (int)((float)(ActiveValue.Value - InactiveValue.Value) * V / 255).Limit(0, 255);
57  D.Alpha = InactiveValue.Alpha + (int)((float)(ActiveValue.Alpha - InactiveValue.Alpha) * V / 255).Limit(0, 255);
58  return D;
59  }
60 
61 
62  }
63 }