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
AnalogAlphaMatrixFlickerEffect.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.General.Analog;
6 using DirectOutput.Cab.Toys.Layer;
7 
8 namespace DirectOutput.FX.MatrixFX
9 {
13  public class AnalogAlphaMatrixFlickerEffect : MatrixFlickerEffectBase<AnalogAlpha>
14  {
15  private const int RefreshIntervalMs = 30;
16 
17  private AnalogAlpha _ActiveValue = new AnalogAlpha(0xff, 0xff);
18 
26  public AnalogAlpha ActiveValue
27  {
28  get { return _ActiveValue; }
29  set { _ActiveValue = value; }
30  }
31 
32  private AnalogAlpha _InactiveValue = new AnalogAlpha(0, 0);
33 
41  public AnalogAlpha InactiveValue
42  {
43  get { return _InactiveValue; }
44  set { _InactiveValue = value; }
45  }
46 
47 
53  protected override AnalogAlpha GetEffectValue(int TriggerValue)
54  {
55  AnalogAlpha D = new AnalogAlpha();
56 
57  int V = TriggerValue.Limit(0, 255);
58  D.Value = InactiveValue.Value + (int)((float)(ActiveValue.Value - InactiveValue.Value) * V / 255).Limit(0, 255);
59  D.Alpha = InactiveValue.Alpha + (int)((float)(ActiveValue.Alpha - InactiveValue.Alpha) * V / 255).Limit(0, 255);
60  return D;
61  }
62 
63  }
64 }