Beispiel #1
0
        private void sortHButton_Click(object sender, EventArgs e)
        {
            progressBar.Value = 15;

            if (Image == null)
            {
                return;
            }
            else
            {
                Image.Lock(); // make sure the pixels are locked
            }
            if (Threshold == 255)
            {
                PixelSorter.SortHorizontals(Image);
            }
            else
            {
                PixelSorter.SortHorizontalsBelowThreshold(Image, Threshold);
            }

            progressBar.Value = 80;

            SaveTemp();
            previewBox.ImageLocation = TempImagePath;
            previewBox.Update();

            progressBar.Value = 100;
        }
Beispiel #2
0
        private void dangerZone_Click(object sender, EventArgs e)
        {
            progressBar.Value = 15;

            System.Diagnostics.Stopwatch watch  = new System.Diagnostics.Stopwatch();
            System.Diagnostics.Stopwatch watch2 = new System.Diagnostics.Stopwatch();

            Image = new PixelWrapper(ImagePath, false);
            Image.Load(ImagePath);

            watch.Start();
            UnsafePixelSorter.SortWhole(Image);
            watch.Stop();

            Image = new PixelWrapper(ImagePath);

            watch2.Start();
            PixelSorter.SortWhole(Image);
            watch2.Stop();

            MessageBox.Show("Unsafe: " + watch.ElapsedMilliseconds + ". Safe: " + watch2.ElapsedMilliseconds);

            SaveTemp();
            previewBox.ImageLocation = TempImagePath;
            previewBox.Update();

            progressBar.Value = 100;
        }