View Javadoc

1   /*
2    * JCaptcha, the open source java framework for captcha definition and integration
3    * Copyright (c)  2007 jcaptcha.net. All Rights Reserved.
4    * See the LICENSE.txt file distributed with this package.
5    */
6   
7   /*
8    * jcaptcha, the open source java framework for captcha definition and integration
9    * copyright (c)  2007 jcaptcha.net. All Rights Reserved.
10   * See the LICENSE.txt file distributed with this package.
11   */
12  
13  /*
14   * jcaptcha, the open source java framework for captcha definition and integration
15   * copyright (c)  2007 jcaptcha.net. All Rights Reserved.
16   * See the LICENSE.txt file distributed with this package.
17   */
18  
19  package com.octo.captcha.engine.image.gimpy;
20  
21  import com.octo.captcha.component.image.backgroundgenerator.BackgroundGenerator;
22  import com.octo.captcha.component.image.backgroundgenerator.FunkyBackgroundGenerator;
23  import com.octo.captcha.component.image.fontgenerator.FontGenerator;
24  import com.octo.captcha.component.image.fontgenerator.TwistedAndShearedRandomFontGenerator;
25  import com.octo.captcha.component.image.textpaster.RandomTextPaster;
26  import com.octo.captcha.component.image.textpaster.TextPaster;
27  
28  import java.awt.*;
29  
30  /***
31   * <p>Description: </p>
32   *
33   * @author <a href="mailto:mga@octo.com">Mathieu Gandin</a>
34   * @version 1.0
35   */
36  public class SimpleListImageCaptchaEngine
37          extends com.octo.captcha.engine.image.ListImageCaptchaEngine {
38  
39      protected void buildInitialFactories() {
40          com.octo.captcha.component.word.wordgenerator.WordGenerator wordGenerator = new com.octo.captcha.component.word.wordgenerator.RandomWordGenerator(
41                  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
42          TextPaster textPaster = new RandomTextPaster(new Integer(5),
43                  new Integer(8), Color.white);
44          BackgroundGenerator backgroundGenerator = new FunkyBackgroundGenerator(
45                  new Integer(200), new Integer(100));
46          FontGenerator fontGenerator = new TwistedAndShearedRandomFontGenerator(
47                  new Integer(25), new Integer(30));
48          com.octo.captcha.component.image.wordtoimage.WordToImage wordToImage = new com.octo.captcha.component.image.wordtoimage.ComposedWordToImage(
49                  fontGenerator, backgroundGenerator, textPaster);
50          this.addFactory(
51                  new com.octo.captcha.image.gimpy.GimpyFactory(wordGenerator,
52                          wordToImage));
53      }
54  
55  }