Package railo.runtime.img

Examples of railo.runtime.img.Image


    return call(pc, name, shear, direction,"nearest");
  }
 
  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(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;
  }
View Full Code Here


public class ImageSetDrawingAlpha {

  public static String call(PageContext pc, Object name, double alpha) throws PageException {
    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(name);
   
    if(alpha<0 || alpha>1)
      throw new FunctionException(pc,"ImageSetDrawingAlpha",2,"alpha","alpha must be a value between 0 and 1");
     
   
    img.setAlpha((float)alpha);
    return null;
  }
View Full Code Here

    return call(pc,name,3d);
  }
 
  public static String call(PageContext pc, Object name, double blurFactor) throws PageException {
    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(name);
    if(blurFactor<3 || blurFactor>10)
      throw new FunctionException(pc,"ImageBlur",2,"blurFactor","invalid value ["+Caster.toString(blurFactor)+"], value have to be between 3 and 10");
    img.blur((int)blurFactor);
    return null;
  }
View Full Code Here

public class ImageGetEXIFTag {

  public static Object call(PageContext pc, Object name, String tagName) throws PageException {
    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(name);
   
    Struct data = ImageGetEXIFMetadata.getData(img);
    Object value = data.get(tagName, null);
    if(value==null){
      throw new FunctionException(pc, "ImageGetEXIFTag", 2, "tagName", ExceptionUtil.similarKeyMessage(data,tagName,"tag","tags",true));
View Full Code Here

public class ImageRotateDrawingAxis implements Function {

  public static String call(PageContext pc, Object name, double angle) throws PageException {
    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(name);
   
    img.rotateAxis(angle);
    return null;
   
  }
View Full Code Here

    return call(pc, name, angle, x, 0);
  }

  public static String call(PageContext pc, Object name, double angle, double x, double y) throws PageException {
    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(name);
   
    img.rotateAxis(angle, x, y);
    return null;
   
  }
View Full Code Here

public class ImageSetDrawingColor {

  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(name);
   
    Color color = ColorCaster.toColor(strColor);
   
    img.setColor(color);
    return null;
  }
View Full Code Here

public class ImageNew {


  public static Object call(PageContext pc) {
    return new Image();
  }
View Full Code Here

    // canvas color
    Color canvasColor;
    if(StringUtil.isEmpty(strCanvasColor,true)) canvasColor=null;
    else canvasColor=ColorCaster.toColor(strCanvasColor);
   
    return new Image(Caster.toIntValue(width),Caster.toIntValue(height), imageType,canvasColor);
  }
View Full Code Here

    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(name);
    image.addBorder((int)thickness,ColorCaster.toColor(color),borderType);
   
   
    return null;
  }
View Full Code Here

TOP

Related Classes of railo.runtime.img.Image

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.