Search in sources :

Example 1 with Image

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

the class ImageCrop method call.

public static String call(PageContext pc, Object name, double x, double y, double width, double height) 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, "ImageCrop", 3, "width", "width must contain a none negative value");
    if (height < 0)
        throw new FunctionException(pc, "ImageCrop", 4, "height", "width must contain a none negative value");
    img.crop((float) x, (float) y, (float) width, (float) height);
    return null;
}
Also used : FunctionException(lucee.runtime.exp.FunctionException) Image(lucee.runtime.img.Image)

Example 2 with Image

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

the class ImageDrawBeveledRect method call.

public static String call(PageContext pc, Object name, double x, double y, double width, double height, boolean raised, 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, "ImageDrawBeveledRect", 3, "width", "width must contain a none negative value");
    if (height < 0)
        throw new FunctionException(pc, "ImageDrawBeveledRect", 4, "height", "width must contain a none negative value");
    img.draw3DRect((int) x, (int) y, (int) width, (int) height, raised, filled);
    return null;
}
Also used : FunctionException(lucee.runtime.exp.FunctionException) Image(lucee.runtime.img.Image)

Example 3 with Image

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

the class ImageDrawLine method call.

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

Example 4 with Image

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

the class ImageDrawLines method call.

public static String call(PageContext pc, Object name, Array xcoords, Array ycoords, boolean isPolygon, boolean filled) throws PageException {
    // if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(pc, name);
    if (xcoords.size() != ycoords.size())
        throw new ExpressionException("xcoords and ycoords has not the same size");
    img.drawLines(toIntArray(xcoords), toIntArray(ycoords), isPolygon, filled);
    return null;
}
Also used : Image(lucee.runtime.img.Image) ExpressionException(lucee.runtime.exp.ExpressionException)

Example 5 with Image

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

the class ImageDrawRect method call.

public static String call(PageContext pc, Object name, double x, double y, double width, double height, 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, "ImageDrawRect", 3, "width", "width must contain a none negative value");
    if (height < 0)
        throw new FunctionException(pc, "ImageDrawRect", 4, "height", "width must contain a none negative value");
    img.drawRect((int) x, (int) y, (int) width, (int) height, filled);
    return null;
}
Also used : FunctionException(lucee.runtime.exp.FunctionException) 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