2 using System.Collections.Generic;
23 [
System.Xml.Serialization.XmlIgnore]
45 foreach (KeyValuePair<int, RGBAColor> KV
in Layers)
47 int Alpha = KV.Value.Alpha;
50 int NegAlpha = 255 - Alpha;
51 Red = AlphaMappingTable.AlphaMapping[NegAlpha, (int)Red] + AlphaMappingTable.AlphaMapping[Alpha, KV.Value.Red];
52 Green = AlphaMappingTable.AlphaMapping[NegAlpha, (
int)Green] + AlphaMappingTable.AlphaMapping[Alpha, KV.Value.Green];
53 Blue = AlphaMappingTable.AlphaMapping[NegAlpha, (int)Blue] + AlphaMappingTable.AlphaMapping[Alpha, KV.Value.Blue];
57 return new RGBColor((
int)Red, (
int)Green, (
int)Blue);
77 public string OutputNameRed {
get; set; }
84 public string OutputNameGreen {
get; set; }
91 public string OutputNameBlue {
get; set; }
97 private string _FadingCurveName =
"Linear";
98 private Curve FadingCurve = null;
107 public string FadingCurveName
109 get {
return _FadingCurveName; }
110 set { _FadingCurveName = value; }
117 FadingCurve = Cabinet.
Curves[FadingCurveName];
119 else if (!FadingCurveName.IsNullOrWhiteSpace())
124 Enum.TryParse(FadingCurveName, out T);
125 FadingCurve =
new Curve(T);
130 Cabinet.
Curves.Add(FadingCurveName);
143 private Cabinet _Cabinet;
145 public override void Init(Cabinet Cabinet)
152 InitFadingCurve(Cabinet);
153 InitOutputs(Cabinet);
156 private void InitOutputs(Cabinet Cabinet)
158 if (Cabinet.Outputs.Contains(OutputNameRed))
160 _OutputRed = Cabinet.Outputs[OutputNameRed];
166 if (Cabinet.Outputs.Contains(OutputNameGreen))
168 _OutputGreen = Cabinet.Outputs[OutputNameGreen];
174 if (Cabinet.Outputs.Contains(OutputNameBlue))
176 _OutputBlue = Cabinet.Outputs[OutputNameBlue];
211 if (_OutputRed != null)
215 if (_OutputGreen != null)
219 if (_OutputBlue != null)
232 if (_OutputRed != null)
234 _OutputRed.
Value = 0;
236 if (_OutputGreen != null)
238 _OutputGreen.
Value = 0;
240 if (_OutputBlue != null)
242 _OutputBlue.
Value = 0;
The Cabinet object describes the parts of a pinball cabinet (toys, outputcontrollers, outputs and more).
CurveList Curves
List of named curve objects used to set Curves for toys.
override void UpdateOutputs()
Updates the outputs of the RGBAToy.
RGBAToy()
Initializes a new instance of the RGBAToy class.
Dictionary for RGBALayer objects.
Common interface for RGB toys supporting several layers of color with alpha value.
bool Contains(string Name)
Checks if a INamedItem object with the specified name exists in the list.
Common interface for RGB toys supporting several layers of color with alpha value.
byte Value
Value of the output.
int Red
Brightness for Red.
int Green
Brightness for Green.
byte MapValue(byte CurvePosition)
Returns the value from the specified curve position.
override void Reset()
Clears all layers and sets all outputs to 0 (off).
This class stores information on RGB colors used for toys and effects (e.g. RGBLed).
RGBColor GetResultingData()
Get the RGBColor resulting from the colors and alpha values in the layers.
The namespace DirectOutput.Cab contains all cabinet related classes like the Cabinet class itself...
DirectOutput.Cab.Out is the namespace for all output controller related classes like different output...
Common interface for outputs of any output controller. The Output class implements this interface and...
int Blue
Brightness for Blue.
Red-Green-Blue (usual color order)
override void Finish()
Finishes the RGBALed toy. Resets the the toy and releases all references.
Base class for toys which need update calls to update the state of their assigned outputs...
Thie RGBAToy controls RGB leds and other gadgets displaying RGB colors. The RGBAToy has multilayer ...
CurveTypeEnum
Enumeration of predefined curves.
Represents a curve which can be used to map values (e.g. adjust a brighnetss value of a led to the br...
The namespace DirectOutput.General contains classes for general use.