HOME | DD

Published: 2015-02-07 20:25:31 +0000 UTC; Views: 364; Favourites: 0; Downloads: 0
Redirect to original
Description
(require 'asdf)(eval-when (:compile-toplevel :load-toplevel)
(require 'vecto))
(in-package :vecto)
(defun j (x n)
(+ (- x n) (random (* 2 n))))
(defun render (file)
(let* ((w (/ 10800 1)) (h (/ 7200 1)) (s (coerce (/ w 128) 'float)))
(with-canvas (:width w :height h)
(set-rgba-fill 1 1 (/ 240 255) 1)
(rectangle 0 0 w h)
(fill-path)
(set-line-width (/ s 4))
(dotimes (i 42)
(set-rgba-stroke 0 0 0 (/ 1 (- 45 i)))
(set-rgba-fill 1 1 1 (/ 1 (- 45 i)))
(do ((theta 0 theta))
((> theta (* 2 pi)))
(let ((inc (random .25)))
(let ((x (random w))
(y (random h)))
(move-to x y)
(when (= (random 2) 0)
(arc x y (random (coerce (/ w 3) 'float)) theta (+ inc theta)))
(line-to x y)
(if (= 0 (random 2))
(stroke)
(fill-path))
(incf theta (+ inc (random .1)))))))
(dotimes (i 11)
(set-rgba-stroke 0 0 0 (/ 1 (- 11 i)))
(set-rgba-fill 1 1 (/ 245 255) (random .5))
(do ((theta 0 theta))
((> theta (* 2 pi)))
(let ((inc (random .25)))
(let ((x (j (/ w 2) 2))
(y (j (/ h 2) 2)))
(move-to x y)
(arc x y (random (coerce (/ w 3) 'float)) theta (+ inc theta))
(line-to x y)
(fill-path)
(move-to x y)
(arc x y (random (coerce (/ w 3) 'float)) theta (+ inc theta))
(unless (= 0 (random 4))
(line-to x y))
(stroke)
(incf theta (+ inc (random .1)))))))
;; signature
(set-rgba-fill 0 0 0 1)
(set-font (get-font "~/OCRABold.ttf") (/ w 128))
(draw-string (- w (/ w 32)) (/ h 32) "X")
(fill-path)
(save-png file))))
(render "x-5.png")