Skip to content
Snippets Groups Projects
Commit 666bd24e authored by Pavle Arezina's avatar Pavle Arezina
Browse files

Playback work, still not done

parent a167d103
No related branches found
No related tags found
No related merge requests found
...@@ -27,10 +27,27 @@ namespace Gifitti.Transformation ...@@ -27,10 +27,27 @@ namespace Gifitti.Transformation
for (int i = 0; i < gm.numberOfFrames; i++) for (int i = 0; i < gm.numberOfFrames; i++)
{ {
collection.Add(new MagickImage(gm.GetFrame(i) as Bitmap)); collection.Add(new MagickImage(gm.GetFrame(i) as Bitmap));
//collection[i].AnimationDelay = (delay / 8);
collection[i].Resize(newWidth, newHeight); collection[i].Resize(newWidth, newHeight);
gm.SetFrameFromImage(collection[i].ToBitmap(), i); gm.SetFrameFromImage(collection[i].ToBitmap(), i);
} }
} }
} }
public static void saveThePlayback(GifModel gm, int delay)
{
using (MagickImageCollection collection = new MagickImageCollection())
{
for (int i = 0; i < gm.numberOfFrames; i++)
{
collection.Add(new MagickImage(gm.GetFrame(i) as Bitmap));
collection[i].AnimationDelay = (delay/10);
}
//return collection;
collection.Write("Test.Animated.gif");
}
}
} }
} }
...@@ -11,6 +11,8 @@ using System.Threading.Tasks; ...@@ -11,6 +11,8 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Gifitti.Models; using Gifitti.Models;
using System.Threading; using System.Threading;
using Gifitti.Transformation;
using ImageMagick;
namespace Gifitti.View_Models namespace Gifitti.View_Models
{ {
...@@ -207,13 +209,13 @@ namespace Gifitti.View_Models ...@@ -207,13 +209,13 @@ 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 MenuItemFileSaveAs(object sender, EventArgs e) private void MenuItemFileSaveAs(object sender, EventArgs e)
{ {
if (!chkImage()) TransformGif.saveThePlayback(gm, delay);
/*if (!chkImage())
return; return;
String path = null; String path = null;
saveGifFileDialog.Filter = "GIF Files|*.gif"; saveGifFileDialog.Filter = "GIF Files|*.gif";
if (saveGifFileDialog.ShowDialog() == DialogResult.OK) if (saveGifFileDialog.ShowDialog() == DialogResult.OK)
path = saveGifFileDialog.FileName; path = saveGifFileDialog.FileName;
//Handel Close //Handel Close
if (path == null) if (path == null)
return; return;
...@@ -225,6 +227,7 @@ namespace Gifitti.View_Models ...@@ -225,6 +227,7 @@ namespace Gifitti.View_Models
{ {
MessageBox.Show("Save Path Invalid!"); MessageBox.Show("Save Path Invalid!");
} }
*/
} }
#endregion #endregion
...@@ -327,5 +330,7 @@ namespace Gifitti.View_Models ...@@ -327,5 +330,7 @@ namespace Gifitti.View_Models
{ {
} }
} }
} }
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