use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class VariableBlurFilter 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("Iterations"))) != null)
setIterations(ImageFilterUtil.toIntValue(o, "Iterations"));
if ((o = parameters.removeEL(KeyImpl.init("HRadius"))) != null)
setHRadius(ImageFilterUtil.toIntValue(o, "HRadius"));
if ((o = parameters.removeEL(KeyImpl.init("VRadius"))) != null)
setVRadius(ImageFilterUtil.toIntValue(o, "VRadius"));
if ((o = parameters.removeEL(KeyImpl.init("Radius"))) != null)
setRadius(ImageFilterUtil.toIntValue(o, "Radius"));
if ((o = parameters.removeEL(KeyImpl.init("BlurMask"))) != null)
setBlurMask(ImageFilterUtil.toBufferedImage(o, "BlurMask"));
// 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, Iterations, HRadius, VRadius, Radius, BlurMask]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class WarpFilter 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("SourceGrid"))) != null)
setSourceGrid(ImageFilterUtil.toWarpGrid(o, "SourceGrid"));
if ((o = parameters.removeEL(KeyImpl.init("DestGrid"))) != null)
setDestGrid(ImageFilterUtil.toWarpGrid(o, "DestGrid"));
if ((o = parameters.removeEL(KeyImpl.init("Frames"))) != null)
setFrames(ImageFilterUtil.toIntValue(o, "Frames"));
if ((o = parameters.removeEL(KeyImpl.init("MorphImage"))) != null)
setMorphImage(ImageFilterUtil.toBufferedImage(o, "MorphImage"));
if ((o = parameters.removeEL(KeyImpl.init("Time"))) != null)
setTime(ImageFilterUtil.toFloatValue(o, "Time"));
// 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 [SourceGrid, DestGrid, Frames, MorphImage, Time]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class WaterFilter 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("Radius"))) != null)
setRadius(ImageFilterUtil.toFloatValue(o, "Radius"));
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("Wavelength"))) != null)
setWavelength(ImageFilterUtil.toFloatValue(o, "Wavelength"));
if ((o = parameters.removeEL(KeyImpl.init("Amplitude"))) != null)
setAmplitude(ImageFilterUtil.toFloatValue(o, "Amplitude"));
if ((o = parameters.removeEL(KeyImpl.init("Phase"))) != null)
setPhase(ImageFilterUtil.toFloatValue(o, "Phase"));
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 [Radius, CentreX, CentreY, Centre, Wavelength, Amplitude, Phase, EdgeAction, Interpolation]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class WeaveFilter 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("UseImageColors"))) != null)
setUseImageColors(ImageFilterUtil.toBooleanValue(o, "UseImageColors"));
if ((o = parameters.removeEL(KeyImpl.init("XGap"))) != null)
setXGap(ImageFilterUtil.toFloatValue(o, "XGap"));
if ((o = parameters.removeEL(KeyImpl.init("XWidth"))) != null)
setXWidth(ImageFilterUtil.toFloatValue(o, "XWidth"));
if ((o = parameters.removeEL(KeyImpl.init("YWidth"))) != null)
setYWidth(ImageFilterUtil.toFloatValue(o, "YWidth"));
if ((o = parameters.removeEL(KeyImpl.init("YGap"))) != null)
setYGap(ImageFilterUtil.toFloatValue(o, "YGap"));
if ((o = parameters.removeEL(KeyImpl.init("Crossings"))) != null)
setCrossings(ImageFilterUtil.toAAInt(o, "Crossings"));
if ((o = parameters.removeEL(KeyImpl.init("RoundThreads"))) != null)
setRoundThreads(ImageFilterUtil.toBooleanValue(o, "RoundThreads"));
if ((o = parameters.removeEL(KeyImpl.init("ShadeCrossings"))) != null)
setShadeCrossings(ImageFilterUtil.toBooleanValue(o, "ShadeCrossings"));
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 [UseImageColors, XGap, XWidth, YWidth, YGap, Crossings, RoundThreads, ShadeCrossings, Dimensions]");
}
return filter(src, dst);
}
use of lucee.runtime.exp.FunctionException in project Lucee by lucee.
the class BlockFilter 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("BlockSize"))) != null)
setBlockSize(ImageFilterUtil.toIntValue(o, "BlockSize"));
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 [BlockSize, EdgeAction, Interpolation]");
}
return filter(src, dst);
}
Aggregations