Пример #1
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var b = new Bitmap(@"c:\share\1425539750793.png");

            using (MemoryStream memory = new MemoryStream())
            {
                //var bitmap = FilterManager.CopyAsGrayscale(b);
                //var bitmap = FilterManager.CopyWithTransparency(b);
                //var bitmap = FilterManager.CopyAsSepiaTone(b);
                //var bitmap = FilterManager.Cartoon(b);
                //var bitmap = FilterManager.FuzzyEdgeBlurFilter(b);
                //var bitmap = FilterManager.MedianFilter(b, 5);
                //var bitmap = FilterManager.AdjustBrightness(b, 50);
                var bitmap = FilterManager.GaussianBlur(b);

                bitmap.Save(memory, ImageFormat.Png);
                memory.Position = 0;
                BitmapImage bitmapImage = new BitmapImage();
                bitmapImage.BeginInit();
                bitmapImage.StreamSource = memory;
                bitmapImage.CacheOption  = BitmapCacheOption.OnLoad;
                bitmapImage.EndInit();
                xImage.Source = bitmapImage;
            }
        }