Search in sources :

Example 51 with FunctionException

use of lucee.runtime.exp.FunctionException in project Lucee by lucee.

the class ChromeFilter 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("Exposure"))) != null)
        setExposure(ImageFilterUtil.toFloatValue(o, "Exposure"));
    if ((o = parameters.removeEL(KeyImpl.init("ColorSource"))) != null)
        setColorSource(ImageFilterUtil.toColorRGB(o, "ColorSource"));
    if ((o = parameters.removeEL(KeyImpl.init("Material"))) != null)
        setMaterial(ImageFilterUtil.toLightFilter$Material(o, "Material"));
    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("BumpShape"))) != null)
        setBumpShape(ImageFilterUtil.toIntValue(o, "BumpShape"));
    if ((o = parameters.removeEL(KeyImpl.init("ViewDistance"))) != null)
        setViewDistance(ImageFilterUtil.toFloatValue(o, "ViewDistance"));
    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"));
    if ((o = parameters.removeEL(KeyImpl.init("DiffuseColor"))) != null)
        setDiffuseColor(ImageFilterUtil.toColorRGB(o, "DiffuseColor"));
    // 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, Exposure, ColorSource, Material, BumpFunction, BumpHeight, BumpSoftness, BumpShape, ViewDistance, EnvironmentMap, BumpSource, DiffuseColor]");
    }
    return filter(src, dst);
}
Also used : FunctionException(lucee.runtime.exp.FunctionException) BufferedImage(java.awt.image.BufferedImage)

Example 52 with FunctionException

use of lucee.runtime.exp.FunctionException in project Lucee by lucee.

the class ContourFilter 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("Levels"))) != null)
        setLevels(ImageFilterUtil.toFloatValue(o, "Levels"));
    if ((o = parameters.removeEL(KeyImpl.init("ContourColor"))) != null)
        setContourColor(ImageFilterUtil.toColorRGB(o, "ContourColor"));
    if ((o = parameters.removeEL(KeyImpl.init("Offset"))) != null)
        setOffset(ImageFilterUtil.toFloatValue(o, "Offset"));
    if ((o = parameters.removeEL(KeyImpl.init("Scale"))) != null)
        setScale(ImageFilterUtil.toFloatValue(o, "Scale"));
    // 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 [Levels, ContourColor, Offset, Scale]");
    }
    return filter(src, dst);
}
Also used : FunctionException(lucee.runtime.exp.FunctionException) BufferedImage(java.awt.image.BufferedImage)

Example 53 with FunctionException

use of lucee.runtime.exp.FunctionException in project Lucee by lucee.

the class CurlFilter 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("Transition"))) != null)
        setTransition(ImageFilterUtil.toFloatValue(o, "Transition"));
    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, Angle, Transition, EdgeAction, Interpolation]");
    }
    return filter(src, dst);
}
Also used : FunctionException(lucee.runtime.exp.FunctionException) BufferedImage(java.awt.image.BufferedImage)

Example 54 with FunctionException

use of lucee.runtime.exp.FunctionException in project Lucee by lucee.

the class DiffusionFilter 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("Levels"))) != null)
        setLevels(ImageFilterUtil.toIntValue(o, "Levels"));
    if ((o = parameters.removeEL(KeyImpl.init("Matrix"))) != null)
        setMatrix(ImageFilterUtil.toAInt(o, "Matrix"));
    if ((o = parameters.removeEL(KeyImpl.init("Serpentine"))) != null)
        setSerpentine(ImageFilterUtil.toBooleanValue(o, "Serpentine"));
    if ((o = parameters.removeEL(KeyImpl.init("ColorDither"))) != null)
        setColorDither(ImageFilterUtil.toBooleanValue(o, "ColorDither"));
    // 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 [Levels, Matrix, Serpentine, ColorDither]");
    }
    return filter(src, dst);
}
Also used : FunctionException(lucee.runtime.exp.FunctionException) BufferedImage(java.awt.image.BufferedImage)

Example 55 with FunctionException

use of lucee.runtime.exp.FunctionException in project Lucee by lucee.

the class EdgeFilter 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("VEdgeMatrix"))) != null)
        setVEdgeMatrix(ImageFilterUtil.toAFloat(o, "VEdgeMatrix"));
    if ((o = parameters.removeEL(KeyImpl.init("HEdgeMatrix"))) != null)
        setHEdgeMatrix(ImageFilterUtil.toAFloat(o, "HEdgeMatrix"));
    // 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 [VEdgeMatrix, HEdgeMatrix]");
    }
    return filter(src, dst);
}
Also used : FunctionException(lucee.runtime.exp.FunctionException) BufferedImage(java.awt.image.BufferedImage)

Aggregations

FunctionException (lucee.runtime.exp.FunctionException)189 BufferedImage (java.awt.image.BufferedImage)123 Image (lucee.runtime.img.Image)17 Struct (lucee.runtime.type.Struct)13 Array (lucee.runtime.type.Array)12 Resource (lucee.commons.io.res.Resource)10 ArrayList (java.util.ArrayList)7 IOException (java.io.IOException)6 Iterator (java.util.Iterator)6 Query (lucee.runtime.type.Query)6 ForEachQueryIterator (lucee.runtime.type.it.ForEachQueryIterator)6 Enumeration (java.util.Enumeration)5 List (java.util.List)5 ListIterator (java.util.ListIterator)5 ExecutorService (java.util.concurrent.ExecutorService)5 Future (java.util.concurrent.Future)5 Iteratorable (lucee.runtime.type.Iteratorable)5 StringListData (lucee.runtime.type.util.StringListData)5 ArrayImpl (lucee.runtime.type.ArrayImpl)4 StructImpl (lucee.runtime.type.StructImpl)4