📄 gimpycontroller.groovy
字号:
import java.awt.Colorimport nl.captcha.Captchaimport nl.captcha.backgrounds.*import nl.captcha.gimpy.*import nl.captcha.servlet.CaptchaServletUtil/*** Exercise the different gimpy renderers.***/class GimpyController { def final WIDTH = 200 def final HEIGHT = 50 def simple = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .gimp() .build() CaptchaServletUtil.writeImage(response, captcha.image) } def fisheye = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .gimp(new FishEyeGimpyRenderer(Color.RED, Color.BLUE)) .build() CaptchaServletUtil.writeImage(response, captcha.image) } def ripple = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .gimp(new RippleGimpyRenderer()) .build() CaptchaServletUtil.writeImage(response, captcha.image) } def shear = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .gimp(new ShearGimpyRenderer()) .build() CaptchaServletUtil.writeImage(response, captcha.image) } def shadow = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .gimp(new DropShadowGimpyRenderer()) .build() CaptchaServletUtil.writeImage(response, captcha.image) } def block = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .gimp(new BlockGimpyRenderer()) .build() CaptchaServletUtil.writeImage(response, captcha.image) } def blockbig = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .gimp(new BlockGimpyRenderer(5)) .build() CaptchaServletUtil.writeImage(response, captcha.image) } def multi = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .gimp(new BlockGimpyRenderer()) .gimp(new DropShadowGimpyRenderer()) .gimp(new RippleGimpyRenderer()) .gimp(new FishEyeGimpyRenderer()) .addBackground(new GradiatedBackgroundProducer()) .addBorder() .build() CaptchaServletUtil.writeImage(response, captcha.image) }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -