com.octo.captcha.component.image.wordtoimage
Class DeformedComposedWordToImage

java.lang.Object
  extended by com.octo.captcha.component.image.wordtoimage.AbstractWordToImage
      extended by com.octo.captcha.component.image.wordtoimage.ComposedWordToImage
          extended by com.octo.captcha.component.image.wordtoimage.DeformedComposedWordToImage
All Implemented Interfaces:
WordToImage

public class DeformedComposedWordToImage
extends ComposedWordToImage

This implementation uses deformation components to distord the image.
It takes three array of deformations : for the background image, for the text only, and for the final image it proceeds as folows :


Constructor Summary
DeformedComposedWordToImage(FontGenerator fontGenerator, BackgroundGenerator background, TextPaster textPaster, ImageDeformation[] backgroundDeformation, ImageDeformation[] textDeformation, ImageDeformation[] finalDeformation)
          Composed word to image that applys filters
DeformedComposedWordToImage(FontGenerator fontGenerator, BackgroundGenerator background, TextPaster textPaster, ImageDeformation backgroundDeformation, ImageDeformation textDeformation, ImageDeformation finalDeformation)
          Composed word to image that applys filters
 
Method Summary
 java.awt.image.BufferedImage getImage(java.lang.String word)
          Creates an image of the provided String This method is a skeleton for creation algorithm. it proceeds as folows : Checks the word length Creates an java.text.AttributedString from the word Create an image for the background using the abstact method getBackround Apply background filters Apply font to the AttributedString using the abstract method getFont Create a transparent backround Put the text on the transparent backround using the abstact method pasteText Apply the text filters Paste the transparent image using an alpha composite Apply the final filters Return the newly created image
 
Methods inherited from class com.octo.captcha.component.image.wordtoimage.ComposedWordToImage
getImageHeight, getImageWidth, getMaxAcceptedWordLenght, getMaxAcceptedWordLength, getMinAcceptedWordLenght, getMinAcceptedWordLength, getMinFontSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeformedComposedWordToImage

public DeformedComposedWordToImage(FontGenerator fontGenerator,
                                   BackgroundGenerator background,
                                   TextPaster textPaster,
                                   ImageDeformation backgroundDeformation,
                                   ImageDeformation textDeformation,
                                   ImageDeformation finalDeformation)
Composed word to image that applys filters

Parameters:
fontGenerator - a AbstractFontGenerator to implement the getFont() method
background - a AbstractBackgroundGenerator to implement the getBackround() method
textPaster - a AbstractTextParser to implement the pasteText() method
backgroundDeformation - to be apply on the background image
textDeformation - to be apply on the text image
finalDeformation - to be apply on the final image

DeformedComposedWordToImage

public DeformedComposedWordToImage(FontGenerator fontGenerator,
                                   BackgroundGenerator background,
                                   TextPaster textPaster,
                                   ImageDeformation[] backgroundDeformation,
                                   ImageDeformation[] textDeformation,
                                   ImageDeformation[] finalDeformation)
Composed word to image that applys filters

Parameters:
fontGenerator - a AbstractFontGenerator to implement the getFont() method
background - a AbstractBackgroundGenerator to implement the getBackround() method
textPaster - a AbstractTextParser to implement the pasteText() method
backgroundDeformation - to be apply on the background image
textDeformation - to be apply on the text image
finalDeformation - to be apply on the final image
Method Detail

getImage

public java.awt.image.BufferedImage getImage(java.lang.String word)
                                      throws CaptchaException
Creates an image of the provided String This method is a skeleton for creation algorithm. it proceeds as folows :

Specified by:
getImage in interface WordToImage
Overrides:
getImage in class AbstractWordToImage
Returns:
an image representation of the word
Throws:
CaptchaException - if word is invalid or if image generation fails.


Copyright 2003-2009 JCaptcha. All Rights Reserved.