⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gimpycontroller.groovy

📁 一个为 Java/J2EE生成的最简化CAPTCHA的框架
💻 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 + -