当前位置: 首页>>代码示例>>Java>>正文


Java CurvesRippleFilterFactory类代码示例

本文整理汇总了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);
}
 
开发者ID:binghuo365,项目名称:csustRepo,代码行数:17,代码来源:ValidateCode.java

示例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++;
}
 
开发者ID:pusuo,项目名称:patchca,代码行数:24,代码来源:PatchcaFilterDemo.java

示例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();
	}
}
 
开发者ID:pusuo,项目名称:patchca,代码行数:27,代码来源:PatchcaFilterDemoPNG.java

示例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;
  }
 
开发者ID:mattxia,项目名称:unique-web,代码行数:32,代码来源:PatchcaRender.java

示例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;
}
 
开发者ID:pusuo,项目名称:patchca,代码行数:13,代码来源:ConfigurableCaptchaService.java


注:本文中的org.patchca.filter.predefined.CurvesRippleFilterFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。