Skip to content
Snippets Groups Projects
Commit 40d849f8 authored by Nick Kozel's avatar Nick Kozel
Browse files

nuking project because of odd fatal issue

parent 109519b0
No related branches found
No related tags found
No related merge requests found
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
...@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 ...@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio 14
VisualStudioVersion = 14.0.25420.1 VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gifitti", "Gifitti\Gifitti.csproj", "{436EBE81-2B19-4675-9DB1-7A38E6B1C98F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gifitti", "Gifitti\Gifitti.csproj", "{07513F6B-9A44-4981-A3F9-8882AC8B890E}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
...@@ -11,10 +11,10 @@ Global ...@@ -11,10 +11,10 @@ Global
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{436EBE81-2B19-4675-9DB1-7A38E6B1C98F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {07513F6B-9A44-4981-A3F9-8882AC8B890E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{436EBE81-2B19-4675-9DB1-7A38E6B1C98F}.Debug|Any CPU.Build.0 = Debug|Any CPU {07513F6B-9A44-4981-A3F9-8882AC8B890E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{436EBE81-2B19-4675-9DB1-7A38E6B1C98F}.Release|Any CPU.ActiveCfg = Release|Any CPU {07513F6B-9A44-4981-A3F9-8882AC8B890E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{436EBE81-2B19-4675-9DB1-7A38E6B1C98F}.Release|Any CPU.Build.0 = Release|Any CPU {07513F6B-9A44-4981-A3F9-8882AC8B890E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
namespace Gifitti.Views namespace Gifitti
{ {
partial class MainForm partial class Form1
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
...@@ -30,63 +29,42 @@ ...@@ -30,63 +29,42 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.gifView = new System.Windows.Forms.PictureBox();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.gifView)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // button1
// //
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button1.Location = new System.Drawing.Point(9, 324); this.button1.Location = new System.Drawing.Point(12, 506);
this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(56, 34); this.button1.Size = new System.Drawing.Size(139, 35);
this.button1.TabIndex = 0; this.button1.TabIndex = 0;
this.button1.Text = "Open"; this.button1.Text = "Open GIF";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// gifView
//
this.gifView.Location = new System.Drawing.Point(9, 10);
this.gifView.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.gifView.Name = "gifView";
this.gifView.Size = new System.Drawing.Size(456, 310);
this.gifView.TabIndex = 1;
this.gifView.TabStop = false;
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// button2 // button2
// //
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.Location = new System.Drawing.Point(406, 325); this.button2.Location = new System.Drawing.Point(431, 506);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(56, 34); this.button2.Size = new System.Drawing.Size(139, 35);
this.button2.TabIndex = 2; this.button2.TabIndex = 1;
this.button2.Text = "Save Frames"; this.button2.Text = "Save GIF";
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click); this.button2.Click += new System.EventHandler(this.button2_Click);
// //
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(474, 368); this.ClientSize = new System.Drawing.Size(582, 553);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);
this.Controls.Add(this.gifView);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Name = "Form1";
this.MaximizeBox = false;
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "MainForm"; this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.gifView)).EndInit(); this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
...@@ -94,11 +72,7 @@ ...@@ -94,11 +72,7 @@
#endregion #endregion
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.PictureBox gifView;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
} }
} }
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Gifitti
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
}
}
}
...@@ -117,10 +117,4 @@ ...@@ -117,10 +117,4 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>157, 17</value>
</metadata>
</root> </root>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Gifitti.GifImageModule
{
public class GifImage
{
public Image gifImage
{
get; set;
}
private FrameDimension dimension;
private int frameCount;
private int currentFrame = -1;
private bool reverse;
private int step = 1;
public GifImage(string path)
{
gifImage = Image.FromFile(path);
//initialize
dimension = new FrameDimension(gifImage.FrameDimensionsList[0]);
//gets the GUID
//total frames in the animation
frameCount = gifImage.GetFrameCount(dimension);
}
private void modifyGifImage(Image gif)
{
gifImage = gif;
//initialize
dimension = new FrameDimension(gifImage.FrameDimensionsList[0]);
//gets the GUID
//total frames in the animation
frameCount = gifImage.GetFrameCount(dimension);
}
public bool ReverseAtEnd
{
//whether the gif should play backwards when it reaches the end
get { return reverse; }
set { reverse = value; }
}
public Image GetNextFrame()
{
currentFrame += step;
//if the animation reaches a boundary...
if (currentFrame >= frameCount || currentFrame < 1)
{
if (reverse)
{
step *= -1;
//...reverse the count
//apply it
currentFrame += step;
}
else
{
currentFrame = 0;
//...or start over
}
}
return GetFrame(currentFrame);
}
public Image GetFrame(int index)
{
gifImage.SelectActiveFrame(dimension, index);
//find the frame
return (Image)gifImage.Clone();
//return a copy of it
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Windows.Media.Imaging;
using System.Windows.Media;
using ImageMagick;
namespace Gifitti.GifImageModule
{
public class GifModel
{
public GifImage gifImage { get; private set; }
public Image originalGif { get; private set; }
private int numberOfFrames;
private Image[] frames;
//Build a Gif Model instace
//Re create object when a new gif is loaded
//Keep when working with same gif
public GifModel(GifImage gifImage)
{
this.gifImage = gifImage;
//Save the original Gif
originalGif = this.gifImage.gifImage.Clone() as Image;
frameConstruction(this.gifImage);
}
public GifModel(String path)
{
this.gifImage = new GifImage(path);
//Save the original Gif
originalGif = this.gifImage.gifImage.Clone() as Image;
frameConstruction(this.gifImage);
}
//Construct Frames for the entire Image
private void frameConstruction(GifImage gifImage)
{
numberOfFrames = gifImage.gifImage.GetFrameCount(FrameDimension.Time);
frames = new Image[numberOfFrames];
for (int i = 0; i < numberOfFrames; i++)
{
originalGif.SelectActiveFrame(FrameDimension.Time, i);
frames[i] = originalGif.Clone() as Image;
}
}
public void resetToOriginalGif()
{
gifImage.gifImage = originalGif;
}
public void resizeGif(int newWidth, int newHeight)
{
using (MagickImageCollection collection = new MagickImageCollection())
{
for (int i = 0; i < frames.Length; i++)
{
collection.Add(new MagickImage(frames[i] as Bitmap));
collection[i].Resize(newWidth, newHeight);
}
// Optionally reduce colors
QuantizeSettings settings = new QuantizeSettings();
settings.Colors = 256;
collection.Quantize(settings);
// Optionally optimize the images (images should have the same size).
collection.Optimize();
// Save gif
collection.Write("tempResize.gif");
}
}
public void returnSubGif(int start, int stop)
{
using (MagickImageCollection collection = new MagickImageCollection())
{
// Add first image and set the animation delay to 100ms
for (int i = start; i < stop; i++)
{
collection.Add(new ImageMagick.MagickImage(frames[i] as Bitmap));
collection[i - start].AnimationDelay = 1;
}
// Optionally reduce colors
QuantizeSettings settings = new QuantizeSettings();
settings.Colors = 256;
collection.Quantize(settings);
// Optionally optimize the images (images should have the same size).
collection.Optimize();
// Save gif
collection.Write("temp.gif");
}
}
}
}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{436EBE81-2B19-4675-9DB1-7A38E6B1C98F}</ProjectGuid> <ProjectGuid>{07513F6B-9A44-4981-A3F9-8882AC8B890E}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Gifitti</RootNamespace> <RootNamespace>Gifitti</RootNamespace>
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
...@@ -24,7 +22,6 @@ ...@@ -24,7 +22,6 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
...@@ -36,11 +33,6 @@ ...@@ -36,11 +33,6 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Magick.NET-Q16-AnyCPU, Version=7.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec, processorArchitecture=MSIL">
<HintPath>..\packages\Magick.NET-Q16-AnyCPU.7.0.3.300\lib\net40-client\Magick.NET-Q16-AnyCPU.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
...@@ -52,21 +44,18 @@ ...@@ -52,21 +44,18 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="GifImageModule\GifModel.cs" /> <Compile Include="Form1.cs">
<Compile Include="Views\MainForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Views\MainForm.Designer.cs"> <Compile Include="Form1.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>Form1.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="GifImageModule\GifImage.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Views\MainForm.resx"> <EmbeddedResource Include="Form1.resx">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
...@@ -77,7 +66,6 @@ ...@@ -77,7 +66,6 @@
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
...@@ -92,13 +80,6 @@ ...@@ -92,13 +80,6 @@
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Magick.NET-Q16-x86.7.0.3.300\build\net40-client\Magick.NET-Q16-x86.targets" Condition="Exists('..\packages\Magick.NET-Q16-x86.7.0.3.300\build\net40-client\Magick.NET-Q16-x86.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Magick.NET-Q16-x86.7.0.3.300\build\net40-client\Magick.NET-Q16-x86.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Magick.NET-Q16-x86.7.0.3.300\build\net40-client\Magick.NET-Q16-x86.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
......
...@@ -3,7 +3,6 @@ using System.Collections.Generic; ...@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Gifitti.Views;
namespace Gifitti namespace Gifitti
{ {
...@@ -17,12 +16,7 @@ namespace Gifitti ...@@ -17,12 +16,7 @@ namespace Gifitti
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm()); Application.Run(new Form1());
/*
GifImageModule.GifModel gm = new GifImageModule.GifModel("C:/Users/riley_000/Desktop/GIFS/giphy.gif");
gm.resizeGif(700, 700);
gm.returnSubGif(0,10);
*/
} }
} }
} }
...@@ -20,7 +20,7 @@ using System.Runtime.InteropServices; ...@@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("436ebe81-2b19-4675-9db1-7a38e6b1c98f")] [assembly: Guid("07513f6b-9a44-4981-a3f9-8882ac8b890e")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Gifitti.GifImageModule;
namespace Gifitti.Views
{
public partial class MainForm : Form
{
GifModel gm;
// GifImage _currentGif; <- used to encapsulate info later
private const int widthBuffer = 20;
private const int heightBuffer = 60;
Image globalGif;
public MainForm()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "GIF Files|*.gif";
DialogResult result = openFileDialog1.ShowDialog(); // Show the dialog.
if (result == DialogResult.OK) // Test result.
{
string file = openFileDialog1.FileName;
try
{
gm = new GifModel(file);
Image loadedGif = gm.gifImage.gifImage;
globalGif = loadedGif;
gifView.Image = loadedGif;
gifView.Width = loadedGif.Width;
gifView.Height = loadedGif.Height;
ClientSize = new Size(loadedGif.Width+widthBuffer, loadedGif.Height+heightBuffer);
}
catch (IOException)
{
}
CenterToScreen();
// Focus the gif:
gifView.Select();
gifView.Focus();
ActiveControl = gifView;
}
}
private void button2_Click(object sender, EventArgs e)
{
String x = "";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
x = folderBrowserDialog1.SelectedPath;
}
List<Image> IMGs = new List<Image>();
Image test;
int Length = globalGif.GetFrameCount(FrameDimension.Time);
for (int i = 0; i < Length; i++)
{
globalGif.SelectActiveFrame(FrameDimension.Time, i);
test = new Bitmap(globalGif);
String y = "\\tmp-" + i + ".bmp";
String xy = x + y;
test.Save(@xy);
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void gifView_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
gm?.returnSubGif(1,10);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Magick.NET-Q16-AnyCPU" version="7.0.3.300" targetFramework="net452" />
</packages>
\ No newline at end of file
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