WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
RGBAColorEffect.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
6 
7 namespace DirectOutput.FX.RGBAFX
8 {
15  {
16 
17  private RGBAColor _ActiveColor = new RGBAColor(0xff, 0xff, 0xff, 0xff);
18 
26  public RGBAColor ActiveColor
27  {
28  get { return _ActiveColor; }
29  set { _ActiveColor = value; }
30  }
31 
32  private RGBAColor _InactiveColor = new RGBAColor(0, 0, 0, 0);
33 
41  public RGBAColor InactiveColor
42  {
43  get { return _InactiveColor; }
44  set { _InactiveColor = value; }
45  }
46 
47 
48  private FadeModeEnum _FadeMode = FadeModeEnum.Fade;
49 
56  public FadeModeEnum FadeMode
57  {
58  get { return _FadeMode; }
59  set { _FadeMode = value; }
60  }
61 
62 
67  public override void Trigger(Table.TableElementData TableElementData)
68  {
69  if (Layer != null)
70  {
71  int FadeValue = TableElementData.Value;
72  if (FadeMode == FadeModeEnum.OnOff && FadeValue > 0) { FadeValue = 255; }
73 
74  Layer.Red = InactiveColor.Red + (int)((float)(ActiveColor.Red - InactiveColor.Red) * FadeValue / 255).Limit(0, 255);
75  Layer.Green = InactiveColor.Green + (int)((float)(ActiveColor.Green - InactiveColor.Green) * FadeValue / 255).Limit(0, 255);
76  Layer.Blue = InactiveColor.Blue + (int)((float)(ActiveColor.Blue - InactiveColor.Blue) * FadeValue / 255).Limit(0, 255);
77  Layer.Alpha = InactiveColor.Alpha + (int)((float)(ActiveColor.Alpha - InactiveColor.Alpha) * FadeValue / 255).Limit(0, 255);
78 
79  }
80  }
81 
82 
88  public override void Init(Table.Table Table)
89  {
90  base.Init(Table);
91  }
92 
96  public override void Finish()
97  {
98  base.Finish();
99  }
100 
101  }
102 }
override void Trigger(Table.TableElementData TableElementData)
Triggers the effect with the given TableElementData.
This class stores information on colors used for toys and effects (e.g. RGBLed).
Definition: RGBAColor.cs:14
The effects sets the color of a RGBAToy based on the trigger value.
Base class for effects using RGBA toys
FadeModeEnum
Defines the fading behaviour.
Definition: FadeModeEnum.cs:11
override void Finish()
Finishes the effect.
The namespace DirectOutput.General contains classes for general use.
override void Init(Table.Table Table)
Initializes the effect. Resolves the name of the RGBA toy.