// ymageCaptcha.java // ----------------------- // part of YaCy // (C) by Marc Nause // // $LastChangedDate: 2007-04-03 22:56:00 +0100 (Di, 04 Apr 2007) $ // $LastChangedRevision: 3542 $ // $LastChangedBy: low012 $ // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package net.yacy.visualization; import java.util.Random; import javax.imageio.ImageIO; import net.yacy.kelondro.logging.Log; public class Captcha extends RasterPlotter { public Captcha(final int width, final int height, final byte displayMode, final String code) { super(width, height, displayMode, "FFFFFF"); this.create(code); } private void create(final String code){ final Random random = new Random(); final int width = this.getWidth(); final int height = this.getHeight(); final int chars = code.length(); int x; int y; int ub = 0; final int widthPerChar = width/chars; final int pixels = width * height; //printing code for(int i=0;i