Package org.zkoss.image.encoder

Examples of org.zkoss.image.encoder.ImageEncoder.encode()


  float quality, boolean encodeAlpha)
  throws IOException {
    ImageEncoder encoder = ImageEncoders.newInstance(getFormat(name));
    encoder.setQuality(quality);
    encoder.setEncodingAlpha(encodeAlpha);
    return new AImage(name, encoder.encode(image));
  }
  /** Encodes an AWT image into a ZK image.
   *
   * @param name The name of the image. The extension of the name must
   * be the format. For example, foo.png and foo.jpeg.
View Full Code Here


     * extension with supported format.
   */
  public static Image encode(String name, RenderedImage image)
  throws IOException {
    ImageEncoder encoder = ImageEncoders.newInstance(getFormat(name));
    return new AImage(name, encoder.encode(image));
  }
  private static String getFormat(String name) {
    final int j = name.lastIndexOf('.');
    if (j < 0)
      throw new IllegalArgumentException("Illegal name: "+name+"\nIt must contain the extension as the format, such as foo.png");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.