Пример #1
0
        /// <summary>
        /// Runs the filter on the image using the specific filter
        /// type's ProcessBlock method.
        /// </summary>
        private void RunFilter(String filter, EffectParameters param, ref FloatToInt[] input, ref FloatToInt[] output, int length)
        {
            switch (filter)
            {
            case "Echo":
                Echo echo = new Echo((EchoParameters)param);
                echo.ProcessBlock(ref input, ref output, input.Length);
                break;

            case "Amplify":
                Amplify amplify = new Amplify((AmplifyParameters)param);
                amplify.ProcessBlock(ref input, ref output, input.Length);
                break;

            case "Bass Boost":
                BassBoost BassBoost = new BassBoost((BassBoostParameters)param);
                BassBoost.ProcessBlock(ref input, ref output, input.Length);
                break;

            case "Phaser":
                Phaser Phaser = new Phaser((PhaserParameters)param);
                Phaser.ProcessBlock(ref input, ref output, input.Length);
                break;

            case "Fade In":
                FadeIn FadeIn = new FadeIn((FadeInParameters)param);
                FadeIn.ProcessBlock(ref input, ref output, input.Length);
                break;

            case "Fade Out":
                FadeOut FadeOut = new FadeOut((FadeOutParameters)param);
                FadeOut.ProcessBlock(ref input, ref output, input.Length);
                break;

            case "Distortion":
                Distortion distortion = new Distortion((DistortionParameters)param);
                distortion.ProcessBlock(ref input, ref output, input.Length);
                break;

            default:
                StatusText.Content = "Invalid filter";
                break;
            }
        }