Source Code

Blur

Blurs images.

[source code] [compiled]
//-----------------------------------------
// LScript Image Filter - www.StephenCulley.co.uk - Blur
//

@version 2.5
@warnings
@script image

Amount;

create
{
    Amount = 1;
    setdesc("www.StephenCulley.co.uk - Blur : " + Amount);
}

process: ifo
{

Progress = 4 * Amount;

if(runningUnder() != SCREAMERNET)
    moninit(Progress);

for(h = 1;h <= Amount;++h)
{

    for(i = 1;i <= ifo.height;++i)
    {
        for(j = 2;j <= ifo.width;++j)
        {            
            ifo.red[j,i] = (ifo.red[j,i] + ifo.red[j - 1,i]) / 2;
            ifo.green[j,i] = (ifo.green[j,i] + ifo.green[j - 1,i]) / 2;
            ifo.blue[j,i] = (ifo.blue[j,i] + ifo.blue[j - 1,i]) / 2;
        }
    }

if(runningUnder() != SCREAMERNET)
    if(monstep())
    return;

    for(i = 1;i <= ifo.height;++i)
    {
        for(j = ifo.width - 1;j >= 1;--j)
        {            
            ifo.red[j,i] = (ifo.red[j,i] + ifo.red[j + 1,i]) / 2;
            ifo.green[j,i] = (ifo.green[j,i] + ifo.green[j + 1,i]) / 2;
            ifo.blue[j,i] = (ifo.blue[j,i] + ifo.blue[j + 1,i]) / 2;
        }
    }

if(runningUnder() != SCREAMERNET)
    if(monstep())
    return;

    for(i = 2;i <= ifo.height;++i)
    {
        for(j = 1;j <= ifo.width;++j)
        {            
            ifo.red[j,i] = (ifo.red[j,i] + ifo.red[j,i - 1]) / 2;
            ifo.green[j,i] = (ifo.green[j,i] + ifo.green[j,i - 1]) / 2;
            ifo.blue[j,i] = (ifo.blue[j,i] + ifo.blue[j,i - 1]) / 2;
        }
    }

if(runningUnder() != SCREAMERNET)
    if(monstep())
    return;

    for(i = ifo.height - 1;i >= 1;--i)
    {
        for(j = 1;j <= ifo.width;++j)
        {            
            ifo.red[j,i] = (ifo.red[j,i] + ifo.red[j,i + 1]) / 2;
            ifo.green[j,i] = (ifo.green[j,i] + ifo.green[j,i + 1]) / 2;
            ifo.blue[j,i] = (ifo.blue[j,i] + ifo.blue[j,i + 1]) / 2;
        }
    }

if(runningUnder() != SCREAMERNET)
    if(monstep())
    return;

}
}

load: what,io
{
    if(what == SCENEMODE)
    {
        Amount = integer(io.read());
        setdesc("www.StephenCulley.co.uk - Blur : " + Amount);
    }
}

save: what,io
{
    if(what == SCENEMODE)
    {
        io.writeln(Amount);
    }
}

options
{
    reqbegin("Blur");
    c1 = ctlinteger("Amount",Amount);
    return if !reqpost();
    Amount = getvalue(c1);
    setdesc("www.StephenCulley.co.uk - Blur : " + Amount);
    reqend();
}