use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ErodeFilter 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("Threshold"))) != null)
setThreshold(ImageFilterUtil.toIntValue(o, "Threshold"));
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 [Threshold, Iterations, Colormap, NewColor, BlackFunction]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ExposureFilter 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("Exposure"))) != null)
setExposure(ImageFilterUtil.toFloatValue(o, "Exposure"));
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 [Exposure, Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class FBMFilter 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("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("BasisType"))) != null)
setBasisType(ImageFilterUtil.toIntValue(o, "BasisType"));
if ((o = parameters.removeEL(KeyImpl.init("Operation"))) != null)
setOperation(ImageFilterUtil.toIntValue(o, "Operation"));
if ((o = parameters.removeEL(KeyImpl.init("Octaves"))) != null)
setOctaves(ImageFilterUtil.toFloatValue(o, "Octaves"));
if ((o = parameters.removeEL(KeyImpl.init("H"))) != null)
setH(ImageFilterUtil.toFloatValue(o, "H"));
if ((o = parameters.removeEL(KeyImpl.init("Lacunarity"))) != null)
setLacunarity(ImageFilterUtil.toFloatValue(o, "Lacunarity"));
if ((o = parameters.removeEL(KeyImpl.init("Gain"))) != null)
setGain(ImageFilterUtil.toFloatValue(o, "Gain"));
if ((o = parameters.removeEL(KeyImpl.init("Bias"))) != null)
setBias(ImageFilterUtil.toFloatValue(o, "Bias"));
if ((o = parameters.removeEL(KeyImpl.init("Basis"))) != null)
setBasis(ImageFilterUtil.toFunction2D(o, "Basis"));
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, Amount, Stretch, Angle, BasisType, Operation, Octaves, H, Lacunarity, Gain, Bias, Basis, Scale, Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class FadeFilter 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("Sides"))) != null)
setSides(ImageFilterUtil.toIntValue(o, "Sides"));
if ((o = parameters.removeEL(KeyImpl.init("FadeStart"))) != null)
setFadeStart(ImageFilterUtil.toFloatValue(o, "FadeStart"));
if ((o = parameters.removeEL(KeyImpl.init("FadeWidth"))) != null)
setFadeWidth(ImageFilterUtil.toFloatValue(o, "FadeWidth"));
if ((o = parameters.removeEL(KeyImpl.init("Invert"))) != null)
setInvert(ImageFilterUtil.toBooleanValue(o, "Invert"));
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, Sides, FadeStart, FadeWidth, Invert, Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class FeedbackFilter 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("Angle"))) != null)
setAngle(ImageFilterUtil.toFloatValue(o, "Angle"));
if ((o = parameters.removeEL(KeyImpl.init("CentreX"))) != null)
setCentreX(ImageFilterUtil.toFloatValue(o, "CentreX"));
if ((o = parameters.removeEL(KeyImpl.init("CentreY"))) != null)
setCentreY(ImageFilterUtil.toFloatValue(o, "CentreY"));
// if((o=parameters.removeEL(KeyImpl.init("Centre")))!=null)setCentre(ImageFilterUtil.toPoint2D(o,"Centre"));
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("StartAlpha"))) != null)
setStartAlpha(ImageFilterUtil.toFloatValue(o, "StartAlpha"));
if ((o = parameters.removeEL(KeyImpl.init("EndAlpha"))) != null)
setEndAlpha(ImageFilterUtil.toFloatValue(o, "EndAlpha"));
// 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, Angle, CentreX, CentreY, Centre, Distance, Rotation, Zoom, StartAlpha, EndAlpha]");
}
return filter(src, dst);
}
Aggregations