All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.atomtool.captcha.service.SimpleCaptchaService Maven / Gradle / Ivy

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;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy