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

java.lang.Object
  extended by com.octo.captcha.component.image.wordtoimage.AbstractWordToImage
All Implemented Interfaces:
WordToImage
Direct Known Subclasses:
ComposedWordToImage, SimpleWordToImage

public abstract class AbstractWordToImage
extends java.lang.Object
implements WordToImage

Implementation skeleton for the WordToImage component

Basically this class implements the imageFromWord method proceding as folow :

This class implements the Template method pattern from the GOF design patterns.


Constructor Summary
AbstractWordToImage()
           
 
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 Apply font to the AttributedString using the abstract method getFont Create an image for the background using the abstact method getBackround Put the text on the backround using the abstact method pasteText Return the newly created image
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.octo.captcha.component.image.wordtoimage.WordToImage
getImageHeight, getImageWidth, getMaxAcceptedWordLenght, getMaxAcceptedWordLength, getMinAcceptedWordLenght, getMinAcceptedWordLength, getMinFontSize
 

Constructor Detail

AbstractWordToImage

public AbstractWordToImage()
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
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.