use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class LookupFilter 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("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 [Colormap, Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class MapColorsFilter 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 MapFilter 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("XMapFunction"))) != null)
setXMapFunction(ImageFilterUtil.toFunction2D(o, "XMapFunction"));
if ((o = parameters.removeEL(KeyImpl.init("YMapFunction"))) != null)
setYMapFunction(ImageFilterUtil.toFunction2D(o, "YMapFunction"));
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 [XMapFunction, YMapFunction, EdgeAction, Interpolation]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class MarbleFilter 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("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("XScale"))) != null)
setXScale(ImageFilterUtil.toFloatValue(o, "XScale"));
if ((o = parameters.removeEL(KeyImpl.init("YScale"))) != null)
setYScale(ImageFilterUtil.toFloatValue(o, "YScale"));
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 [Amount, Turbulence, XScale, YScale, EdgeAction, Interpolation]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class MarbleTexFilter 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("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("TurbulenceFactor"))) != null)
setTurbulenceFactor(ImageFilterUtil.toFloatValue(o, "TurbulenceFactor"));
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 [Colormap, Turbulence, Stretch, Angle, TurbulenceFactor, Scale, Dimensions]");
}
return filter(src, dst);
}
Aggregations