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 ImageDrawRoundRect {
010    
011            public static String call(PageContext pc, Object name, double x, double y, double width,double height,
012                            double arcWidth, double arcHeight) throws PageException {
013                    return call(pc, name, x, y, width, height,arcWidth,arcHeight,false);
014            }
015            public static String call(PageContext pc, Object name, double x, double y, double width,double height, 
016                            double arcWidth, double arcHeight, boolean filled) throws PageException {
017                    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
018                    Image img = Image.toImage(name);
019                    
020                    if (width < 0)
021                        throw new FunctionException(pc,"ImageDrawRoundRect",3,"width","width must contain a none negative value");
022                    if (height < 0)
023                        throw new FunctionException(pc,"ImageDrawRoundRect",4,"height","width must contain a none negative value");
024                    if (arcWidth < 0)
025                        throw new FunctionException(pc,"ImageDrawRoundRect",5,"arcWidth","arcWidth must contain a none negative value");
026                    if (arcHeight < 0)
027                        throw new FunctionException(pc,"ImageDrawRoundRect",6,"arcHeight","arcHeight must contain a none negative value");
028                    
029                    img.drawRoundRect((int)x, (int)y, (int)width, (int)height,(int)arcWidth,(int)arcHeight, filled);
030                    return null;
031            }
032            
033    }