use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ShapeFilter method filter.
@Override
public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
BufferedImage dst = ImageUtil.createBufferedImage(src);
Object o;
if ((o = parameters.removeEL(KeyImpl.init("UseAlpha"))) != null)
setUseAlpha(ImageFilterUtil.toBooleanValue(o, "UseAlpha"));
if ((o = parameters.removeEL(KeyImpl.init("Colormap"))) != null)
setColormap(ImageFilterUtil.toColormap(o, "Colormap"));
if ((o = parameters.removeEL(KeyImpl.init("Invert"))) != null)
setInvert(ImageFilterUtil.toBooleanValue(o, "Invert"));
if ((o = parameters.removeEL(KeyImpl.init("Factor"))) != null)
setFactor(ImageFilterUtil.toFloatValue(o, "Factor"));
if ((o = parameters.removeEL(KeyImpl.init("Merge"))) != null)
setMerge(ImageFilterUtil.toBooleanValue(o, "Merge"));
if ((o = parameters.removeEL(KeyImpl.init("Type"))) != null)
setType(ImageFilterUtil.toIntValue(o, "Type"));
// check for arguments not supported
if (parameters.size() > 0) {
throw new FunctionException(ThreadLocalPageContext.get(), "ImageFilter", 3, "parameters", "the parameter" + (parameters.size() > 1 ? "s" : "") + " [" + CollectionUtil.getKeyList(parameters, ", ") + "] " + (parameters.size() > 1 ? "are" : "is") + " not allowed, only the following parameters are supported [UseAlpha, Colormap, Invert, Factor, Merge, Type]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class SharpenFilter method filter.
@Override
public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
BufferedImage dst = ImageUtil.createBufferedImage(src);
Object o;
if ((o = parameters.removeEL(KeyImpl.init("EdgeAction"))) != null)
setEdgeAction(ImageFilterUtil.toString(o, "EdgeAction"));
if ((o = parameters.removeEL(KeyImpl.init("UseAlpha"))) != null)
setUseAlpha(ImageFilterUtil.toBooleanValue(o, "UseAlpha"));
if ((o = parameters.removeEL(KeyImpl.init("PremultiplyAlpha"))) != null)
setPremultiplyAlpha(ImageFilterUtil.toBooleanValue(o, "PremultiplyAlpha"));
// check for arguments not supported
if (parameters.size() > 0) {
throw new FunctionException(ThreadLocalPageContext.get(), "ImageFilter", 3, "parameters", "the parameter" + (parameters.size() > 1 ? "s" : "") + " [" + CollectionUtil.getKeyList(parameters, ", ") + "] " + (parameters.size() > 1 ? "are" : "is") + " not allowed, only the following parameters are supported [Kernel, EdgeAction, UseAlpha, PremultiplyAlpha]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ShatterFilter method filter.
@Override
public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
BufferedImage dst = ImageUtil.createBufferedImage(src);
Object o;
if ((o = parameters.removeEL(KeyImpl.init("Iterations"))) != null)
setIterations(ImageFilterUtil.toIntValue(o, "Iterations"));
if ((o = parameters.removeEL(KeyImpl.init("CentreX"))) != null)
setCentreX(ImageFilterUtil.toFloatValue(o, "CentreX"));
if ((o = parameters.removeEL(KeyImpl.init("CentreY"))) != null)
setCentreY(ImageFilterUtil.toFloatValue(o, "CentreY"));
// if((o=parameters.removeEL(KeyImpl.init("Centre")))!=null)setCentre(ImageFilterUtil.toPoint2D(o,"Centre"));
if ((o = parameters.removeEL(KeyImpl.init("Transition"))) != null)
setTransition(ImageFilterUtil.toFloatValue(o, "Transition"));
if ((o = parameters.removeEL(KeyImpl.init("Distance"))) != null)
setDistance(ImageFilterUtil.toFloatValue(o, "Distance"));
if ((o = parameters.removeEL(KeyImpl.init("Rotation"))) != null)
setRotation(ImageFilterUtil.toFloatValue(o, "Rotation"));
if ((o = parameters.removeEL(KeyImpl.init("Zoom"))) != null)
setZoom(ImageFilterUtil.toFloatValue(o, "Zoom"));
if ((o = parameters.removeEL(KeyImpl.init("StartAlpha"))) != null)
setStartAlpha(ImageFilterUtil.toFloatValue(o, "StartAlpha"));
if ((o = parameters.removeEL(KeyImpl.init("EndAlpha"))) != null)
setEndAlpha(ImageFilterUtil.toFloatValue(o, "EndAlpha"));
if ((o = parameters.removeEL(KeyImpl.init("Tile"))) != null)
setTile(ImageFilterUtil.toIntValue(o, "Tile"));
// check for arguments not supported
if (parameters.size() > 0) {
throw new FunctionException(ThreadLocalPageContext.get(), "ImageFilter", 3, "parameters", "the parameter" + (parameters.size() > 1 ? "s" : "") + " [" + CollectionUtil.getKeyList(parameters, ", ") + "] " + (parameters.size() > 1 ? "are" : "is") + " not allowed, only the following parameters are supported [Iterations, CentreX, CentreY, Centre, Transition, Distance, Rotation, Zoom, StartAlpha, EndAlpha, Tile]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ShineFilter method filter.
@Override
public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
BufferedImage dst = ImageUtil.createBufferedImage(src);
Object o;
if ((o = parameters.removeEL(KeyImpl.init("Radius"))) != null)
setRadius(ImageFilterUtil.toFloatValue(o, "Radius"));
if ((o = parameters.removeEL(KeyImpl.init("Brightness"))) != null)
setBrightness(ImageFilterUtil.toFloatValue(o, "Brightness"));
if ((o = parameters.removeEL(KeyImpl.init("Angle"))) != null)
setAngle(ImageFilterUtil.toFloatValue(o, "Angle"));
if ((o = parameters.removeEL(KeyImpl.init("Softness"))) != null)
setSoftness(ImageFilterUtil.toFloatValue(o, "Softness"));
if ((o = parameters.removeEL(KeyImpl.init("Distance"))) != null)
setDistance(ImageFilterUtil.toFloatValue(o, "Distance"));
if ((o = parameters.removeEL(KeyImpl.init("ShadowOnly"))) != null)
setShadowOnly(ImageFilterUtil.toBooleanValue(o, "ShadowOnly"));
if ((o = parameters.removeEL(KeyImpl.init("Bevel"))) != null)
setBevel(ImageFilterUtil.toFloatValue(o, "Bevel"));
if ((o = parameters.removeEL(KeyImpl.init("ShineColor"))) != null)
setShineColor(ImageFilterUtil.toColorRGB(o, "ShineColor"));
// check for arguments not supported
if (parameters.size() > 0) {
throw new FunctionException(ThreadLocalPageContext.get(), "ImageFilter", 3, "parameters", "the parameter" + (parameters.size() > 1 ? "s" : "") + " [" + CollectionUtil.getKeyList(parameters, ", ") + "] " + (parameters.size() > 1 ? "are" : "is") + " not allowed, only the following parameters are supported [Radius, Brightness, Angle, Softness, Distance, ShadowOnly, Bevel, ShineColor]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class SmartBlurFilter method filter.
@Override
public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
BufferedImage dst = ImageUtil.createBufferedImage(src);
Object o;
if ((o = parameters.removeEL(KeyImpl.init("HRadius"))) != null)
setHRadius(ImageFilterUtil.toIntValue(o, "HRadius"));
if ((o = parameters.removeEL(KeyImpl.init("VRadius"))) != null)
setVRadius(ImageFilterUtil.toIntValue(o, "VRadius"));
if ((o = parameters.removeEL(KeyImpl.init("Radius"))) != null)
setRadius(ImageFilterUtil.toIntValue(o, "Radius"));
if ((o = parameters.removeEL(KeyImpl.init("Threshold"))) != null)
setThreshold(ImageFilterUtil.toIntValue(o, "Threshold"));
// check for arguments not supported
if (parameters.size() > 0) {
throw new FunctionException(ThreadLocalPageContext.get(), "ImageFilter", 3, "parameters", "the parameter" + (parameters.size() > 1 ? "s" : "") + " [" + CollectionUtil.getKeyList(parameters, ", ") + "] " + (parameters.size() > 1 ? "are" : "is") + " not allowed, only the following parameters are supported [HRadius, VRadius, Radius, Threshold]");
}
return filter(src, dst);
}
Aggregations