1 ;;; Copyright (c) 2007 Zachary Beane, All Rights Reserved
3 ;;; Redistribution and use in source and binary forms, with or without
4 ;;; modification, are permitted provided that the following conditions
7 ;;; * Redistributions of source code must retain the above copyright
8 ;;; notice, this list of conditions and the following disclaimer.
10 ;;; * Redistributions in binary form must reproduce the above
11 ;;; copyright notice, this list of conditions and the following
12 ;;; disclaimer in the documentation and/or other materials
13 ;;; provided with the distribution.
15 ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
16 ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19 ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21 ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 ;;; $Id: examples.lisp,v 1.4 2007/10/01 19:57:15 xach Exp $
29 (defpackage #:vecto-examples
32 (in-package #:vecto-examples
)
34 (defun radiant-lambda (file)
35 (with-canvas (:width
90 :height
90)
36 (let ((font (get-font "times.ttf"))
40 (draw-centered-string 0 -
10 #(#x3BB
))
41 (set-rgb-stroke 1 0 0)
42 (centered-circle-path 0 0 35)
44 (set-rgba-stroke 0 0 1.0 0.5)
54 (defun feedlike-icon (file)
55 (with-canvas (:width
100 :height
100)
56 (set-rgb-fill 1.0 0.65 0.3)
57 (rounded-rectangle 0 0 100 100 10 10)
59 (set-rgb-fill 1.0 1.0 1.0)
60 (centered-circle-path 20 20 10)
62 (flet ((quarter-circle (x y radius
)
63 (move-to (+ x radius
) y
)
64 (arc x y radius
0 (/ pi
2))))
65 (set-rgb-stroke 1.0 1.0 1.0)
67 (quarter-circle 20 20 30)
69 (quarter-circle 20 20 60)
71 (rounded-rectangle 5 5 90 90 7 7)
77 (set-rgba-stroke 1.0 1.0 1.0 0.1)
81 (defun star-clipping (file)
82 (with-canvas (:width
200 :height
200)
85 (step (* 2 (/ (* pi
2) 5))))
89 (setf angle
(+ angle step
))
90 (line-to (* (sin angle
) size
)
91 (* (cos angle
) size
)))
94 (flet ((circle (distance)
95 (set-rgba-fill distance
0 0
97 (centered-circle-path 0 0 (* size distance
))
99 (loop for i downfrom
1.0 by
0.05
104 (defun gradient-example (file)
105 (with-canvas (:width
200 :height
50)
106 (set-gradient-fill 25 0
110 (rectangle 0 0 200 50)
114 (defun gradient-bilinear-example (file)
115 (with-canvas (:width
200 :height
50)
116 (set-gradient-fill 25 0
120 :domain-function
'bilinear-domain
)
121 (rectangle 0 0 200 50)