Package nl.captcha.Captcha

Examples of nl.captcha.Captcha.Builder


  public void setTimeout(long timeout) {
    this.timeout = timeout;
  }

  public BufferedImage crateImage() {
    Builder captcha = new Captcha.Builder(width, height);
    if (this.wordRenderer == null) {
      captcha.addText(textProducer);
    } else {
      captcha.addText(textProducer, this.wordRenderer);
    }

    if (producers != null && !producers.isEmpty()) {
      for (Object producer : producers) {
        if (producer instanceof BackgroundProducer) {
          captcha.addBackground((BackgroundProducer) producer);
        } else if (producer instanceof GimpyRenderer) {
          captcha.gimp((GimpyRenderer) producer);
        } else if (producer instanceof NoiseProducer) {
          captcha.addNoise((NoiseProducer) producer);
        }

      }
    }
    if (isBorder()) {
      captcha.addBorder();
    }
    this.captcha = captcha.build();

    return captcha.build().getImage();
  }
View Full Code Here


  public void setProducers(List<Object> producers) {
    this.producers = producers;
  }

  private BufferedImage crateImage(String str) {
    Builder captcha = new Captcha.Builder(width, height);
    if (this.wordRenderer == null) {
      captcha.addText(new CapTextProducer(str));
    } else {
      captcha.addText(new CapTextProducer(str), this.wordRenderer);
    }

    if (producers != null && !producers.isEmpty()) {
      for (Object producer : producers) {
        if (producer instanceof BackgroundProducer) {
          captcha.addBackground((BackgroundProducer) producer);
        } else if (producer instanceof GimpyRenderer) {
          captcha.gimp((GimpyRenderer) producer);
        } else if (producer instanceof NoiseProducer) {
          captcha.addNoise((NoiseProducer) producer);
        }

      }
    }
    if (isBorder()) {
      captcha.addBorder();
    }
    return captcha.build().getImage();
  }
View Full Code Here

TOP

Related Classes of nl.captcha.Captcha.Builder

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.