Пример #1
0
        public static WriteableBitmap WriteableBitmapBlur(this WriteableBitmap writeableBitmapOld, int x, int y)
        {
            if ((x & 1) == 0 || (y & 1) == 0)
            {
                return(null);
            }
            var cloneWriteableBitmap = WriteableBitmapExpansion.CopyWriteableBitmap(writeableBitmapOld);

            WriteableBitmapConvolutionExtensions.BoxBlur(cloneWriteableBitmap, x, y);
            cloneWriteableBitmap.Invalidate();
            return(cloneWriteableBitmap);
        }
Пример #2
0
        private void SetImage(string source)
        {
            BitmapImage img1 = new BitmapImage(new Uri(source, UriKind.RelativeOrAbsolute));
            ImageBack.Source = img1;

            img1.CreateOptions = BitmapCreateOptions.None;
            img1.ImageOpened += (s, e) =>
            {
                WriteableBitmap bitmap = new WriteableBitmap(img1);
                WriteableBitmapConvolutionExtensions.BoxBlur(bitmap, 145);

                ImageBackBlur.Source = bitmap;
            };
        }