WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
RGBAMatrixColorScaleShapeEffect.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
7 
8 namespace DirectOutput.FX.MatrixFX
9 {
14  {
15 
16  private RGBAColor _ActiveColor = new RGBAColor(0xff, 0xff, 0xff, 0xff);
17 
25  public RGBAColor ActiveColor
26  {
27  get { return _ActiveColor; }
28  set { _ActiveColor = value; }
29  }
30 
31  private RGBAColor _InactiveColor = new RGBAColor(0, 0, 0, 0);
32 
40  public RGBAColor InactiveColor
41  {
42  get { return _InactiveColor; }
43  set { _InactiveColor = value; }
44  }
45 
46 
47 
48 
49  private string _ShapeName;
50 
57  public string ShapeName
58  {
59  get { return _ShapeName; }
60  set { _ShapeName = value; }
61  }
62 
63 
64 
65  private IMatrixBitmapEffect TargetEffect = null;
66 
67 
68 
69 
70 
71 
72  public override void Init(Table.Table Table)
73  {
74  base.Init(Table);
75 
76  Shape Def = Table.ShapeDefinitions.Shapes.FirstOrDefault(SH => SH.Name.Equals(ShapeName, StringComparison.InvariantCultureIgnoreCase));
77 
78  if (Def != null)
79  {
81  if (Def.GetType() == typeof(ShapeAnimated))
82  {
83  ShapeAnimated DefAnim = (ShapeAnimated)Def;
84 
86 
88 
94 
95  ((RGBAMatrixColorScaleBitmapAnimationEffect)FX).ActiveColor = this.ActiveColor;
96  ((RGBAMatrixColorScaleBitmapAnimationEffect)FX).InactiveColor = this.InactiveColor;
97 
98 
99  }
100  else
101  {
103  ((RGBAMatrixColorScaleBitmapEffect)FX).ActiveColor = this.ActiveColor;
104  ((RGBAMatrixColorScaleBitmapEffect)FX).InactiveColor = this.InactiveColor;
105  }
106 
107  FX.BitmapFilePattern = Table.ShapeDefinitions.BitmapFilePattern;
109  FX.BitmapHeight = Def.BitmapHeight;
110  FX.BitmapWidth = Def.BitmapWidth;
111  FX.BitmapTop = Def.BitmapTop;
112  FX.BitmapLeft = Def.BitmapLeft;
114  FX.ToyName = this.ToyName;
115 
116  FX.FadeMode = this.FadeMode;
117  FX.Name = this.Name + " Target";
118  FX.LayerNr = this.LayerNr;
119  FX.FadeMode = this.FadeMode;
120  FX.Left = this.Left;
121  FX.Top = this.Top;
122  FX.Width = this.Width;
123  FX.Height = this.Height;
124  TargetEffect = FX;
125 
126  TargetEffect.Init(Table);
127  }
128  else
129  {
130  //Shape does not exist
131  TargetEffect = null;
132  }
133  }
134 
135  public override void Finish()
136  {
137  base.Finish();
138 
139  if (TargetEffect != null)
140  {
141  TargetEffect.Finish();
142  TargetEffect = null;
143  }
144  }
145 
146  public override void Trigger(Table.TableElementData TableElementData)
147  {
148  if (TargetEffect != null)
149  {
150  TargetEffect.Trigger(TableElementData);
151  }
152  }
153 
154 
155  }
156 }
This class stores information on colors used for toys and effects (e.g. RGBLed).
Definition: RGBAColor.cs:14
Base class for effects targeting a matrix of toys (e.g. addressable ledstrip)
MatrixAnimationStepDirectionEnum AnimationStepDirection
Gets or sets the animation direction.
AnimationBehaviourEnum AnimationBehaviour
Gets or sets the animation behaviour.
MatrixAnimationStepDirectionEnum AnimationStepDirection
Gets or sets the animation direction.
This displays a defined part of a bitmap as a animation in the given colors on a area of a RGBAtoy Ma...
int BitmapFrameNumber
Gets or sets the number of the frame to be used. This is usefull if you work with animated gifs...
Definition: Shape.cs:23
int AnimationFrameDurationMs
Gets or sets the animation frame duration in ms.
new string Name
Name of the effect.
Definition: IEffect.cs:53
int AnimationFrameCount
Gets or sets the number of frames for the whole animation.
Displays a shape on a RGBA matrix (typically a ledstrip array). The color of the displayed shape is c...
void Init(Table.Table Table)
Init must do all necessary initialization work after the IEffect object has been instanciated.
DirectOutput.General.BitmapHandling.FastBitmapDataExtractModeEnum DataExtractMode
DirectOutput.General.FilePattern BitmapFilePattern
DirectOutput.FX.FadeModeEnum FadeMode
Definition: IMatrixEffect.cs:6
void Trigger(TableElementData TableElementData)
Execute triggers the effect for the given TableElement.
int BitmapWidth
Gets or sets the width of the the part of the bitmap which is to be used.
Definition: Shape.cs:65
FastBitmapDataExtractModeEnum DataExtractMode
Gets or sets the mode how data is extracted from the source bitmap.
Definition: Shape.cs:94
int BitmapTop
Gets or sets the top of the the part of the bitmap which is to be used.
Definition: Shape.cs:37
int AnimationStepSize
Gets or sets the size of the step in pixels or frames (depending on the AnimationStepDirection) to th...
void Finish()
Finish must do all necessary cleanupwork before a IEffect object is discarded.
int AnimationFrameCount
Gets or sets the number of frames for the whole animation.
The RGBAMatrixBitmapEffect displays a defined part of a bitmap in the given colors on a area of a RGB...
int BitmapLeft
Gets or sets the left boundary of the the part of the bitmap which is to be used. ...
Definition: Shape.cs:51
int BitmapHeight
Gets or sets the height of the the part of the bitmap which is to be used.
Definition: Shape.cs:79
The namespace FX contains effect related classes. Effects can be assigned directly to a Table and wi...
int AnimationStepSize
Gets or sets the size of the step in pixels or frames (depending on the AnimationStepDirection) to th...
The namespace DirectOutput.General contains classes for general use.
Effects in this namespace are controlling toys which implement the IMatrix interface ...
int AnimationFrameDurationMs
Gets or sets the animation frame duration in ms.
override void Trigger(Table.TableElementData TableElementData)
AnimationBehaviourEnum AnimationBehaviour
Gets or sets the animation behaviour.