本文整理汇总了Java中nl.captcha.backgrounds.GradiatedBackgroundProducer类的典型用法代码示例。如果您正苦于以下问题:Java GradiatedBackgroundProducer类的具体用法?Java GradiatedBackgroundProducer怎么用?Java GradiatedBackgroundProducer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GradiatedBackgroundProducer类属于nl.captcha.backgrounds包,在下文中一共展示了GradiatedBackgroundProducer类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCaptchaImage
import nl.captcha.backgrounds.GradiatedBackgroundProducer; //导入依赖的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.backgrounds.GradiatedBackgroundProducer; //导入依赖的package包/类
@Override
public void doGet(final HttpServletRequest req, final HttpServletResponse resp)
throws ServletException,
IOException {
final HttpSession session = req.getSession();
final Captcha captcha = new Captcha.Builder(_width, _height)
.addText()
.addBackground(new GradiatedBackgroundProducer())
.gimp()
.addBackground(new FlatColorBackgroundProducer(new Color(238, 238, 238)))
.addBorder()
.addNoise()
.build();
session.setAttribute(NAME, captcha);
CaptchaServletUtil.writeImage(resp, captcha.getImage());
}
开发者ID:inepex,项目名称:ineform,代码行数:20,代码来源:CaptchaServlet.java
示例3: updateCaptcha
import nl.captcha.backgrounds.GradiatedBackgroundProducer; //导入依赖的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
示例4: doGet
import nl.captcha.backgrounds.GradiatedBackgroundProducer; //导入依赖的package包/类
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
//ColoredEdgesWordRenderer wordRenderer = new ColoredEdgesWordRenderer(COLORS, FONTS);
ColoredEdgesWordRenderer wordRenderer = new ColoredEdgesWordRenderer(COLORS, FONTS, 1f);
Captcha captcha = new Captcha.Builder(_width, _height).addText(wordRenderer)
//.gimp()
.addNoise()
//.addBackground(new GradiatedBackgroundProducer())
//.addBackground(new TransparentBackgroundProducer())
//.addBackground(new FlatColorBackgroundProducer(Color.lightGray))
.addBackground(new GradiatedBackgroundProducer(Color.lightGray, Color.white))
.build();
CaptchaServletUtil.writeImage(resp, captcha.getImage());
req.getSession().setAttribute(NAME, captcha);
}
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:18,代码来源:NCISimpleCaptchaServlet.java
示例5: doGet
import nl.captcha.backgrounds.GradiatedBackgroundProducer; //导入依赖的package包/类
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
ColoredEdgesWordRenderer wordRenderer = new ColoredEdgesWordRenderer(COLORS, FONTS);
Captcha captcha = new Captcha.Builder(_width, _height).addText(wordRenderer)
.gimp()
.addNoise()
.addBackground(new GradiatedBackgroundProducer())
.build();
CaptchaServletUtil.writeImage(resp, captcha.getImage());
req.getSession().setAttribute(NAME, captcha);
}
开发者ID:rookiefly,项目名称:simplecaptcha,代码行数:14,代码来源:SimpleCaptchaServlet.java
示例6: createCaptcha
import nl.captcha.backgrounds.GradiatedBackgroundProducer; //导入依赖的package包/类
/**
* Creates a {@link Captcha} and stores it in the session.
*
* @param width the width of the image
* @param height the height of the image
* @return {@link BufferedImage} containing the captcha image
*/
public BufferedImage createCaptcha(int width, int height)
{
Captcha captcha = new Captcha.Builder(width, height).addText()
.addBackground(new GradiatedBackgroundProducer())
.gimp()
.addNoise()
.addBorder()
.build();
session.setAttribute(Captcha.NAME, captcha);
return captcha.getImage();
}
开发者ID:molgenis,项目名称:molgenis,代码行数:19,代码来源:CaptchaService.java
注:本文中的nl.captcha.backgrounds.GradiatedBackgroundProducer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论