Search in sources :

Example 1 with TransposeType

use of javax.media.jai.operator.TransposeType in project Lucee by lucee.

the class ImageFlip method call.

public static String call(PageContext pc, Object name, String strTranspose) throws PageException {
    // if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(pc, name);
    strTranspose = strTranspose.toLowerCase().trim();
    TransposeType transpose = TransposeDescriptor.FLIP_VERTICAL;
    if ("vertical".equals(strTranspose))
        transpose = TransposeDescriptor.FLIP_VERTICAL;
    else if ("horizontal".equals(strTranspose))
        transpose = TransposeDescriptor.FLIP_HORIZONTAL;
    else if ("diagonal".equals(strTranspose))
        transpose = TransposeDescriptor.FLIP_DIAGONAL;
    else if ("antidiagonal".equals(strTranspose))
        transpose = TransposeDescriptor.FLIP_ANTIDIAGONAL;
    else if ("anti diagonal".equals(strTranspose))
        transpose = TransposeDescriptor.FLIP_ANTIDIAGONAL;
    else if ("anti-diagonal".equals(strTranspose))
        transpose = TransposeDescriptor.FLIP_ANTIDIAGONAL;
    else if ("anti_diagonal".equals(strTranspose))
        transpose = TransposeDescriptor.FLIP_ANTIDIAGONAL;
    else if ("90".equals(strTranspose))
        transpose = TransposeDescriptor.ROTATE_90;
    else if ("180".equals(strTranspose))
        transpose = TransposeDescriptor.ROTATE_180;
    else if ("270".equals(strTranspose))
        transpose = TransposeDescriptor.ROTATE_270;
    else
        throw new FunctionException(pc, "ImageFlip", 2, "transpose", "invalid transpose definition [" + strTranspose + "], " + "valid transpose values are [vertical,horizontal,diagonal,90,180,270]");
    img.flip(transpose);
    return null;
}
Also used : FunctionException(lucee.runtime.exp.FunctionException) TransposeType(javax.media.jai.operator.TransposeType) Image(lucee.runtime.img.Image)

Aggregations

TransposeType (javax.media.jai.operator.TransposeType)1 FunctionException (lucee.runtime.exp.FunctionException)1 Image (lucee.runtime.img.Image)1