Source Code

Blur (Sub-Pixel)

Blurs images.

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

@version 2.5
@warnings
@script image

Amount,Percent;

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

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] + RGBPixel(ifo.red[j,i],ifo.red[j - 1,i],Percent)) / 2;
            ifo.green[j,i] = (ifo.green[j,i] + RGBPixel(ifo.green[j,i],ifo.green[j - 1,i],Percent)) / 2;
            ifo.blue[j,i] = (ifo.blue[j,i] + RGBPixel(ifo.blue[j,i],ifo.blue[j - 1,i],Percent)) / 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] + RGBPixel(ifo.red[j,i],ifo.red[j + 1,i],Percent)) / 2;
            ifo.green[j,i] = (ifo.green[j,i] + RGBPixel(ifo.green[j,i],ifo.green[j + 1,i],Percent)) / 2;
            ifo.blue[j,i] = (ifo.blue[j,i] + RGBPixel(ifo.blue[j,i],ifo.blue[j + 1,i],Percent)) / 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] + RGBPixel(ifo.red[j,i],ifo.red[j,i - 1],Percent)) / 2;
            ifo.green[j,i] = (ifo.green[j,i] + RGBPixel(ifo.green[j,i],ifo.green[j,i - 1],Percent)) / 2;
            ifo.blue[j,i] = (ifo.blue[j,i] + RGBPixel(ifo.blue[j,i],ifo.blue[j,i - 1],Percent)) / 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] + RGBPixel(ifo.red[j,i],ifo.red[j,i + 1],Percent)) / 2;
            ifo.green[j,i] = (ifo.green[j,i] + RGBPixel(ifo.green[j,i],ifo.green[j,i + 1],Percent)) / 2;
            ifo.blue[j,i] = (ifo.blue[j,i] + RGBPixel(ifo.blue[j,i],ifo.blue[j,i + 1],Percent)) / 2;
        }
    }

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

}
}

RGBPixel: RGBa, RGBb, Percent
{
  Temp = (RGBb - RGBa) * 0.01;
  Temp = RGBa + (Temp * Percent);
  return(Temp);
}

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

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

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