Search in sources :

Example 21 with Image

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

the class ImageConverter method writeOut.

@Override
public void writeOut(PageContext pc, Object source, OutputStream os) throws ConverterException, IOException {
    try {
        Image img = Image.createImage(pc, source, false, true, true, format);
        img.writeOut(os, format, 1, false);
    } catch (IOException ioe) {
        throw ioe;
    } catch (Exception e) {
        throw ConverterSupport.toConverterException(e);
    }
}
Also used : IOException(java.io.IOException) Image(lucee.runtime.img.Image) ConverterException(lucee.runtime.converter.ConverterException) IOException(java.io.IOException)

Example 22 with Image

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

the class ImageAddBorder method call.

public static String call(PageContext pc, Object name, double thickness, String color, String strBorderType) throws PageException {
    // if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    strBorderType = strBorderType.trim().toLowerCase();
    int borderType = Image.BORDER_TYPE_CONSTANT;
    if ("zero".equals(strBorderType))
        borderType = BorderExtender.BORDER_ZERO;
    else if ("constant".equals(strBorderType))
        borderType = Image.BORDER_TYPE_CONSTANT;
    else if ("copy".equals(strBorderType))
        borderType = BorderExtender.BORDER_COPY;
    else if ("reflect".equals(strBorderType))
        borderType = BorderExtender.BORDER_REFLECT;
    else if ("wrap".equals(strBorderType))
        borderType = BorderExtender.BORDER_WRAP;
    Image image = Image.toImage(pc, name);
    image.addBorder((int) thickness, ColorCaster.toColor(color), borderType);
    return null;
}
Also used : Image(lucee.runtime.img.Image)

Example 23 with Image

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

the class ImageDrawArc method call.

public static String call(PageContext pc, Object name, double x, double y, double width, double height, double startAngle, double arcAngle, boolean filled) throws PageException {
    // if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(pc, name);
    if (width < 0)
        throw new FunctionException(pc, "ImageDrawArc", 3, "width", "width must contain a none negative value");
    if (height < 0)
        throw new FunctionException(pc, "ImageDrawArc", 4, "height", "width must contain a none negative value");
    img.drawArc((int) x, (int) y, (int) width, (int) height, (int) startAngle, (int) arcAngle, filled);
    return null;
}
Also used : FunctionException(lucee.runtime.exp.FunctionException) Image(lucee.runtime.img.Image)

Example 24 with Image

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

the class ImageDrawCubicCurve method call.

public static String call(PageContext pc, Object name, double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, double ctrly2, double x2, double y2) throws PageException {
    // if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(pc, name);
    img.drawCubicCurve(ctrlx1, ctrly1, ctrlx2, ctrly2, x1, y1, x2, y2);
    return null;
}
Also used : Image(lucee.runtime.img.Image)

Example 25 with Image

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

the class ImageDrawImage method call.

public static String call(PageContext pc, Object name, Object image, double x, double y) throws PageException {
    // if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(pc, name);
    img.drawImage(Image.createImage(pc, image, true, false, true, null), (int) x, (int) y);
    return null;
}
Also used : 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