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


Java FishEyeGimpyRenderer类代码示例

本文整理汇总了Java中nl.captcha.gimpy.FishEyeGimpyRenderer的典型用法代码示例。如果您正苦于以下问题:Java FishEyeGimpyRenderer类的具体用法?Java FishEyeGimpyRenderer怎么用?Java FishEyeGimpyRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FishEyeGimpyRenderer类属于nl.captcha.gimpy包,在下文中一共展示了FishEyeGimpyRenderer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCaptchaImage

import nl.captcha.gimpy.FishEyeGimpyRenderer; //导入依赖的package包/类
private void getCaptchaImage(HttpServletRequest request, HttpServletResponse response) throws IOException
{
	String seed = request.getParameter("seed");
	if (seed == null || seed.isEmpty())
	{
		response.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE);
		return;
	}
	int seed_;
	try
	{
		seed_ = Integer.parseInt(seed);
	}
	catch (NumberFormatException i)
	{
		response.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE);
		return;
	}
	PredictableCaptchaTextProducer producer = new PredictableCaptchaTextProducer(seed_);
	final Captcha captcha = new Captcha.Builder(160, 50).addText(producer).addBackground(new GradiatedBackgroundProducer()).addNoise().gimp(new FishEyeGimpyRenderer()).addBorder().build();
	CaptchaServletUtil.writeImage(response, captcha.getImage());
}
 
开发者ID:PolyphasicDevTeam,项目名称:NoMoreOversleeps,代码行数:23,代码来源:WebServlet.java

示例2: doGet

import nl.captcha.gimpy.FishEyeGimpyRenderer; //导入依赖的package包/类
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
		
		List<java.awt.Font> textFonts = Arrays.asList(
		     new Font("Arial", Font.BOLD, 40), 
		     new Font("Courier", Font.BOLD, 40));
	    Captcha captcha = new Captcha.Builder(250, 90).addText()
			.addBackground(new FlatColorBackgroundProducer(Color.YELLOW))
			.gimp(new FishEyeGimpyRenderer())
			.addNoise(new CurvedLineNoiseProducer())
			.addText(new DefaultTextProducer(5), 
					 new DefaultWordRenderer(Color.RED, textFonts))
			.build();

	    CaptchaServletUtil.writeImage(resp, captcha.getImage());
	    req.getSession().setAttribute(NAME, captcha);
}
 
开发者ID:PacktPublishing,项目名称:Spring-MVC-Blueprints,代码行数:19,代码来源:SimpleCaptchaCustomServlet.java

示例3: updateCaptcha

import nl.captcha.gimpy.FishEyeGimpyRenderer; //导入依赖的package包/类
@At("/captcha/update")
	@Ok("raw:image/png")
	public BufferedImage updateCaptcha(HttpSession session, @Param("w") int w, @Param("h") int h) {
		if (w * h == 0) { //长或宽为0?重置为默认长宽.
			w = 200;
			h = 60;
		}
		Captcha captcha = new Captcha.Builder(w, h)
								.addText().addBackground(new GradiatedBackgroundProducer())
//								.addNoise(new StraightLineNoiseProducer()).addBorder()
								.gimp(new FishEyeGimpyRenderer())
								.build();
		String text = captcha.getAnswer();
		session.setAttribute(Toolkit.captcha_attr, text);
		return captcha.getImage();
	}
 
开发者ID:amdiaosi,项目名称:nutzWx,代码行数:17,代码来源:ToolkitModule.java


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