Beispiel #1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //try
            //{
            GC.AddMemoryPressure(256);
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = fileDialogImageFilter;
            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            FileStream fs = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

            foreach (var p in pictureBoxes)
            {
                p.Image = null;
            }
            AsyncWrapper.WrapSync(loadImg(fs));
            //fs.Close();
            appendLog(String.Format("File {0} opened.", ofd.SafeFileName));

            GC.Collect();
            undo.Clear();
            redo.Clear();
        }
Beispiel #2
0
        private async Task updateOutputRGBGraph()
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            Bitmap[] rgbGraph = await Task <Bitmap[]> .Factory.StartNew(() => Graph.GetRGBGraph(Helper.deepCloneBMP(outputBitmap)));

            GC.Collect();
            pictureBoxOutRGraph.Image = rgbGraph[0];
            pictureBoxOutGGraph.Image = rgbGraph[1];
            pictureBoxOutBGraph.Image = rgbGraph[2];
            GC.Collect();
            pictureBoxOutRonly.Image = await AsyncWrapper.Wrap(() => Graph.GetRGBImage(Helper.deepCloneBMP(outputBitmap), Graph.Color.R));

            GC.Collect();
            pictureBoxOutGonly.Image = await AsyncWrapper.Wrap(() => Graph.GetRGBImage(Helper.deepCloneBMP(outputBitmap), Graph.Color.G));

            GC.Collect();
            pictureBoxOutBonly.Image = await AsyncWrapper.Wrap(() => Graph.GetRGBImage(Helper.deepCloneBMP(outputBitmap), Graph.Color.B));

            GC.Collect();
            this.Invalidate();
            sw.Stop();
            appendLog(String.Format("updateOutputRGBGraph(): {0}ms", sw.ElapsedMilliseconds));
        }
Beispiel #3
0
        private async Task wrapEffect(Func <Bitmap> func)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            clearOutput();
            pushChange(Helper.deepCloneBMP(outputBitmap));
            outputBitmap = await AsyncWrapper.Wrap(func);

            sw.Stop();
            appendLog(String.Format("{0}: {1}ms", func.Method.Name, sw.ElapsedMilliseconds));
            await updateOutputRGBGraph();
        }
Beispiel #4
0
        private async Task updateInputRGBGraph()
        {
            Bitmap[] rgbGraph = await Task <Bitmap[]> .Factory.StartNew(() => Graph.GetRGBGraph(Helper.deepCloneBMP(inputBitmap)));

            GC.Collect();
            pictureBoxInRGraph.Image = rgbGraph[0];
            pictureBoxInGGraph.Image = rgbGraph[1];
            pictureBoxInBGraph.Image = rgbGraph[2];
            pictureBoxInRonly.Image  = await AsyncWrapper.Wrap(() => Graph.GetRGBImage(Helper.deepCloneBMP(inputBitmap), Graph.Color.R));

            pictureBoxInGonly.Image = await AsyncWrapper.Wrap(() => Graph.GetRGBImage(Helper.deepCloneBMP(inputBitmap), Graph.Color.G));

            pictureBoxInBonly.Image = await AsyncWrapper.Wrap(() => Graph.GetRGBImage(Helper.deepCloneBMP(inputBitmap), Graph.Color.B));

            this.Invalidate();
        }