本文整理汇总了Java中com.octo.captcha.engine.image.ListImageCaptchaEngine类的典型用法代码示例。如果您正苦于以下问题:Java ListImageCaptchaEngine类的具体用法?Java ListImageCaptchaEngine怎么用?Java ListImageCaptchaEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListImageCaptchaEngine类属于com.octo.captcha.engine.image包,在下文中一共展示了ListImageCaptchaEngine类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCaptchaEngine
import com.octo.captcha.engine.image.ListImageCaptchaEngine; //导入依赖的package包/类
@Override
public CaptchaEngine createCaptchaEngine(CaptchaModel captcha) {
return new ListImageCaptchaEngine() {
@Override
protected void buildInitialFactories() {
FontGenerator fontGenerator = new RandomFontGenerator(captcha.getFontMin(), captcha.getFontMax(), getFonts());
BackgroundGenerator backgroundGenerator = createBackgroundGenerator(captcha.getWidth(), captcha.getHeight(), captcha.getBackground());
TextPaster textPaster = new RandomTextPaster(captcha.getLength(), captcha.getLength(),
new RandomRangeColorGenerator(new int[]{0, 100}, new int[]{0, 100}, new int[]{0, 100}), true);
addFactory(new GimpyFactory(new RandomWordGenerator(captcha.getChars()),
new ComposedWordToImage(fontGenerator, backgroundGenerator, textPaster)));
}
};
}