use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class PolarFilter method filter.
@Override
public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
// ImageUtil.createBufferedImage(src);
BufferedImage dst = null;
Object o;
if ((o = parameters.removeEL(KeyImpl.init("Type"))) != null)
setType(ImageFilterUtil.toString(o, "Type"));
if ((o = parameters.removeEL(KeyImpl.init("EdgeAction"))) != null)
setEdgeAction(ImageFilterUtil.toString(o, "EdgeAction"));
if ((o = parameters.removeEL(KeyImpl.init("Interpolation"))) != null)
setInterpolation(ImageFilterUtil.toString(o, "Interpolation"));
// 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 [Type, EdgeAction, Interpolation]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class PosterizeFilter 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("NumLevels"))) != null)
setNumLevels(ImageFilterUtil.toIntValue(o, "NumLevels"));
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 [NumLevels, Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class QuantizeFilter 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("Serpentine"))) != null)
setSerpentine(ImageFilterUtil.toBooleanValue(o, "Serpentine"));
if ((o = parameters.removeEL(KeyImpl.init("NumColors"))) != null)
setNumColors(ImageFilterUtil.toIntValue(o, "NumColors"));
if ((o = parameters.removeEL(KeyImpl.init("Dither"))) != null)
setDither(ImageFilterUtil.toBooleanValue(o, "Dither"));
// 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 [Serpentine, NumColors, Dither]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class RenderTextFilter 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("Font"))) != null)
setFont(ImageFilterUtil.toFont(o, "Font"));
if ((o = parameters.removeEL(KeyImpl.init("Transform"))) != null)
setTransform(ImageFilterUtil.toAffineTransform(o, "Transform"));
if ((o = parameters.removeEL(KeyImpl.init("Composite"))) != null)
setComposite(ImageFilterUtil.toComposite(o, "Composite"));
if ((o = parameters.removeEL(KeyImpl.init("Paint"))) != null)
setPaint(ImageFilterUtil.toColor(o, "Paint"));
if ((o = parameters.removeEL(KeyImpl.init("Text"))) != null)
setText(ImageFilterUtil.toString(o, "Text"));
// 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 [Font, Transform, Composite, Paint, Text]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class RescaleFilter 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("Scale"))) != null)
setScale(ImageFilterUtil.toFloatValue(o, "Scale"));
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 [Scale, Dimensions]");
}
return filter(src, dst);
}
Aggregations