com.octo.captcha.component.image.backgroundgenerator
Class FileReaderRandomBackgroundGenerator

java.lang.Object
  extended by com.octo.captcha.component.image.backgroundgenerator.AbstractBackgroundGenerator
      extended by com.octo.captcha.component.image.backgroundgenerator.FileReaderRandomBackgroundGenerator
All Implemented Interfaces:
BackgroundGenerator

public class FileReaderRandomBackgroundGenerator
extends AbstractBackgroundGenerator

File reader background generator that return a random image (JPEG ONLY) from the ones found in the directory

You can place images in the classpath directory, in this case take care to use a unique directory name (not already contained in a jar file)

TODO : add some gif, bmp,... reader facilities.


Field Summary
protected static java.util.Map cachedDirectories
           
 
Constructor Summary
FileReaderRandomBackgroundGenerator(java.lang.Integer width, java.lang.Integer height, java.lang.String rootPath)
           
 
Method Summary
protected  java.io.File findDirectory(java.lang.String rootPath)
           
 java.awt.image.BufferedImage getBackground()
          Generates a backround image on wich text will be paste.
 
Methods inherited from class com.octo.captcha.component.image.backgroundgenerator.AbstractBackgroundGenerator
getImageHeight, getImageWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cachedDirectories

protected static final java.util.Map cachedDirectories
Constructor Detail

FileReaderRandomBackgroundGenerator

public FileReaderRandomBackgroundGenerator(java.lang.Integer width,
                                           java.lang.Integer height,
                                           java.lang.String rootPath)
Method Detail

findDirectory

protected java.io.File findDirectory(java.lang.String rootPath)

getBackground

public java.awt.image.BufferedImage getBackground()
Generates a backround image on wich text will be paste. Implementations must take into account the imageHeigt and imageWidth.

Returns:
the background image


Copyright 2003-2009 JCaptcha. All Rights Reserved.