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

Redundant Code removal, DD Rev1 finished and Compiled (Closes #29)

parent a910f049
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
......@@ -32,9 +32,9 @@
\title{SE 3XA3: MIS\\Gifitti}
\author{Team \#2, Gifitti
\\ Riley McGee, mcgeer
\\ Pavle Arezina, arezinp
\\ Nicolai Kozel, kozeln
\\ Riley McGee, mcgeer
}
\date{\today}
......@@ -55,9 +55,9 @@
\begin{tabularx}{\textwidth}{p{3cm}p{2cm}X}
\toprule {\bf Date} & {\bf Version} & {\bf Notes}\\
\midrule
November 12th 2016 & 1.0 & Initial creation of document\\
November 13th 2016 & 1.1 & Spellcheck and formatting\\
... & ... & ... \\
November 12th 2016 & 1.0 & Initial creation of document \\
November 13th 2016 & 1.1 & Spellcheck and formatting \\
November 30th 2016 & 2.0 & Updated to reflect the release of Gifitti. \\
\bottomrule
\end{tabularx}
\end{table}
......@@ -67,8 +67,8 @@ November 13th 2016 & 1.1 & Spellcheck and formatting\\
\pagenumbering{arabic}
\section{Introduction}
This document describes the internal workings of each module implemented as a part of Gifitti. Described are the methods, input/output, as well as any
environment and state variables that the module uses. This document will continue to be updated as more methods and functionalities are added to each module.
Gifitti is a software solution for allowing users with a varying knowledge base on image manipulation, as well as technical experience with computers to be able to load, decompose, and modify GIF images. \\
This document describes the internal workings of each module implemented as a part of Gifitti. Described are the methods, input/output, as well as any environment and state variables that the module uses. The MIS will continue to be updated as more methods and features are added to each module.
\section{Module Declarations}
This section simply lists the modules used by Gifitti. More details on these modules (and how they interact) can be found in the MG document.
......@@ -92,86 +92,145 @@ Since the hardware hiding module is implemented through the OS and is not actual
This module serves as a communication layer between the hardware-hiding module and the software decision module. This module covers M4.M5, and M8. Again, this module is not actually coded so there is nothing to add to the MIS.
\subsection{Software Decision Module}
This module includes any data structures and algorithms used in the system that do not provide direct interaction with the user. This module covers M7, and M6. Again, ths module is not actually coded so there is nothing to add to the MIS.
\subsection{Image Loading Module}
This module allows for the conversion of system paths to images in a usable form within the software.
\subsubsection{Variables}
\begin{enumerate}
\item Filepath (Input)
\item Image (Output)
\item Filepath (Input)
\item originalImage (Output)
\item gifImage (Output)
\item numberOfFrames (Output)
\item frames[] (Output)
\end{enumerate}
\subsubsection{Methods}
\begin{enumerate}
\item GetFilePath(OpenFileDialog o)\\This method uses an open file dialog menu within C\# in order to allow the user to select a file (path). This file path is then stored within the FilePath variable.
\item LoadImage(string FilePath) \\This method takes as input the filepath and converts it to an image file type using M4. This image is saved in the Image variable.
\item LoadImage(string FilePath) \\This method takes as input the filepath and converts
it to an image file type using M4. This image is saved in the Image variable.
\item frameConstruction(Image img) \\Decomposes GIF into its frames.
\end{enumerate}
\subsection{Image Processing Module}
This module converts the input images into a system usable form.
\subsubsection{Variables}
\begin{enumerate}
\item Image (Input)
\end{enumerate}
\subsubsection{Methods}
\begin{enumerate}
\item ConvertTo(FileType ft, Image f)\\This method will take as input a filetype and an image and convert the image to the file type requested. This result is then returned.
\item GetFileType(Image f)\\This method will return the file type of the image passed as input.
\end{enumerate}
Implementation is handled by the ImageMagick.NET API.
\subsection{Image Conversion Module}
This module converts the GIF from a GIF Model (M8) to an image exportable by the system (GIF, TIFF, JPEG, PNG, BMP).
\subsubsection{Variables}
\begin{enumerate}
\item allowedFileTypes[]
\item curLoadedGIF (Input)
\item outputImage (Output)
\item allowedFileTypes[] (Static)
\item exportFileType (Input)
\item curLoadedGIF (Input)
\item startFrame (Input)
\item endFrame (Input)
\item delay (Input)
\item filePath (Input)
\item outputImage (Output)
\end{enumerate}
\subsubsection{Methods}
\begin{enumerate}
\item exportGIF(FileType ft) \\ This will be a public method which will call ConvertTo and return the result of that (if ft is in allowedFileTypes[]).
\item ConvertTo(FileType ft)\\This method will take as input a file type and convert curLoadedGIF to that file type. This result is then returned.
\item GetFileType()\\This method will return the file type of the curLoadedGIF.
\item exportGIF(string filePath)\\
This handles exporting the currently represented GIF.
\item ConvertTo(string filePath, FileType ft)\\
Export of all GIF frames as type ft to path filePath.
\end{enumerate}
\subsection{GIF Transformation Module}
This module handles frame by frame manipulation of the GIF Models (M8) in order to complete operations such as resizing and modifyng the speed, etc. All
the methods and variables of this module are listed below.
\subsubsection{Variables}
\begin{enumerate}
\item curLoadedGIF (Input)
\item curLoadedGIF (Input)
\item modifiedGIF (Output)
\end{enumerate}
\subsubsection{Methods}
\begin{enumerate}
\item Reset()\\This method will reset the curLoadedGIF to its original state when loaded into the program.
\item Resize(int x, int y)\\This method will resize the GIF to the size passed as parameters.
\item AddFrame(Frame[] f)\\This method will add to the GIF the frames passed as parameters.
\item RemoveFrame(Frame[] f)\\This method will remove from the GIF the frames passed as parameters.
\item Rotate(int x)\\This method will rotate the GIF by the input value in degrees.
\item ChangeSpeed(int x)\\This method will alter the speed of the GIF by the value passed as a parameter.
\item Resize(int x, int y)\\
This method will resize the GIF to the size passed as parameters.
\item ChangeSpeed(int newDelay)\\
This method will alter the speed of the GIF by the value passed as a parameter.
This is information hidden, it is meant to extend more for future releases.
\end{enumerate}
\subsection{GIF Model Module}
This module represents a GIF object within the system. It contains methods and properties that allow the system to properly manipulate the GIF.
\subsubsection{Variables}
\begin{enumerate}
\item Frames[]
\item Speed
\item FileType
\item FilePath (Input)
\item Frames[]
\item delay
\item startFrame
\item endFrame
\end{enumerate}
\subsubsection{Methods}
\begin{enumerate}
\item GetFrames()\\This method will return the GIF as an array of frames.
\item Play()\\This method will play the GIF by looping through the frames array.
\item Stop()\\This method will stop all playback of the GIF.
\item GetFilePath\\This method will return the filepath(name) as a string.
\item GetNextFrame()\\
Returns the next frame to be handled by the controller based on Model state.
\item GetFrame(int index, [bool isResize]) \\
Fetches frame number index (index is an element of [0, numberOfFrames - 1]),
if isResize return a clone, else return a reference to the image.
\item Dispose()\\
Memory management and system cleaning.
\end{enumerate}
\subsection{View-Model Module}
This module links views to the ViewModels using C\# partial class declarations to separate view-model, and view aspects of the system.
The View-Model Module handles all View elements created by C\# WinForms, as well as their static link to the model representation of a view. These links are referred to as View-Models. View-Models and Views are not abstracted into separate modules due to how the implementation occurs in the C\# coding paradigm. Views (called Forms), are linked to their View-Model via partial classes, this keeps coupling high between the View-Models and Views, but low coupling to the Model.
\subsubsection{Variables}
\begin{enumerate}
\item curView
\item views[]
\item MainForm
\item HelpContextForm
\item SaveAsXbyYForm
\item GifModel (input)
\end{enumerate}
\subsubsection{Methods}
\begin{enumerate}
\item getView()\\This method will return the current view.
\item changeView(View v)\\This method will change the view to the input view v.
\item MenuOpenHelp()\\
Show the HelpContextForm.
\item MenuItemResize()\\
Show the SaveAsXbyYForm.
\item StartStopClickEvent() \\
Toggles between play and stop for GIFs.
\item MenuOpenFile()\\
Launches a OpenFileDialog prompting the user to open a GIF, the opened GIF is then loaded as a GifModel.
\item MenuItemFileSaveAs()\\
Launches a SaveFileDialog prompting the user for a path to save the loaded GIF to a location.
\item StopFrameTextChanged()\\
Validation and Verification of the text box representing endFrame.
\item StartFrameTextChanged()\\
Validation and Verification of the text box representing startFrame.
\item GifFPSSliderUpdate()\\
Updates delay of the GIF via slider position.
\item AdvanceFrameTimer()\\
System interupt to draw the next frame, modeling the GIF.
\item exportFrames(ImageFormat format)\\
Exports the GIF as a bundle of Images representing each frame from startFrame to endFrame, exported image will be of type Format.
\item MenuItemExportTIFF()\\
Exports the GIF frames as TIFF file type
\item MenuItemExportPNG()\\
Exports the GIF frames as PNG file type
\item MenuItemExportJPEG()\\
Exports the GIF frames as JPEG file type
\item MenuItemExportBMP()\\
Exports the GIF frames as BMP file type
\item chkImage()\\
Validates the Image loaded is legal.
\item openingGIFLinkClicked()\\
Displays information about opening GIFs in the help context.
\item savingGIFLinkClicked()\\
Displays information about saving GIFs in the help context.
\item savingImageLinkClicked()\\
Displays information about saving GIFs as other image types in the help context.
\item pickFramesLinkClicked()\\
Displays information about selecting sub GIFs the help context.
\item playbackSpeedLinkClicked()\\
Displays information about modifying GIF playback speed in the help context.
\item resizeLinkClicked()\\
Displays information about resizing GIFs in the help context.
\item SaveAsButtonClick()\\
Utilized in the SaveAsXbyYForm, Prompts the user for a file path for a resized GIF.
\item widthChanged()\\
Validation and Verification on the width text box in the SaveAsXbtYForm
\item heightChanged()\\
Validation and Verification on the height text box in the SaveAsXbtYForm
\end{enumerate}
\end{document}
\ No newline at end of file
......@@ -159,36 +159,6 @@ namespace Gifitti.Models
}
#endregion
#region Sub GIF Handling
/// <summary>
/// Fetches a sub gif over frames start -> stop
/// </summary>
/// <param name="start">Initial Frame.</param>
/// <param name="stop">End Frame.</param>
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 - this.startFrame].AnimationDelay = this.delay/10;
}
// 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");
}
}
#endregion
#region Fetch frames
/// <summary>
/// Fetches the GIFs next viewable frame
......
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