1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  package com.octo.captcha.engine.image.gimpy;
20  
21  import java.awt.Color;
22  
23  import com.octo.captcha.component.image.backgroundgenerator.BackgroundGenerator;
24  import com.octo.captcha.component.image.backgroundgenerator.UniColorBackgroundGenerator;
25  import com.octo.captcha.component.image.fontgenerator.FontGenerator;
26  import com.octo.captcha.component.image.fontgenerator.RandomFontGenerator;
27  import com.octo.captcha.component.image.textpaster.TextPaster;
28  import com.octo.captcha.component.image.textpaster.DecoratedRandomTextPaster;
29  import com.octo.captcha.component.image.textpaster.textdecorator.BaffleTextDecorator;
30  import com.octo.captcha.component.image.textpaster.textdecorator.TextDecorator;
31  import com.octo.captcha.component.image.color.SingleColorGenerator;
32  import com.octo.captcha.engine.image.ListImageCaptchaEngine;
33  import com.sun.jndi.ldap.Ber;
34  
35  /***
36   * <p>Description: </p>
37   *
38   * @author <a href="mailto:mag@jcaptcha.net">Marc-Antoine Garrigue</a>
39   * @version 1.0
40   */
41  public class BaffleListGimpyEngine extends ListImageCaptchaEngine {
42  
43      protected void buildInitialFactories() {
44          
45          com.octo.captcha.component.word.wordgenerator.WordGenerator dictionnaryWords = new com.octo.captcha.component.word.wordgenerator.ComposeDictionaryWordGenerator(
46                  new com.octo.captcha.component.word.FileDictionary(
47                          "toddlist"));
48          
49          TextPaster randomPaster = new DecoratedRandomTextPaster(
50                  new Integer(8), new Integer(15),
51                  new SingleColorGenerator(Color.BLACK),
52                  new TextDecorator[]{new BaffleTextDecorator(2,Color.black)});
53          BackgroundGenerator back = new UniColorBackgroundGenerator(
54                  new Integer(200), new Integer(100), Color.white);
55          
56          FontGenerator shearedFont = new RandomFontGenerator(new Integer(20),
57                  new Integer(25));
58          
59          com.octo.captcha.component.image.wordtoimage.WordToImage word2image = new com.octo.captcha.component.image.wordtoimage.ComposedWordToImage(
60                  shearedFont, back, randomPaster);
61  
62          this.addFactory(
63                  new com.octo.captcha.image.gimpy.GimpyFactory(dictionnaryWords,
64                          word2image));
65      }
66  }