using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Drawing;
using System.Diagnostics;
using System.IO;

namespace S04_Projet
{
    class Program
    {
        public static bool MULTITHREADING = false;
        static void Main(string[] args)
        {
            MyImage img = new MyImage("img/lena.bmp");
            img.Save("output.bmp");

            /*short[,] boxBlurFilter = new short[,] {
                {1,1,1 },
                {1,1,1 },
                {1,1,1 }
            };

            short[,] identityFilter = new short[,]
            {
                { 0, 0, 0 },
                { 0, 1, 0 },
                { 0, 0, 0 }
            };

            short[,] edgeDetect1Filter = new short[,]
            {
                { 1, 0, -1 },
                { 0, 0, 0  },
                { -1, 0, 1 }
            };

            short[,] edgeDetect2Filter = new short[,]
            {
                { 0, 1, 0 },
                { 1, -4, 1 },
                { 0, 1, 0 }
            };

            short[,] edgeDetect3Filter = new short[,]
            {
                { -1, -1, -1 },
                { -1, 8, -1 },
                { -1, -1, -1 }
            };

            short[,] sharpenFilter = new short[,]
            {
                { 0, -1, 0 },
                { -1, 5, -1 },
                { 0, -1, 0 }
            };

            MyImage imgg = new MyImage("img/coco.bmp");
            imgg.ApplyConvFilter(identityFilter, 1).Save("id.bmp");
            imgg.ApplyConvFilter(edgeDetect1Filter, 1).Save("edge1.bmp");
            imgg.ApplyConvFilter(edgeDetect2Filter, 1).Save("edge2.bmp");
            imgg.ApplyConvFilter(edgeDetect3Filter, 1).Save("edge3.bmp");
            imgg.ApplyConvFilter(sharpenFilter, 1).Save("sharpen.bmp");
            imgg.ApplyConvFilter(boxBlurFilter, (double)1/9).Save("blur.bmp");*/

            /*Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("#############################################################");
            Console.WriteLine("###                       Bienvenue                       ###");
            Console.WriteLine("#############################################################");
            Console.WriteLine();

            MyImage img = Display.LoadImage();
            Display.Operation ToDo = Display.AskForOperation();
            MyImage newImg = Display.PerformOperation(ToDo, img);

            while (newImg != null)
            {
                ToDo = Display.AskForOperation();
                newImg = Display.PerformOperation(ToDo, newImg);
            }

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Image sauvegardée en {0}ms!", Display.elapsedTime);


            //Console.Clear();
            Console.Read();*/
            #region Test
            /*MyImage imgRotate90 = img.Rotate90();
            imgRotate90.Save("90.bmp");
            MyImage imgRotate180 = img.Rotate180();
            imgRotate180.Save("180.bmp");
            MyImage imgRotate270 = img.Rotate270();
            imgRotate270.Save("270.bmp");
            Console.WriteLine("Rotations terminées");

            MyImage bwLumnisity = img.ToGrayScale(2, MyImage.grayFilterType.LUMINOSITY);
            bwLumnisity.Save("bwLumnosity.bmp");
            MyImage bwLinear = img.ToGrayScale(2, MyImage.grayFilterType.LINEAR);
            bwLinear.Save("bwLinear.bmp");
            Console.WriteLine("Done");*/

            /*int[,] convFilter = new int[,]
            {
                { 0, 0, 0 },
                { 0, 0, 7 },
                { 3, 5, 1 }
            };
            MyImage conv = img.ApplyConvFilter(convFilter, (1.0 / 16.0));
            conv.Save("dither.bmp");
            Console.WriteLine("Done");*/
            #endregion
        }
    }
}
