Skip to content

Commit

Permalink
imported in a new gif animator that operates faster than the previous…
Browse files Browse the repository at this point in the history
… one to improve the animated output speed.
  • Loading branch information
roger-castaldo committed May 10, 2017
1 parent 321f226 commit efbf718
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 1,342 deletions.
4 changes: 1 addition & 3 deletions BpmEngine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@
<Compile Include="Attributes\RequiredAttribute.cs" />
<Compile Include="DateString.cs" />
<Compile Include="Delegates.cs" />
<Compile Include="Drawing\Gif\Encoder.cs" />
<Compile Include="Drawing\Gif\LZWEncoder.cs" />
<Compile Include="Drawing\Gif\NeuQuant.cs" />
<Compile Include="Drawing\GifEncoder.cs" />
<Compile Include="Elements\Collaborations\Text.cs" />
<Compile Include="Elements\DefinitionFile.cs" />
<Compile Include="Elements\DefinitionVariable.cs" />
Expand Down
21 changes: 10 additions & 11 deletions BusinessProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Org.Reddragonit.BpmEngine
{
public sealed class BusinessProcess
{
private const int _ANIMATION_DELAY = 1000;
private static readonly TimeSpan _ANIMATION_DELAY = new TimeSpan(0,0,1);
private const int _DEFAULT_PADDING = 100;
private const int _VARIABLE_NAME_WIDTH = 200;
private const int _VARIABLE_VALUE_WIDTH = 300;
Expand Down Expand Up @@ -551,18 +551,17 @@ public byte[] Animate(bool outputVariables)
_current = this;
WriteLogLine(LogLevels.Info, new StackFrame(1, true), DateTime.Now, string.Format("Rendering Business Process Animation{0}", new object[] { (outputVariables ? " with variables" : " without variables") }));
MemoryStream ms = new MemoryStream();
Drawing.Gif.Encoder enc = new Drawing.Gif.Encoder();
enc.Start(ms);
enc.SetDelay(_ANIMATION_DELAY);
enc.SetRepeat(0);
_state.Path.StartAnimation();
while (_state.Path.HasNext())
using (Drawing.GifEncoder enc = new Drawing.GifEncoder(ms))
{
enc.AddFrame(Diagram(outputVariables));
_state.Path.MoveToNextStep();
enc.FrameDelay = _ANIMATION_DELAY;
_state.Path.StartAnimation();
while (_state.Path.HasNext())
{
enc.AddFrame(Diagram(outputVariables));
_state.Path.MoveToNextStep();
}
_state.Path.FinishAnimation();
}
_state.Path.FinishAnimation();
enc.Finish();
return ms.ToArray();
}

Expand Down
Loading

0 comments on commit efbf718

Please sign in to comment.