eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HumanReadableImageGenerator':

Home

everywhere
www.exept.de
for:
[back]

Class: HumanReadableImageGenerator


Inheritance:

   Object
   |
   +--HumanReadableImageGenerator

Package:
stx:goodies/webServer
Category:
Net-Communication-HTML-Misc
Version:
rev: 1.10 date: 2009/04/23 09:18:35
user: sr
file: HumanReadableImageGenerator.st directory: goodies/webServer
module: stx stc-classLibrary: webServer
Author:
Claus Gittinger

Description:


Generate a form containing a string for the user to type into a web-form
as confirmation that he is really human.
I.e. the forms image is designed to make it hard for an OCR program to
extract the characters.
At least, we hope that it is so.

Sometimes, the picture is hard to decipher, even for a real human;
therefore, add some 'try another picture' button to the web page.

Caveat: this is a dirty hack

[usage:]
    HumanReadableImageGenerator new generate inspect


Class protocol:

defaults
o  characterMapCharacters

o  numberOfCharMaps

image specs
o  charMapImage1
character bitmaps (needed ebcause the webServer has no Display for drawing)

o  charMapImage1_height

o  charMapImage1_width

o  charMapImage2
character bitmaps (needed ebcause the webServer has no Display for drawing)

o  charMapImage2_height

o  charMapImage2_width

o  charMapImage3
character bitmaps (needed ebcause the webServer has no Display for drawing)

o  charMapImage3_height

o  charMapImage3_width

o  getCharMapImage: idx

instance creation
o  new

support
o  fonts

o  generateFontMaps
generates the methods:
charMapImage1,
charMapImage2,
...
one for each font

o  generateImageMethod: selector with: image forFont: aFont


Instance protocol:

accessing
o  characterSet: something

o  colors: something

o  extent: something

o  maxAngle: something

o  minAngle: something

o  numberOfRandomDots: something

o  numberOfRandomLines: something

o  string

o  string: something

o  stringLength: something

initialization
o  computeExtent

o  generateString

o  initialize

o  randomCharacter

private
o  generate

o  generateFormUsingDisplay

o  generateImageWithoutUsingDisplay

public
o  generateImage


Examples:



    |gen image|

    gen := HumanReadableImageGenerator new.
    gen numberOfRandomDots:10000.
    gen numberOfRandomLines:25.
    gen minAngle:-45.
    gen maxAngle:45.
    gen string inspect.
    image := gen generate.
    image inspect.


ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 19:32:38 GMT