use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class MaskFilter 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("Mask"))) != null)
setMask(ImageFilterUtil.toIntValue(o, "Mask"));
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 [Mask, Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class MotionBlurFilter 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("PremultiplyAlpha"))) != null)
setPremultiplyAlpha(ImageFilterUtil.toBooleanValue(o, "PremultiplyAlpha"));
if ((o = parameters.removeEL(KeyImpl.init("Angle"))) != null)
setAngle(ImageFilterUtil.toFloatValue(o, "Angle"));
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("WrapEdges"))) != null)
setWrapEdges(ImageFilterUtil.toBooleanValue(o, "WrapEdges"));
// 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 [PremultiplyAlpha, Angle, Distance, Rotation, Zoom, WrapEdges]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class OffsetFilter 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("XOffset"))) != null)
setXOffset(ImageFilterUtil.toIntValue(o, "XOffset"));
if ((o = parameters.removeEL(KeyImpl.init("YOffset"))) != null)
setYOffset(ImageFilterUtil.toIntValue(o, "YOffset"));
if ((o = parameters.removeEL(KeyImpl.init("Wrap"))) != null)
setWrap(ImageFilterUtil.toBooleanValue(o, "Wrap"));
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 [XOffset, YOffset, Wrap, EdgeAction, Interpolation]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class OpacityFilter 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("Opacity"))) != null)
setOpacity(ImageFilterUtil.toIntValue(o, "Opacity"));
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 [Opacity, Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class OutlineFilter 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("Colormap"))) != null)
setColormap(ImageFilterUtil.toColormap(o, "Colormap"));
if ((o = parameters.removeEL(KeyImpl.init("NewColor"))) != null)
setNewColor(ImageFilterUtil.toColorRGB(o, "NewColor"));
// 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, Colormap, NewColor, BlackFunction]");
}
return filter(src, dst);
}
Aggregations