Пример #1
0
        public void GaussianBlurRadius11_ShouldBlur()
        {
            preblur = new RenderImage("testGaussianBlur", 1280, 768);
            _gaussianBlur = new GaussianBlur(_resourceManager);

            _gaussianBlur.SetRadius(11);
            _gaussianBlur.SetAmount(2);
            _gaussianBlur.SetSize(new Vector2f(preblur.Width, preblur.Height));

            while (CluwneLib.IsRunning)
            {
                var lastFrameTime = clock.ElapsedTime.AsSeconds();
                clock.Restart();
                _frameEvent = new FrameEventArgs(lastFrameTime);
                CluwneLib.ClearCurrentRendertarget(Color.Black);
                CluwneLib.Screen.DispatchEvents();

                preblur.BeginDrawing(); // set temp as CRT (Current Render Target)
                //preblur.Clear();       //Clear
                sprite = _resourceManager.GetSprite("flashlight_mask");
                sprite.Position = new Vector2f();
                sprite.Draw();
                preblur.EndDrawing();  // set previous rendertarget as CRT (screen in this case)

                //_gaussianBlur.PerformGaussianBlur(preblur); // blur rendertarget

                preblur.Blit(0,0, preblur.Width, preblur.Height,Color.White, BlitterSizeMode.Crop ); // draw blurred nosprite logo

                CluwneLib.Screen.Display();

            }
        }
Пример #2
0
        public void GaussianBlurRadius11_ShouldBlur()
        {
            preblur = new RenderImage("testGaussianBlur", 1280, 768);
            blur = new RenderImage("testGaussianBlur1", 1280, 768);
            _gaussianBlur = new GaussianBlur(_resourceManager);

            _gaussianBlur.SetRadius(11);
            _gaussianBlur.SetAmount(2);
            _gaussianBlur.SetSize(new Size((int)preblur.Width, (int)preblur.Height));

            while (CluwneLib.IsRunning)
            {
                var lastFrameTime = clock.ElapsedTime.AsSeconds();
                clock.Restart();
                _frameEvent = new FrameEventArgs(lastFrameTime);
                CluwneLib.ClearCurrentRendertarget(Color.Black);
                CluwneLib.Screen.DispatchEvents();

                preblur.BeginDrawing(); // set temp as CRT (Current Render Target)
                preblur.Clear();       //Clear
                _resourceManager.GetSprite("AAAA").Draw(); //Draw NoSpritelogo
                preblur.EndDrawing();  // set previous rendertarget as CRT (screen in this case)

                _gaussianBlur.PerformGaussianBlur(preblur); // blur rendertarget

                preblur.Blit(0,0, 1280, 768); // draw blurred nosprite logo

                CluwneLib.Screen.Display();

            }
        }