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   package com.octo.captcha.component.image.textpaster;
8   
9   import com.octo.captcha.CaptchaException;
10  
11  import java.awt.image.BufferedImage;
12  import java.text.AttributedString;
13  
14  /***
15   * <p>Used by ComposedWordToImage to paste the word to be distorded on the image background</p>
16   *
17   * @author <a href="mailto:mag@jcaptcha.net">Marc-Antoine Garrigue</a>
18   * @version 1.0
19   */
20  public interface TextPaster {
21  
22  
23      /***
24       * @return the max word length accepted by this word2image service
25       */
26      int getMaxAcceptedWordLength();
27  
28      /***
29       * @return the min word length accepted by this word2image service
30       */
31      int getMinAcceptedWordLength();
32  
33      /***
34       * Pastes the attributed string on the backround image and return the final image. Implementation must take into
35       * account the fact that the text must be readable by human and non by programs
36       *
37       * @return the final image
38       *
39       * @throws com.octo.captcha.CaptchaException
40       *          if any exception accurs during paste routine.
41       */
42      BufferedImage pasteText(final BufferedImage background,
43                              final AttributedString attributedWord)
44              throws CaptchaException;
45  }