Package railo.runtime.img

Examples of railo.runtime.img.Image


public class ImageDrawLine {
 
  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(name);
   
    img.drawLine((int)x1, (int)y1, (int)x2, (int)y2);
    return null;
  }
View Full Code Here


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

public class ImageSetDrawingStroke {

  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(name);
   
   
    img.setDrawingStroke(attributeCollection);
    return null;
  }
View Full Code Here

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

    return call(pc, name, fitWidth, fitHeight, interpolation,1.0);
  }
 
  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(name);
    img.scaleToFit(fitWidth, fitHeight, strInterpolation, blurFactor);
    return null;
  }
View Full Code Here

  public static String call(PageContext pc, Object name, String filterName) throws PageException {
    return call(pc, name, filterName, EMPTY_STRUCT);
  }
  public static String call(PageContext pc, Object name, String filterName, Struct parameters) throws PageException {
    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(name);
    String lcFilterName = filterName.trim().toLowerCase();
   
    // get filter class
    Class clazz = filters.get(lcFilterName);
    if(clazz==null) {
      String[] keys = filters.keySet().toArray(new String[filters.size()]);
      Arrays.sort(keys);
      String list=ListUtil.arrayToList(keys, ", ");
     
      String soundex = StringUtil.soundex(filterName);
      java.util.List<String> similar=new ArrayList<String>();
      for(int i=0;i<keys.length;i++){
        if(StringUtil.soundex(keys[i]).equals(soundex))
          similar.add(keys[i]);
      }
      if(similar.size()>0) {
        list=ListUtil.arrayToList(similar.toArray(new String[similar.size()]), ", ");
        throw new FunctionException(pc, "ImageFilter", 2, "filtername", "invalid filter name ["+filterName+"], did you mean ["+list+"]");
      }
      throw new FunctionException(pc, "ImageFilter", 2, "filtername", "invalid filter name ["+filterName+"], valid filter names are ["+list+"]");
    }
   
    // load filter
    DynFiltering filter=null;
    try {
      filter=(DynFiltering) clazz.newInstance();
    } catch (Throwable t) {
      throw Caster.toPageException(t);
    }
   
    // execute filter
    BufferedImage bi = img.getBufferedImage();
    //BufferedImage empty = bi;//ImageUtil.createBufferedImage(bi);
    img.image(filter.filter(bi, parameters));
   
    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.