예제 #1
0
        public void ZoomBlurEffect2()
        {
            var src = GetSourceImage("input.png");

            var effect = new ZoomBlurEffect(50, new Point(-20, 20));

            effect.Render(src);

            Compare(src, "zoomblur2.png");
        }
예제 #2
0
        public void ZoomBlurEffect1()
        {
            var src = GetSourceImage("input.png");

            var effect = new ZoomBlurEffect();

            effect.Render(src);

            Compare(src, "zoomblur1.png");
        }
예제 #3
0
        public System.Windows.Media.Imaging.BitmapSource DoEffect(System.Windows.Media.Imaging.BitmapSource img, int?def)
        {
            ZoomBlurEffect eff = new ZoomBlurEffect();

            if (!def.HasValue)
            {
                eff.BlurAmount = ui.ZoomBlurAmount;
                eff.Center     = ui.ZoomBlurPosition;
            }
            else
            {
                switch (def.Value)
                {
                case 0:
                    eff.BlurAmount = -0.1;
                    break;

                case 1:
                    eff.BlurAmount = 0.1;
                    break;

                case 2:
                    eff.BlurAmount = -0.1;
                    eff.Center     = new System.Windows.Point(0.1, 0.1);
                    break;

                case 3:
                    eff.BlurAmount = -0.1;
                    eff.Center     = new System.Windows.Point(0.9, 0.1);
                    break;

                case 4:
                    eff.BlurAmount = -0.1;
                    eff.Center     = new System.Windows.Point(0.9, 0.9);
                    break;

                case 5:
                    eff.BlurAmount = -0.1;
                    eff.Center     = new System.Windows.Point(0.1, 0.9);
                    break;

                case 6:
                    eff.BlurAmount = 0.1;
                    eff.Center     = new System.Windows.Point(0.1, 0.1);
                    break;

                case 7:
                    eff.BlurAmount = 0.1;
                    eff.Center     = new System.Windows.Point(0.9, 0.1);
                    break;

                case 8:
                    eff.BlurAmount = 0.1;
                    eff.Center     = new System.Windows.Point(0.9, 0.9);
                    break;

                case 9:
                    eff.BlurAmount = 0.1;
                    eff.Center     = new System.Windows.Point(0.1, 0.9);
                    break;
                }
            }

            return(img.UseEffect(eff));
        }