use of lucee.runtime.img.Image in project Lucee by lucee.
the class ImageRotate method _call.
private static String _call(PageContext pc, Object name, float x, float y, float angle, String strInterpolation) throws PageException {
// if(name instanceof String) name=pc.getVariable(Caster.toString(name));
Image img = Image.toImage(pc, name);
strInterpolation = strInterpolation.trim().toLowerCase();
int interpolation;
if ("nearest".equals(strInterpolation))
interpolation = lucee.runtime.img.Image.INTERPOLATION_NEAREST;
else if ("bilinear".equals(strInterpolation))
interpolation = lucee.runtime.img.Image.INTERPOLATION_BILINEAR;
else if ("bicubic".equals(strInterpolation))
interpolation = lucee.runtime.img.Image.INTERPOLATION_BICUBIC;
else if ("none".equals(strInterpolation))
interpolation = lucee.runtime.img.Image.INTERPOLATION_NONE;
else
throw new ExpressionException("invalid interpolation definition [" + strInterpolation + "]," + " valid values are [nearest,bilinear,bicubic]");
img.rotate(x, y, angle, interpolation);
return null;
}
use of lucee.runtime.img.Image in project Lucee by lucee.
the class ImageScaleToFit method call.
public static String call(PageContext pc, Object name, String fitWidth, String fitHeight, String strInterpolation, double blurFactor) throws PageException {
// if(name instanceof String) name=pc.getVariable(Caster.toString(name));
Image img = Image.toImage(pc, name);
img.scaleToFit(fitWidth, fitHeight, strInterpolation, blurFactor);
return null;
}
use of lucee.runtime.img.Image in project Lucee by lucee.
the class ImageSetDrawingColor method call.
public static String call(PageContext pc, Object name, String strColor) throws PageException {
// if(name instanceof String) name=pc.getVariable(Caster.toString(name));
Image img = Image.toImage(pc, name);
Color color = ColorCaster.toColor(strColor);
img.setColor(color);
return null;
}
use of lucee.runtime.img.Image in project Lucee by lucee.
the class ImageSetDrawingStroke method call.
public static String call(PageContext pc, Object name, Struct attributeCollection) throws PageException {
// if(name instanceof String) name=pc.getVariable(Caster.toString(name));
Image img = Image.toImage(pc, name);
img.setDrawingStroke(attributeCollection);
return null;
}
use of lucee.runtime.img.Image in project Lucee by lucee.
the class ImageShear method call.
public static String call(PageContext pc, Object name, double shear, String strDirection, String strInterpolation) throws PageException {
// if(name instanceof String) name=pc.getVariable(Caster.toString(name));
Image img = Image.toImage(pc, name);
// direction
strDirection = strDirection.toLowerCase().trim();
ShearDir direction;
if ("horizontal".equals(strDirection))
direction = ShearDescriptor.SHEAR_HORIZONTAL;
else if ("vertical".equals(strDirection))
direction = ShearDescriptor.SHEAR_VERTICAL;
else
throw new FunctionException(pc, "ImageShear", 3, "direction", "invalid direction definition [" + strDirection + "], " + "valid direction values are [horizontal,vertical]");
// interpolation
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.shear((float) shear, direction, interpolation);
return null;
}
Aggregations