use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class SparkleFilter 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.toIntValue(o, "Radius"));
if ((o = parameters.removeEL(KeyImpl.init("Amount"))) != null)
setAmount(ImageFilterUtil.toIntValue(o, "Amount"));
if ((o = parameters.removeEL(KeyImpl.init("Randomness"))) != null)
setRandomness(ImageFilterUtil.toIntValue(o, "Randomness"));
if ((o = parameters.removeEL(KeyImpl.init("Rays"))) != null)
setRays(ImageFilterUtil.toIntValue(o, "Rays"));
if ((o = parameters.removeEL(KeyImpl.init("Color"))) != null)
setColor(ImageFilterUtil.toColorRGB(o, "Color"));
if ((o = parameters.removeEL(KeyImpl.init("Dimensions"))) != null) {
int[] dim = ImageFilterUtil.toDimensions(o, "Dimensions");
setDimensions(dim[0], dim[1]);
}
// 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, Amount, Randomness, Rays, Color, Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class StampFilter 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("Softness"))) != null)
setSoftness(ImageFilterUtil.toFloatValue(o, "Softness"));
if ((o = parameters.removeEL(KeyImpl.init("White"))) != null)
setWhite(ImageFilterUtil.toColor(o, "White"));
if ((o = parameters.removeEL(KeyImpl.init("Black"))) != null)
setBlack(ImageFilterUtil.toColor(o, "Black"));
if ((o = parameters.removeEL(KeyImpl.init("Threshold"))) != null)
setThreshold(ImageFilterUtil.toFloatValue(o, "Threshold"));
if ((o = parameters.removeEL(KeyImpl.init("Dimensions"))) != null) {
int[] dim = ImageFilterUtil.toDimensions(o, "Dimensions");
setDimensions(dim[0], dim[1]);
}
// 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, Softness, White, Black, Threshold, Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class TransitionFilter 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("Transition"))) != null)
setTransition(ImageFilterUtil.toFloatValue(o, "Transition"));
if ((o = parameters.removeEL(KeyImpl.init("destination"))) != null)
setDestination(ImageFilterUtil.toBufferedImage(o, "destination"));
// 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 [Transition]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class UnpremultiplyFilter 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("Dimensions"))) != null) {
int[] dim = ImageFilterUtil.toDimensions(o, "Dimensions");
setDimensions(dim[0], dim[1]);
}
// 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 [Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class UnsharpFilter 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("Amount"))) != null)
setAmount(ImageFilterUtil.toFloatValue(o, "Amount"));
if ((o = parameters.removeEL(KeyImpl.init("Threshold"))) != null)
setThreshold(ImageFilterUtil.toIntValue(o, "Threshold"));
if ((o = parameters.removeEL(KeyImpl.init("Radius"))) != null)
setRadius(ImageFilterUtil.toFloatValue(o, "Radius"));
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 [Amount, Threshold, Radius, Kernel, EdgeAction, UseAlpha, PremultiplyAlpha]");
}
return filter(src, dst);
}
Aggregations