|
Class: HumanReadableImageGenerator
Object
|
+--HumanReadableImageGenerator
- Package:
- stx:goodies/webServer
- Category:
- Net-Communication-HTML-Misc
- Version:
- rev:
1.21
date: 2021/11/26 17:58:20
- user: cg
- file: HumanReadableImageGenerator.st directory: goodies/webServer
- module: stx stc-classLibrary: webServer
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
copyrightCOPYRIGHT (c) 2008 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
defaults
-
characterMapCharacters
-
-
numberOfCharMaps
-
image specs
-
charMapImage1
-
character bitmaps (needed ebcause the webServer has no Display for drawing)
Usage example(s):
self charMapImage1 inspect
ImageEditor openOnClass:self andSelector:#charMapImage1
Icon flushCachedIcons
|
-
charMapImage1_height
-
-
charMapImage1_width
-
-
charMapImage2
-
character bitmaps (needed because the webServer has no Display for drawing)
Usage example(s):
self charMapImage2 inspect
ImageEditor openOnClass:self andSelector:#charMapImage2
Icon flushCachedIcons
|
-
charMapImage2_height
-
-
charMapImage2_width
-
-
charMapImage3
-
character bitmaps (needed ebcause the webServer has no Display for drawing)
Usage example(s):
self charMapImage3 inspect
ImageEditor openOnClass:self andSelector:#charMapImage3
Icon flushCachedIcons
|
-
charMapImage3_height
-
-
charMapImage3_width
-
-
getCharMapImage: idx
-
self getCharMapImage:1
self getCharMapImage:2
self getCharMapImage:3
instance creation
-
new
-
(comment from inherited method)
return an instance of myself without indexed variables
support
-
fonts
-
-
generateFontMaps
-
generates the methods:
charMapImage1,
charMapImage2,
...
one for each font
Usage example(s):
-
generateImageMethod: selector with: image forFont: aFont
-
self generateFontMaps
accessing
-
characterSet: something
-
-
colors: aCollectionOfColors
-
-
extent: aPoint
-
-
maxAngle: something
-
-
minAngle: something
-
-
numberOfRandomDots: anInteger
-
-
numberOfRandomLines: anInteger
-
-
string
-
-
string: something
-
-
stringLength: something
-
initialization
-
computeExtent
-
what a hack
-
generateString
-
-
initialize
-
|gen image|
gen := HumanReadableImageGenerator new.
gen numberOfRandomDots:5000.
gen numberOfRandomLines:10.
gen minAngle:-45.
gen maxAngle:45.
image := gen generate.
image inspect.
-
randomCharacter
-
private
-
generate
-
HumanReadableImageGenerator new generate inspect
-
generateFormUsingDisplay
-
ensure that even after rotation, the result still lies inside the charBox.
Usage example(s):
HumanReadableImageGenerator new generateFormUsingDisplay inspect
|
-
generateImageWithoutUsingDisplay
-
colors := OrderedCollection new.
Usage example(s):
HumanReadableImageGenerator new generateImageWithoutUsingDisplay inspect
|
public
-
generateImage
-
|gen image|
gen := HumanReadableImageGenerator new.
gen extent:300@100.
gen numberOfRandomDots:1000.
gen numberOfRandomLines:25.
gen minAngle:-45.
gen maxAngle:45.
gen string inspect.
image := gen generate.
image inspect.
|
|