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
RGBAMatrixShiftEffect.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.Color;
6 using DirectOutput.Cab.Toys.Layer;
7 
8 namespace DirectOutput.FX.MatrixFX
9 {
10  public class RGBAMatrixShiftEffect : MatrixShiftEffectBase<RGBAColor>
11  {
12  private const int RefreshIntervalMs = 30;
13 
14  private RGBAColor _ActiveColor = new RGBAColor(0xff, 0xff, 0xff, 0xff);
15 
23  public RGBAColor ActiveColor
24  {
25  get { return _ActiveColor; }
26  set { _ActiveColor = value; }
27  }
28 
29  private RGBAColor _InactiveColor = new RGBAColor(0, 0, 0, 0);
30 
38  public RGBAColor InactiveColor
39  {
40  get { return _InactiveColor; }
41  set { _InactiveColor = value; }
42  }
43 
44 
45 
51  protected override RGBAColor GetEffectValue(int TriggerValue)
52  {
53  RGBAColor D = new RGBAColor();
54 
55  int V = TriggerValue.Limit(0, 255);
56  D.Red = InactiveColor.Red + (int)((float)(ActiveColor.Red - InactiveColor.Red) * V / 255).Limit(0, 255);
57  D.Green = InactiveColor.Green + (int)((float)(ActiveColor.Green - InactiveColor.Green) * V / 255).Limit(0, 255);
58  D.Blue = InactiveColor.Blue + (int)((float)(ActiveColor.Blue - InactiveColor.Blue) * V / 255).Limit(0, 255);
59  D.Alpha = InactiveColor.Alpha + (int)((float)(ActiveColor.Alpha - InactiveColor.Alpha) * V / 255).Limit(0, 255);
60  return D;
61  }
62 
63 
64  }
65 }