Class: Turing::Image::Spiral
- Inherits:
-
Turing::Image
- Object
- Turing::Image
- Turing::Image::Spiral
- Defined in:
- lib/turing/image_plugins/spiral.rb
Overview
Spiral Turing test
Renders spirals plus text over them.
Instance Method Summary collapse
-
#generate(img, word) ⇒ Object
contract method - generate the challenge.
Methods inherited from Turing::Image
Constructor Details
This class inherits a constructor from Turing::Image
Instance Method Details
#generate(img, word) ⇒ Object
contract method - generate the challenge
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/turing/image_plugins/spiral.rb', line 17 def generate(img, word) # {{{ fg = GD2::Color[185, 140, 140] sfg = GD2::Color[225, 190, 190] spiral(img, (img.width/3) + rand(img.width/3), rand(img.height), sfg) write_string(img, 'cour.ttf', fg, word) spiral(img, rand(img.width / 3), rand(img.height), sfg) spiral(img, 2*(img.width/3) + rand(img.width/3), rand(img.height), sfg) end |