use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class RotateFilter method filter.
@Override
public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
// BufferedImage dst=ImageUtil.createBufferedImage(src,src.getWidth()+400,src.getHeight()+400);
Object o;
if ((o = parameters.removeEL(KeyImpl.init("Angle"))) != null)
setAngle(ImageFilterUtil.toFloatValue(o, "Angle"));
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 [Angle, EdgeAction, Interpolation]");
}
// Rectangle rect = new Rectangle(0, 0, src.getWidth(), src.getHeight());
// transformSpace(rect);
// ImageUtil.createBufferedImage(src,rect.width,rect.height);
BufferedImage dst = null;
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class SaturationFilter 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("Amount"))) != null)
setAmount(ImageFilterUtil.toFloatValue(o, "Amount"));
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 [Amount, Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ScratchFilter method filter.
@Override
public BufferedImage filter(BufferedImage src, Struct parameters) throws PageException {
// ImageUtil.createBufferedImage(src);
BufferedImage dst = src;
Object o;
if ((o = parameters.removeEL(KeyImpl.init("Angle"))) != null)
setAngle(ImageFilterUtil.toFloatValue(o, "Angle"));
if ((o = parameters.removeEL(KeyImpl.init("Density"))) != null)
setDensity(ImageFilterUtil.toFloatValue(o, "Density"));
if ((o = parameters.removeEL(KeyImpl.init("AngleVariation"))) != null)
setAngleVariation(ImageFilterUtil.toFloatValue(o, "AngleVariation"));
if ((o = parameters.removeEL(KeyImpl.init("Length"))) != null)
setLength(ImageFilterUtil.toFloatValue(o, "Length"));
if ((o = parameters.removeEL(KeyImpl.init("Seed"))) != null)
setSeed(ImageFilterUtil.toIntValue(o, "Seed"));
if ((o = parameters.removeEL(KeyImpl.init("Color"))) != null)
setColor(ImageFilterUtil.toColorRGB(o, "Color"));
if ((o = parameters.removeEL(KeyImpl.init("Width"))) != null)
setWidth(ImageFilterUtil.toFloatValue(o, "Width"));
// 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, Density, AngleVariation, Length, Seed, Color, Width]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ShadeFilter 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("BumpFunction"))) != null)
setBumpFunction(ImageFilterUtil.toFunction2D(o, "BumpFunction"));
if ((o = parameters.removeEL(KeyImpl.init("BumpHeight"))) != null)
setBumpHeight(ImageFilterUtil.toFloatValue(o, "BumpHeight"));
if ((o = parameters.removeEL(KeyImpl.init("BumpSoftness"))) != null)
setBumpSoftness(ImageFilterUtil.toFloatValue(o, "BumpSoftness"));
if ((o = parameters.removeEL(KeyImpl.init("EnvironmentMap"))) != null)
setEnvironmentMap(ImageFilterUtil.toBufferedImage(o, "EnvironmentMap"));
if ((o = parameters.removeEL(KeyImpl.init("BumpSource"))) != null)
setBumpSource(ImageFilterUtil.toIntValue(o, "BumpSource"));
// 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 [BumpFunction, BumpHeight, BumpSoftness, EnvironmentMap, BumpSource]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class ShadowFilter 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("Radius"))) != null)
setRadius(ImageFilterUtil.toFloatValue(o, "Radius"));
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("Opacity"))) != null)
setOpacity(ImageFilterUtil.toFloatValue(o, "Opacity"));
if ((o = parameters.removeEL(KeyImpl.init("ShadowColor"))) != null)
setShadowColor(ImageFilterUtil.toColorRGB(o, "ShadowColor"));
if ((o = parameters.removeEL(KeyImpl.init("AddMargins"))) != null)
setAddMargins(ImageFilterUtil.toBooleanValue(o, "AddMargins"));
if ((o = parameters.removeEL(KeyImpl.init("ShadowOnly"))) != null)
setShadowOnly(ImageFilterUtil.toBooleanValue(o, "ShadowOnly"));
// 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 [Radius, Angle, Distance, Opacity, ShadowColor, AddMargins, ShadowOnly]");
}
return filter(src, dst);
}
Aggregations