cn.atomtool.captcha.service.SimpleCaptchaService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of atomtool-captcha Show documentation
Show all versions of atomtool-captcha Show documentation
atomTool核心工具包,包括集合、字符串、Bean等工具类
The newest version!
package cn.atomtool.captcha.service;
import cn.atomtool.captcha.background.SingleColorBackgroundFactory;
import cn.atomtool.captcha.color.SingleColorFactory;
import cn.atomtool.captcha.filter.FilterFactory;
import cn.atomtool.captcha.font.RandomFontFactory;
import cn.atomtool.captcha.text.renderer.BestFitTextRenderer;
import cn.atomtool.captcha.word.AdaptiveRandomWordFactory;
import java.awt.*;
public class SimpleCaptchaService extends AbstractCaptchaService {
public SimpleCaptchaService(int width, int height, Color textColor, Color backgroundColor, int fontSize, FilterFactory ff) {
backgroundFactory = new SingleColorBackgroundFactory(backgroundColor);
wordFactory = new AdaptiveRandomWordFactory();
fontFactory = new RandomFontFactory();
textRenderer = new BestFitTextRenderer();
colorFactory = new SingleColorFactory(textColor);
filterFactory = ff;
this.width = width;
this.height = height;
}
public SimpleCaptchaService(int width, int height, Color textColor, Color backgroundColor, int fontSize, String[]fontNames, FilterFactory ff) {
backgroundFactory = new SingleColorBackgroundFactory(backgroundColor);
wordFactory = new AdaptiveRandomWordFactory();
fontFactory = new RandomFontFactory(fontNames);
textRenderer = new BestFitTextRenderer();
colorFactory = new SingleColorFactory(textColor);
filterFactory = ff;
this.width = width;
this.height = height;
}
@Override
public Captcha getCaptcha() {
return null;
}
}