Package railo.runtime.img

Examples of railo.runtime.img.Image


public class IsImageFile {

  public static boolean call(PageContext pc, String path) {
    try {
      new Image(ResourceUtil.toResourceExisting(pc, path));
    } catch (Exception e) {
      return false;
    }
    return true;
  }
View Full Code Here


public class ImageGetBufferedImage {

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

  public static String call(PageContext pc, Object name,
      double x1, double y1,
      double ctrlx, double ctrly,
      double x2, double y2) throws PageException {
    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(name);
   
    img.drawQuadraticCurve(x1, y1, ctrlx, ctrly, x2, y2);
    return null;
  }
View Full Code Here

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

public class ImageTranslateDrawingAxis {

  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(name);
   
    img.translateAxis((int)x, (int)y);
    return null;
  }
View Full Code Here

public class ImageCopy {

  public static Object 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(name);
   
    if (width < 0)
        throw new FunctionException(pc,"ImageCopy",3,"width","width must contain a none negative value");
    if (height < 0)
        throw new FunctionException(pc,"ImageCopy",4,"height","width must contain a none negative value");
   
    return img.copy((float)x, (float)y, (float)width, (float)height);
  }
View Full Code Here

      throw new FunctionException(pc,"ImageCopy",7,"dy","when you define dx, you have also to define dy");
    }
   
   
    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(name);
   
    if (width < 0)
        throw new FunctionException(pc,"ImageCopy",3,"width","width must contain a none negative value");
    if (height < 0)
        throw new FunctionException(pc,"ImageCopy",4,"height","width must contain a none negative value");
   
    return img.copy((float)x, (float)y, (float)width, (float)height, (float)dx, (float)dy);
    //return null;
 
View Full Code Here

  public static String call(PageContext pc, Object name) throws PageException {
    return call(pc, name,"on");
  }
  public static String call(PageContext pc, Object name, String strAntialias) throws PageException {
    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(name);
   
    strAntialias=strAntialias.trim().toLowerCase();
    boolean antialias;
    if("on".equals(strAntialias))antialias=true;
    else if("off".equals(strAntialias))antialias=false;
    else antialias=Caster.toBooleanValue(strAntialias);
   
    img.setAntiAliasing(antialias);
    return null;
  }
View Full Code Here

public class ImageCrop {

  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(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;
  }
View Full Code Here

  public static String call(PageContext pc, Object name) throws PageException {
    return call(pc,name,"vertical");
  }
  public static String call(PageContext pc, Object name, String strTranspose) throws PageException {
    if(name instanceof String) name=pc.getVariable(Caster.toString(name));
    Image img = Image.toImage(name);
   
    strTranspose=strTranspose.toLowerCase().trim();
    TransposeType transpose = TransposeDescriptor.FLIP_VERTICAL;
    if("vertical".equals(strTranspose)) transpose=TransposeDescriptor.FLIP_VERTICAL;
    else if("horizontal".equals(strTranspose)) transpose=TransposeDescriptor.FLIP_HORIZONTAL;
    else if("diagonal".equals(strTranspose)) transpose=TransposeDescriptor.FLIP_DIAGONAL;
    else if("antidiagonal".equals(strTranspose)) transpose=TransposeDescriptor.FLIP_ANTIDIAGONAL;
    else if("anti diagonal".equals(strTranspose)) transpose=TransposeDescriptor.FLIP_ANTIDIAGONAL;
    else if("anti-diagonal".equals(strTranspose)) transpose=TransposeDescriptor.FLIP_ANTIDIAGONAL;
    else if("anti_diagonal".equals(strTranspose)) transpose=TransposeDescriptor.FLIP_ANTIDIAGONAL;
    else if("90".equals(strTranspose)) transpose=TransposeDescriptor.ROTATE_90;
    else if("180".equals(strTranspose)) transpose=TransposeDescriptor.ROTATE_180;
    else if("270".equals(strTranspose)) transpose=TransposeDescriptor.ROTATE_270;
    else throw new FunctionException(pc,"ImageFlip",2,"transpose","invalid transpose definition ["+strTranspose+"], " +
        "valid transpose values are [vertical,horizontal,diagonal,90,180,270]");
   
    img.flip(transpose);
    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.