Skip to content
Snippets Groups Projects
Commit b1391a9c authored by Riley Mcgee's avatar Riley Mcgee
Browse files

Delay to saves

parent a5b8e2f3
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ namespace Gifitti.Models ...@@ -26,6 +26,7 @@ namespace Gifitti.Models
private bool reverse; private bool reverse;
public int startFrame = 0; public int startFrame = 0;
public int endFrame = 0; public int endFrame = 0;
public int delay { get; set; } = 0;
/// <summary> /// <summary>
/// Load a GIF into the software model from the system path "path" /// Load a GIF into the software model from the system path "path"
...@@ -94,7 +95,11 @@ namespace Gifitti.Models ...@@ -94,7 +95,11 @@ namespace Gifitti.Models
using (MagickImageCollection collection = new MagickImageCollection()) using (MagickImageCollection collection = new MagickImageCollection())
{ {
for (int i = this.startFrame; i < Math.Min(this.endFrame, frames.Length); i++) for (int i = this.startFrame; i < Math.Min(this.endFrame, frames.Length); i++)
{
collection.Add(new MagickImage(frames[i] as Bitmap)); collection.Add(new MagickImage(frames[i] as Bitmap));
collection[i - this.startFrame].AnimationDelay = this.delay/10;
}
// Maximize Colour saturation // Maximize Colour saturation
QuantizeSettings settings = new QuantizeSettings(); QuantizeSettings settings = new QuantizeSettings();
...@@ -123,7 +128,7 @@ namespace Gifitti.Models ...@@ -123,7 +128,7 @@ namespace Gifitti.Models
for (int i = start; i < stop; i++) for (int i = start; i < stop; i++)
{ {
collection.Add(new ImageMagick.MagickImage(frames[i] as Bitmap)); collection.Add(new ImageMagick.MagickImage(frames[i] as Bitmap));
collection[i - start].AnimationDelay = 1; collection[i - this.startFrame].AnimationDelay = this.delay/10;
} }
// Optionally reduce colors // Optionally reduce colors
QuantizeSettings settings = new QuantizeSettings(); QuantizeSettings settings = new QuantizeSettings();
......
...@@ -25,7 +25,6 @@ namespace Gifitti.View_Models ...@@ -25,7 +25,6 @@ namespace Gifitti.View_Models
{ {
#region Fields #region Fields
GifModel gm; GifModel gm;
int delay = 0;
// GifImage _currentGif; <- used to encapsulate info later // GifImage _currentGif; <- used to encapsulate info later
private const int widthBuffer = 20; private const int widthBuffer = 20;
...@@ -167,7 +166,7 @@ namespace Gifitti.View_Models ...@@ -167,7 +166,7 @@ namespace Gifitti.View_Models
private void AdvanceFrameTimer(object sender, EventArgs e) private void AdvanceFrameTimer(object sender, EventArgs e)
{ {
//get next frame //get next frame
Thread.Sleep(delay); Thread.Sleep(gm.delay);
gifView.Image = gm.GetNextFrame(); gifView.Image = gm.GetNextFrame();
} }
...@@ -313,7 +312,7 @@ namespace Gifitti.View_Models ...@@ -313,7 +312,7 @@ namespace Gifitti.View_Models
/// <param name="e"> Event arguments associated with this event. </param> /// <param name="e"> Event arguments associated with this event. </param>
private void GifFPSSliderUpdate(object sender, EventArgs e) private void GifFPSSliderUpdate(object sender, EventArgs e)
{ {
delay = (10-trackBar1.Value)*10; gm.delay = (10-trackBar1.Value)*10;
} }
private void MenuItemResize(object sender, EventArgs e) private void MenuItemResize(object sender, EventArgs e)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment