java - Simple Captcha and make different colors -


i've watched link http://simplecaptcha.sourceforge.net/ , gives demo of images showing captcha can designed colored 1 can not black , white one. reason couldn't find tutorials of how control simplecaptcha colors :( if know snippets or tutorials share them please.

all useful comments appreciated :)

which part want in color? can, example, control color of text via wordrenderer. examples of how use captcha.builder can found on website. can add things following of these examples:

list<java.awt.color> textcolors = arrays.aslist(      color.black, color.blue, color.red); list<java.awt.font> textfonts = arrays.aslist(      new font("arial", font.bold, 40),       new font("courier", font.bold, 40));  java.awt.color backgroundcolor = color.orange;  captcha captcha = new captcha.builder(200, 50)     .addtext(         new defaulttextproducer(),          new defaultwordrenderer(textcolors, textfonts))     .addbackground(new flatcolorbackgroundproducer(backgroundcolor))     .build(); 

defaultwordrenderer accepts list of colors , fonts can pick several colors/fonts randomly per request. so, if provide 1 color , font, you'll every time. if provide 5 colors , 1 font, you'll same font every time, color selected randomly 5 provided.

the example above uses flatcolorbackgroundproducer, there other options, including gradiatedbackgroundproducer , squigglesbackgroundproducer.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -