railo.commons.img
Class AbstractCaptcha

java.lang.Object
  extended by railo.commons.img.AbstractCaptcha
Direct Known Subclasses:
Captcha, MarpleCaptcha

public abstract class AbstractCaptcha
extends Object

Abstract template class for captcha generation


Field Summary
static int DIFFICULTY_HIGH
           
static int DIFFICULTY_LOW
           
static int DIFFICULTY_MEDIUM
           
 
Constructor Summary
AbstractCaptcha()
           
 
Method Summary
 BufferedImage generate(String text, int width, int height, String[] fonts, boolean useAntiAlias, Color fontColor, int fontSize, int difficulty)
          generates a Captcha as a Buffered Image file
abstract  Font getFont(String font, Font defaultValue)
          creates a font from given string
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIFFICULTY_LOW

public static final int DIFFICULTY_LOW
See Also:
Constant Field Values

DIFFICULTY_MEDIUM

public static final int DIFFICULTY_MEDIUM
See Also:
Constant Field Values

DIFFICULTY_HIGH

public static final int DIFFICULTY_HIGH
See Also:
Constant Field Values
Constructor Detail

AbstractCaptcha

public AbstractCaptcha()
Method Detail

generate

public BufferedImage generate(String text,
                              int width,
                              int height,
                              String[] fonts,
                              boolean useAntiAlias,
                              Color fontColor,
                              int fontSize,
                              int difficulty)
                       throws CaptchaException
generates a Captcha as a Buffered Image file

Parameters:
text - text for the captcha
width - width of the resulting image
height - height of the resulting image
fonts - list of font used for the captcha (all font are random used)
useAntiAlias - use anti aliasing or not
fontColor - color of the font
fontSize - size of the font
difficulty - difficulty of the reslting captcha
Returns:
captcha image
Throws:
CaptchaException

getFont

public abstract Font getFont(String font,
                             Font defaultValue)
creates a font from given string

Parameters:
font -
defaultValue -
Returns:


Copyright © 2012 Railo