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;
}
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;
}
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);
}
}
Aggregations