com.octo.captcha.component.image.textpaster
Class DoubleRandomTextPaster

java.lang.Object
  extended by com.octo.captcha.component.image.textpaster.AbstractTextPaster
      extended by com.octo.captcha.component.image.textpaster.RandomTextPaster
          extended by com.octo.captcha.component.image.textpaster.DoubleRandomTextPaster
All Implemented Interfaces:
TextPaster

public class DoubleRandomTextPaster
extends RandomTextPaster

Randomly pastes the attributed string twice, with a random offset.


Field Summary
 
Fields inherited from class com.octo.captcha.component.image.textpaster.RandomTextPaster
kerning, textColors
 
Fields inherited from class com.octo.captcha.component.image.textpaster.AbstractTextPaster
myRandom
 
Constructor Summary
DoubleRandomTextPaster(java.lang.Integer minAcceptedWordLength, java.lang.Integer maxAcceptedWordLength, java.awt.Color textColor)
           
DoubleRandomTextPaster(java.lang.Integer minAcceptedWordLength, java.lang.Integer maxAcceptedWordLength, ColorGenerator colorGenerator)
           
DoubleRandomTextPaster(java.lang.Integer minAcceptedWordLength, java.lang.Integer maxAcceptedWordLength, ColorGenerator colorGenerator, java.lang.Boolean manageColorPerGlyph)
           
 
Method Summary
 java.awt.image.BufferedImage pasteText(java.awt.image.BufferedImage background, java.text.AttributedString attributedWord)
          Pastes the attributed string on the backround image and return the final image.
 
Methods inherited from class com.octo.captcha.component.image.textpaster.AbstractTextPaster
getColorGenerator, getMaxAcceptedWordLenght, getMaxAcceptedWordLength, getMinAcceptedWordLenght, getMinAcceptedWordLength, isManageColorPerGlyph, setColorGenerator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleRandomTextPaster

public DoubleRandomTextPaster(java.lang.Integer minAcceptedWordLength,
                              java.lang.Integer maxAcceptedWordLength,
                              java.awt.Color textColor)
Parameters:
minAcceptedWordLength - Max length of a word
maxAcceptedWordLength - Min length of a word
textColor - Unique color of text

DoubleRandomTextPaster

public DoubleRandomTextPaster(java.lang.Integer minAcceptedWordLength,
                              java.lang.Integer maxAcceptedWordLength,
                              ColorGenerator colorGenerator)
Parameters:
minAcceptedWordLength - Max length of a word
maxAcceptedWordLength - Min length of a word
colorGenerator - color generator of text

DoubleRandomTextPaster

public DoubleRandomTextPaster(java.lang.Integer minAcceptedWordLength,
                              java.lang.Integer maxAcceptedWordLength,
                              ColorGenerator colorGenerator,
                              java.lang.Boolean manageColorPerGlyph)
Parameters:
minAcceptedWordLength - Max length of a word
maxAcceptedWordLength - Min length of a word
colorGenerator - color generator of text
manageColorPerGlyph - Boolean to set if each glyph can have a new color from the color generator
Method Detail

pasteText

public java.awt.image.BufferedImage pasteText(java.awt.image.BufferedImage background,
                                              java.text.AttributedString attributedWord)
                                       throws CaptchaException
Pastes the attributed string on the backround image and return the final image. Implementation must take into account the fact that the text must be readable by human and non by programs. Paste the text randomly on the background <

Specified by:
pasteText in interface TextPaster
Overrides:
pasteText in class RandomTextPaster
Returns:
the final image
Throws:
CaptchaException - if any exception occurs during paste routine.


Copyright 2003-2009 JCaptcha. All Rights Reserved.