Search in sources :

Example 36 with Image

use of lucee.runtime.img.Image in project Lucee by lucee.

the class ImageTranslate method call.

public static String call(PageContext pc, Object name, double xTrans, double yTrans, String strInterpolation) throws PageException {
    // if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(pc, name);
    strInterpolation = strInterpolation.toLowerCase().trim();
    Object interpolation = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
    if ("nearest".equals(strInterpolation))
        interpolation = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
    else if ("bilinear".equals(strInterpolation))
        interpolation = RenderingHints.VALUE_INTERPOLATION_BILINEAR;
    else if ("bicubic".equals(strInterpolation))
        interpolation = RenderingHints.VALUE_INTERPOLATION_BICUBIC;
    else
        throw new FunctionException(pc, "ImageTranslate", 4, "interpolation", "invalid interpolation definition [" + strInterpolation + "], " + "valid interpolation values are [nearest,bilinear,bicubic]");
    img.translate((int) xTrans, (int) yTrans, interpolation);
    return null;
}
Also used : FunctionException(lucee.runtime.exp.FunctionException) Image(lucee.runtime.img.Image)

Example 37 with Image

use of lucee.runtime.img.Image in project Lucee by lucee.

the class ImageTranslateDrawingAxis method call.

public static String call(PageContext pc, Object name, double x, double y) throws PageException {
    // if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(pc, name);
    img.translateAxis((int) x, (int) y);
    return null;
}
Also used : Image(lucee.runtime.img.Image)

Example 38 with Image

use of lucee.runtime.img.Image in project Lucee by lucee.

the class ImageWriteBase64 method call.

public static String call(PageContext pc, Object name, String destination, String format, boolean inHTMLFormat) throws PageException {
    // if(name instanceof String)name=pc.getVariable(Caster.toString(name));
    Image image = Image.toImage(pc, name);
    Resource res = StringUtil.isEmpty(destination) ? image.getSource() : ResourceUtil.toResourceNotExisting(pc, destination);
    try {
        return image.writeBase64(res, format, inHTMLFormat);
    } catch (IOException e) {
        throw Caster.toPageException(e);
    }
}
Also used : Resource(lucee.commons.io.res.Resource) IOException(java.io.IOException) Image(lucee.runtime.img.Image)

Aggregations

Image (lucee.runtime.img.Image)38 FunctionException (lucee.runtime.exp.FunctionException)17 IOException (java.io.IOException)4 Color (java.awt.Color)3 Resource (lucee.commons.io.res.Resource)3 BufferedImage (java.awt.image.BufferedImage)2 ExpressionException (lucee.runtime.exp.ExpressionException)2 Paint (java.awt.Paint)1 Point (java.awt.Point)1 ArrayList (java.util.ArrayList)1 ShearDir (javax.media.jai.operator.ShearDir)1 TransposeType (javax.media.jai.operator.TransposeType)1 PageSource (lucee.runtime.PageSource)1 ConverterException (lucee.runtime.converter.ConverterException)1 Struct (lucee.runtime.type.Struct)1