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 ImageClearRect {
010    
011            public static String call(PageContext pc, Object name, double x, double y, double width, double height) throws PageException {
012                    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
013                    Image img = Image.toImage(name);
014                    
015    
016                    if (width < 0)
017                        throw new FunctionException(pc,"ImageClearRect",3,"width","width must contain a none negative value");
018                    if (height < 0)
019                        throw new FunctionException(pc,"ImageClearRect",4,"height","width must contain a none negative value");
020                    
021                    img.clearRect((int)x, (int)y, (int)width, (int)height);
022                    return null;
023            }
024            
025    }