📄 backgroundcontroller.groovy
字号:
import java.awt.Colorimport nl.captcha.Captchaimport nl.captcha.backgrounds.*import nl.captcha.servlet.CaptchaServletUtil/** * Exercise the various background renderers.**/class BackgroundController { def final WIDTH = 200 def final HEIGHT = 50 def simple = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .addBackground() .build() CaptchaServletUtil.writeImage(response, captcha.image) } def squiggles = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .addBackground(new SquigglesBackgroundProducer()) .build() CaptchaServletUtil.writeImage(response, captcha.image) } def flatcolor = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .addBackground(new FlatColorBackgroundProducer()) .build() CaptchaServletUtil.writeImage(response, captcha.image) } def blue = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .addBackground(new FlatColorBackgroundProducer(Color.BLUE)) .build() CaptchaServletUtil.writeImage(response, captcha.image) } def gradiated = { def captcha = new Captcha.Builder(WIDTH, HEIGHT) .addText() .addBackground(new GradiatedBackgroundProducer()) .build() CaptchaServletUtil.writeImage(response, captcha.image) }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -