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 ImageSharpen {
010    
011            public static String call(PageContext pc, Object name) throws PageException {
012                    return call(pc, name,1.0);
013            }
014            public static String call(PageContext pc, Object name, double gain) throws PageException {
015                    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
016                    Image img = Image.toImage(name);
017                    
018                    if (gain < -1.0 || gain > 2.0)
019                        throw new FunctionException(pc,"ImageSharpen",2,"gain","value must be between 1 and 2");
020                    img.sharpen((float)gain);
021                    return null;
022            }
023    }