PasteRack.org
Paste # 49321
2017-10-13 18:00:44

Forked from paste # 62307.

Fork as a new paste.

Paste viewed 89 times.


Embed:

  1. #lang racket
  2. (require pict racket/draw)
  3. (define (happy-eyes width height [boldness 0.1])
  4.   (unless (< 0 boldness 1)
  5.           (error 'happy-eyes "Boldness must be between 0 and 1 exclusive"))
  6.  (dc (lambda (dc dx dy)
  7.       (define old-brush (send dc get-brush))
  8.       (send dc set-brush
  9.         (send the-brush-list find-or-create-brush
  10.                               "black"
  11.                           'solid))
  12.       (define eye-path (new dc-path%))
  13.       (send eye-path arc dx dy width height 0 pi)
  14.       (send eye-path arc dx (+ dy (* height (- 1 boldness)))
  15.             width (* height (- 1 boldness)) pi 0 #f)
  16.       (send eye-path close)
  17.       (send dc draw-path eye-path dx dy)
  18.       (send dc set-brush old-brush))
  19.      width height))
  20.  
  21. (for/list ([boldness (in-range 0.1 0.81 0.1)])
  22.           (happy-eyes 50 80 boldness))

=>

'(image image image image image image image image)