WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
RGBAMatrixShapeEffect.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 {
13  public class RGBAMatrixShapeEffect : MatrixEffectBase<RGBAColor>
14  {
15  private string _ShapeName;
16 
23  public string ShapeName
24  {
25  get { return _ShapeName; }
26  set { _ShapeName = value; }
27  }
28 
29 
30 
31  private IMatrixBitmapEffect TargetEffect = null;
32 
33 
34 
35 
36 
37 
38  public override void Init(Table.Table Table)
39  {
40  base.Init(Table);
41 
42  Shape Def = Table.ShapeDefinitions.Shapes.FirstOrDefault(SH => SH.Name.Equals(ShapeName, StringComparison.InvariantCultureIgnoreCase));
43 
44  if (Def != null)
45  {
47  if (Def.GetType() == typeof(ShapeAnimated))
48  {
49  ShapeAnimated DefAnim = (ShapeAnimated)Def;
50 
52 
54 
60 
61 
62  }
63  else
64  {
65  FX = new RGBAMatrixBitmapEffect();
66  }
67 
68  FX.BitmapFilePattern = Table.ShapeDefinitions.BitmapFilePattern;
70  FX.BitmapHeight = Def.BitmapHeight;
71  FX.BitmapWidth = Def.BitmapWidth;
72  FX.BitmapTop = Def.BitmapTop;
73  FX.BitmapLeft = Def.BitmapLeft;
75  FX.ToyName = this.ToyName;
76  FX.LayerNr = this.LayerNr;
77  FX.FadeMode = this.FadeMode;
78  FX.Left = this.Left;
79  FX.Top = this.Top;
80  FX.Width = this.Width;
81  FX.Height = this.Height;
82 
83  FX.Name = this.Name + " Target";
84 
85  TargetEffect = FX;
86 
87  TargetEffect.Init(Table);
88  }
89  else
90  {
91  //Shape does not exist
92  TargetEffect = null;
93  }
94  }
95 
96  public override void Finish()
97  {
98  base.Finish();
99 
100  if (TargetEffect != null)
101  {
102  TargetEffect.Finish();
103  TargetEffect = null;
104  }
105  }
106 
107  public override void Trigger(Table.TableElementData TableElementData)
108  {
109  if (TargetEffect != null)
110  {
111  TargetEffect.Trigger(TableElementData);
112  }
113  }
114 
115 
116  }
117 }
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.
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.
Displays a shape on a RGBA matrix (typically a ledstrip matrix). The color of the displayed shape is ...
new string Name
Name of the effect.
Definition: IEffect.cs:53
int AnimationFrameCount
Gets or sets the number of frames for the whole animation.
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
The RGBAMatrixBitmapEffect displays a defined part of a bitmap on a area of a RGBAtoy Matrix...
The RGBAMatrixBitmapAnimationEffect displays a anmation which is based on a image file on the definea...
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.
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.