Links

Categories

Tags


« | Main | »

Bloom Effect (blur shader)

By Jewe | May 12, 2014

A bloom effect (IrfanView Filter Sandbox 1.0)

class Bloom : Effect
{
    Slider Radius, Quality, Strength;

    method Bloom()
    {
        Radius = new Slider("Blur Radius", " Pixel", 0, 1, 10, 5);
        Quality = new Slider("Blur Quality", " Q", 0, 1, 10, 5);
        Strength = new Slider("Bloom Strength", "%", 0, 0, 100, 50);
    }

    method EffectInfo   GetEffectInfo() { return new EffectInfo("Bloom", "by Jewe", "Applies a
 'bloom' (blur shader) effect on the image."); }
    method Parameter[]  GetParameters() { return { Radius, Quality, Strength }; }

    method DoEffect(Image img)
    {
        // get a rasterizer for the entire image
        RasterizerRGB pic1 = new RasterizerRGB(img);
        RasterizerRGB pic2 = new RasterizerRGB(img);
        RasterizerRGB blur = new RasterizerRGB(img);
        // blur the image
        blur.FxBlurRect(img.Rectangle, Radius.Value, Quality.Value);
        pic1.FxBitmap(blur, img.Rectangle, new Point(), kBlendScreen, 0, null);
        // apply with alpha blending on original image
        pic2.FxBitmap(pic1, img.Rectangle, new Point(), kBlendAlpha, Strength.Value * 2.55, null);
        // finalize
        pic2.Finalize();
    }
}

Topics: code examples, filter sandbox | Comments Off on Bloom Effect (blur shader)

Comments are closed.