classcaptcha302::CaptchaImpl

sys::Obj
  captcha302::CaptchaImpl : captcha302::CaptchaWriter

A (somewhat lame) captcha writer implementation It is quite configurable and draws a variable number of chars with variable scales It also draws some lines under and over the chars to make it a bit harder to read

bgColor

Color bgColor := Color.white

charLines

const static Int:Line[] charLines := ...

charScale

Range charScale := 4..6

charStroke

Range charStroke := 5..9

chars

virtual override Int[] chars := "ACDEFGHJKLNPRTXY346".chars

Avoiding characters that are look alike like i, l, 1, 0, o etc ..

codeLength

Range codeLength := 4..4

create

virtual override Image302 create(CaptchaCode code)

height

Int height := 100

make

new make(|This? f)

maxBgStrokeSize

Int maxBgStrokeSize := 4

maxFgStrokeSize

Int maxFgStrokeSize := 4

nbBgLines

Int nbBgLines := 10

nbFgLines

Int nbFgLines := 10

Int next()

options

virtual override Str:Obj options := ...

r

Random r := Random.makeSecure

randomCode

virtual override CaptchaCode randomCode()

randomColor

Color randomColor(Int alpha := 255)

uniqueColor

Color uniqueColor(Color[] curColors, Int alpha := 200)

get a random color that is not too much like another

width

Int width := 300