示例#1
0
文件: Program.cs 项目: sm-g/pixels
 static void TestResultingValues(Bitmap image)
 {
     byte[,] table;
     foreach (ImageProcessor.ResultingValue v in Enum.GetValues(typeof(ImageProcessor.ResultingValue)))
     {
         table = ImageProcessor.GetValues(image, v);
         Console.Write(GetTableOfBytes(table));
         Console.ReadLine();
     }
 }
示例#2
0
文件: Program.cs 项目: sm-g/pixels
        static void ProcessPicture(string filename, bool applyFilters, int selectedModeNumber)
        {
            Bitmap picture = GetImageFromFile(filename);

            if (picture == null)
            {
                return;
            }
            string name           = Path.GetFileNameWithoutExtension(filename);
            string extension      = Path.GetExtension(filename);
            string fileInfoString = name + extension + " " + new FileInfo(filename).Length / 1024 + "kB";

            Console.Write(fileInfoString + " ");
            string fileFolder = outFolder + "\\" + name;

            if (!Directory.Exists(fileFolder))
            {
                Directory.CreateDirectory(fileFolder);
            }

            var valueBytes = new Dictionary <ImageProcessor.ResultingValue, byte[, ]>();

            if (selectedModeNumber != -1)
            {
                var mode = (ImageProcessor.ResultingValue)Enum.GetValues(typeof(ImageProcessor.ResultingValue)).GetValue(selectedModeNumber);
                valueBytes.Add(mode, ImageProcessor.GetValues(picture, mode));
            }
            else
            {
                foreach (ImageProcessor.ResultingValue mode in Enum.GetValues(typeof(ImageProcessor.ResultingValue)))
                {
                    valueBytes.Add(mode, ImageProcessor.GetValues(picture, mode));
                }
            }

            if (applyFilters)
            {
                FilterValueBytesToFile(valueBytes, fileFolder, name);
            }
            else
            {
                PrintValueTablesToFile(picture, valueBytes, fileInfoString);
                OutputBorder(picture, valueBytes, fileFolder, name, fileInfoString);
            }
            Console.WriteLine(" ОК");
        }