?? gimpycontroller.groovy
字號:
import java.awt.Colorimport java.awt.Fontimport nl.captcha.Captchaimport nl.captcha.backgrounds.*import nl.captcha.gimpy.*import nl.captcha.text.renderer.*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 example = { Captcha captcha = new Captcha.Builder(200, 50) .addText() .addBackground() .addNoise() .gimp() .addBorder() .build() CaptchaServletUtil.writeImage(response, captcha.image) } def multi = { def f = [new Font("Arial", Font.PLAIN, 48), new Font("Times", Font.PLAIN, 46)] def c = [Color.BLACK, Color.RED] def captcha = new Captcha.Builder(225, 75) // .addText(new ColoredEdgesWordRenderer(c, f)) .addText(new DefaultWordRenderer(c[1], f)) // .gimp(new DropShadowGimpyRenderer()) .addBackground(new SquigglesBackgroundProducer()) .addNoise() .gimp() .build() CaptchaServletUtil.writeImage(response, captcha.image) }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -