use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class BlurFilter 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 BumpFilter 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 CellularFilter 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("Colormap"))) != null)
setColormap(ImageFilterUtil.toColormap(o, "Colormap"));
if ((o = parameters.removeEL(KeyImpl.init("Amount"))) != null)
setAmount(ImageFilterUtil.toFloatValue(o, "Amount"));
if ((o = parameters.removeEL(KeyImpl.init("Turbulence"))) != null)
setTurbulence(ImageFilterUtil.toFloatValue(o, "Turbulence"));
if ((o = parameters.removeEL(KeyImpl.init("Stretch"))) != null)
setStretch(ImageFilterUtil.toFloatValue(o, "Stretch"));
if ((o = parameters.removeEL(KeyImpl.init("Angle"))) != null)
setAngle(ImageFilterUtil.toFloatValue(o, "Angle"));
if ((o = parameters.removeEL(KeyImpl.init("AngleCoefficient"))) != null)
setAngleCoefficient(ImageFilterUtil.toFloatValue(o, "AngleCoefficient"));
if ((o = parameters.removeEL(KeyImpl.init("GradientCoefficient"))) != null)
setGradientCoefficient(ImageFilterUtil.toFloatValue(o, "GradientCoefficient"));
if ((o = parameters.removeEL(KeyImpl.init("F1"))) != null)
setF1(ImageFilterUtil.toFloatValue(o, "F1"));
if ((o = parameters.removeEL(KeyImpl.init("F2"))) != null)
setF2(ImageFilterUtil.toFloatValue(o, "F2"));
if ((o = parameters.removeEL(KeyImpl.init("F3"))) != null)
setF3(ImageFilterUtil.toFloatValue(o, "F3"));
if ((o = parameters.removeEL(KeyImpl.init("F4"))) != null)
setF4(ImageFilterUtil.toFloatValue(o, "F4"));
if ((o = parameters.removeEL(KeyImpl.init("Randomness"))) != null)
setRandomness(ImageFilterUtil.toFloatValue(o, "Randomness"));
if ((o = parameters.removeEL(KeyImpl.init("GridType"))) != null)
setGridType(ImageFilterUtil.toString(o, "GridType"));
if ((o = parameters.removeEL(KeyImpl.init("DistancePower"))) != null)
setDistancePower(ImageFilterUtil.toFloatValue(o, "DistancePower"));
if ((o = parameters.removeEL(KeyImpl.init("Scale"))) != null)
setScale(ImageFilterUtil.toFloatValue(o, "Scale"));
// 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 [Colormap, Amount, Turbulence, Stretch, Angle, Coefficient, AngleCoefficient, GradientCoefficient, F1, F2, F3, F4, Randomness, GridType, DistancePower, Scale]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class CheckFilter 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("Angle"))) != null)
setAngle(ImageFilterUtil.toFloatValue(o, "Angle"));
if ((o = parameters.removeEL(KeyImpl.init("XScale"))) != null)
setXScale(ImageFilterUtil.toIntValue(o, "XScale"));
if ((o = parameters.removeEL(KeyImpl.init("YScale"))) != null)
setYScale(ImageFilterUtil.toIntValue(o, "YScale"));
if ((o = parameters.removeEL(KeyImpl.init("Fuzziness"))) != null)
setFuzziness(ImageFilterUtil.toIntValue(o, "Fuzziness"));
if ((o = parameters.removeEL(KeyImpl.init("Foreground"))) != null)
setForeground(ImageFilterUtil.toColorRGB(o, "Foreground"));
if ((o = parameters.removeEL(KeyImpl.init("Background"))) != null)
setBackground(ImageFilterUtil.toColorRGB(o, "Background"));
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 [Angle, XScale, YScale, Fuzziness, Foreground, Background, Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ChromaKeyFilter 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("HTolerance"))) != null)
setHTolerance(ImageFilterUtil.toFloatValue(o, "HTolerance"));
if ((o = parameters.removeEL(KeyImpl.init("STolerance"))) != null)
setSTolerance(ImageFilterUtil.toFloatValue(o, "STolerance"));
if ((o = parameters.removeEL(KeyImpl.init("BTolerance"))) != null)
setBTolerance(ImageFilterUtil.toFloatValue(o, "BTolerance"));
if ((o = parameters.removeEL(KeyImpl.init("Color"))) != null)
setColor(ImageFilterUtil.toIntValue(o, "Color"));
// 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 [HTolerance, STolerance, BTolerance, Color]");
}
return filter(src, dst);
}
Aggregations