001    package railo.runtime.functions.image;
002    
003    import railo.runtime.PageContext;
004    import railo.runtime.exp.FunctionException;
005    import railo.runtime.exp.PageException;
006    import railo.runtime.img.Image;
007    import railo.runtime.op.Caster;
008    
009    public class ImageBlur {
010    
011            public static String call(PageContext pc, Object name) throws PageException {
012                    return call(pc,name,3d);
013            }
014            
015            public static String call(PageContext pc, Object name, double blurFactor) throws PageException {
016                    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
017                    Image img = Image.toImage(name);
018                    if(blurFactor<3 || blurFactor>10)
019                            throw new FunctionException(pc,"ImageBlur",2,"blurFactor","invalid value ["+Caster.toString(blurFactor)+"], value have to be between 3 and 10");
020                    img.blur((int)blurFactor);
021                    return null;
022            }
023    }