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