1 package com.octo.captcha.component.image.textpaster.glyphsvisitor;
2
3 import com.octo.captcha.component.image.textpaster.Glyphs;
4
5 import java.awt.geom.Rectangle2D;
6 import java.util.Random;
7 import java.security.SecureRandom;
8
9 /***
10 * @author mag
11 * @Date 7 mars 2008
12 */
13 public class TranslateGlyphsVerticalRandomVisitor implements GlyphsVisitors {
14
15 private Random myRandom = new SecureRandom();
16 private double verticalRange = 1;
17 public TranslateGlyphsVerticalRandomVisitor(double verticalRange) {
18 this.verticalRange = verticalRange;
19 }
20
21 public void visit(Glyphs gv, Rectangle2D backroundBounds) {
22
23 for(int i=0;i<gv.size();i++){
24 double tx =0;
25 double ty =verticalRange*myRandom.nextGaussian();
26
27 gv.translate(i,tx,ty);
28 }
29 }
30 }