Exemple #1
0
        private void UpdateBitmap()
        {
            lock (bitmapLock)
            {
                ImageSource = (Bitmap)baseImageSource.Clone();

                if (isNegative)
                {
                    ImageSource.ApplyTransformation(new Negative());
                }
                if (isGray)
                {
                    ImageSource.ApplyTransformation(new Grayscale());
                }

                if (brightness != 0)
                {
                    ImageSource.ApplyTransformation(new Brightness(brightness));
                }
                if (contrast != 0)
                {
                    ImageSource.ApplyTransformation(new Contrast(contrast));
                }
                if (isBlur)
                {
                    ImageSource.ApplyTransformation(isGauss ? (IImageProcessAlgorithm) new GaussianFilter(blurFilterValue + 1) : new LowpassFilter(blurFilterValue));
                }
                if (isEdgeDetection)
                {
                    ImageSource.ApplyTransformation(isSobel ? (IImageProcessAlgorithm) new SobelEdgeDetection() : new RobertsEdgeDetection());
                }

                UpdateHistogram();
                UpdateProjection();
            }
        }