本文整理汇总了Java中org.patchca.filter.predefined.CurvesRippleFilterFactory类的典型用法代码示例。如果您正苦于以下问题:Java CurvesRippleFilterFactory类的具体用法?Java CurvesRippleFilterFactory怎么用?Java CurvesRippleFilterFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CurvesRippleFilterFactory类属于org.patchca.filter.predefined包,在下文中一共展示了CurvesRippleFilterFactory类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.patchca.filter.predefined.CurvesRippleFilterFactory; //导入依赖的package包/类
@Override
public void init() throws ServletException {
super.init();
cs = new ConfigurableCaptchaService();
cf = new SingleColorFactory(new Color(25, 60, 170));
wf = new RandomWordFactory();
crff = new CurvesRippleFilterFactory(cs.getColorFactory());
drff = new DoubleRippleFilterFactory();
wrff = new WobbleRippleFilterFactory();
dirff = new DiffuseRippleFilterFactory();
mrff = new MarbleRippleFilterFactory();
cs.setWordFactory(wf);
cs.setColorFactory(cf);
cs.setWidth(120);
cs.setHeight(50);
}
示例2: createImage
import org.patchca.filter.predefined.CurvesRippleFilterFactory; //导入依赖的package包/类
public void createImage() {
ConfigurableCaptchaService cs = new ConfigurableCaptchaService();
cs.setColorFactory(new SingleColorFactory(new Color(25, 60, 170)));
switch (counter % 5) {
case 0:
cs.setFilterFactory(new CurvesRippleFilterFactory(cs.getColorFactory()));
break;
case 1:
cs.setFilterFactory(new MarbleRippleFilterFactory());
break;
case 2:
cs.setFilterFactory(new DoubleRippleFilterFactory());
break;
case 3:
cs.setFilterFactory(new WobbleRippleFilterFactory());
break;
case 4:
cs.setFilterFactory(new DiffuseRippleFilterFactory());
break;
}
img = cs.getCaptcha().getImage();
counter++;
}
示例3: main
import org.patchca.filter.predefined.CurvesRippleFilterFactory; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
for (int counter = 0; counter < 5; counter++) {
ConfigurableCaptchaService cs = new ConfigurableCaptchaService();
cs.setColorFactory(new SingleColorFactory(new Color(25, 60, 170)));
switch (counter % 5) {
case 0:
cs.setFilterFactory(new CurvesRippleFilterFactory(cs.getColorFactory()));
break;
case 1:
cs.setFilterFactory(new MarbleRippleFilterFactory());
break;
case 2:
cs.setFilterFactory(new DoubleRippleFilterFactory());
break;
case 3:
cs.setFilterFactory(new WobbleRippleFilterFactory());
break;
case 4:
cs.setFilterFactory(new DiffuseRippleFilterFactory());
break;
}
FileOutputStream fos = new FileOutputStream("patcha_demo" + counter + ".png");
EncoderHelper.getChallangeAndWriteImage(cs, "png", fos);
fos.close();
}
}
示例4: createCode
import org.patchca.filter.predefined.CurvesRippleFilterFactory; //导入依赖的package包/类
private String createCode(HttpServletRequest request, HttpServletResponse response) throws IOException {
switch (random.nextInt(5)) {
case 0:
cs.setFilterFactory(new CurvesRippleFilterFactory(cs.getColorFactory()));
break;
case 1:
cs.setFilterFactory(new MarbleRippleFilterFactory());
break;
case 2:
cs.setFilterFactory(new DoubleRippleFilterFactory());
break;
case 3:
cs.setFilterFactory(new WobbleRippleFilterFactory());
break;
case 4:
cs.setFilterFactory(new DiffuseRippleFilterFactory());
break;
}
HttpSession session = request.getSession(false);
if (session == null) {
session = request.getSession();
}
String token = null;
token = EncoderHelper.getChallangeAndWriteImage(cs, "png", response.getOutputStream());
if(null != token){
session.setAttribute(Const.SESSION_CAPTCH_TOKEN, token);
}
logger.debug("当前的SessionID=" + session.getId() + ",验证码=" + token);
return token;
}
示例5: ConfigurableCaptchaService
import org.patchca.filter.predefined.CurvesRippleFilterFactory; //导入依赖的package包/类
public ConfigurableCaptchaService() {
backgroundFactory = new SingleColorBackgroundFactory();
wordFactory = new AdaptiveRandomWordFactory();
fontFactory = new RandomFontFactory();
textRenderer = new BestFitTextRenderer();
colorFactory = new SingleColorFactory();
filterFactory = new CurvesRippleFilterFactory(colorFactory);
textRenderer.setLeftMargin(10);
textRenderer.setRightMargin(10);
width = 160;
height = 70;
}