/* Copyright 2006 - 2010 Under Dusken Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package no.dusken.aranea.captcha.engine.image.gimpy; import com.octo.captcha.component.image.backgroundgenerator.BackgroundGenerator; import com.octo.captcha.component.image.backgroundgenerator.GradientBackgroundGenerator; import com.octo.captcha.component.image.color.RandomListColorGenerator; import com.octo.captcha.component.image.fontgenerator.DeformedRandomFontGenerator; import com.octo.captcha.component.image.fontgenerator.FontGenerator; import com.octo.captcha.component.image.textpaster.NonLinearTextPaster; import com.octo.captcha.component.image.textpaster.TextPaster; import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage; import com.octo.captcha.component.image.wordtoimage.WordToImage; import com.octo.captcha.engine.image.ListImageCaptchaEngine; import java.awt.*; /** * @author Marvin B. Lillehaug <lillehau@underdusken.no> * This is the NonLinearTextGimpyEngine, only we use only lower case letters. */ public class SimplerNonLinearTextGimpyEngine extends ListImageCaptchaEngine { protected void buildInitialFactories() { com.octo.captcha.component.word.wordgenerator.WordGenerator wordGenerator = new com.octo.captcha.component.word.wordgenerator.RandomWordGenerator( "abcdefghijklmnopqrstuvwxyz"); TextPaster textPaster = new NonLinearTextPaster(5, 7, new RandomListColorGenerator(new Color[] {Color.BLACK, Color.YELLOW, Color.WHITE}), Boolean.TRUE); BackgroundGenerator backgroundGenerator = new GradientBackgroundGenerator( 200, 100, Color.CYAN, Color.GRAY); FontGenerator fontGenerator = new DeformedRandomFontGenerator( 25, 30); WordToImage wordToImage = new ComposedWordToImage(fontGenerator, backgroundGenerator, textPaster); this.addFactory(new com.octo.captcha.image.gimpy.GimpyFactory(wordGenerator, wordToImage)); } }