-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpict-hexagon.rkt
31 lines (25 loc) · 1.19 KB
/
pict-hexagon.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#lang racket
;; hexagons in pict format, derived from image format
(provide
hexagon
filled-hexagon)
;; ---------------------------------------------------------------------------------------------------
(require (prefix-in image: "hexagon.rkt"))
(require pict/convert)
(require pict)
;; ---------------------------------------------------------------------------------------------------
(define (hexagon size #:border-color (color "white") #:brder-width (width #false))
(define tile (pict-convert (image:hexagon size 'outline color)))
tile)
(define (filled-hexagon size
#:draw-border? (border #true)
#:color (color "white")
#:border-color (border-color "white")
#:brder-width (width #false))
(define inner-tile (pict-convert (image:hexagon size'solid color)))
(define outer-tile (pict-convert (image:hexagon size'outline border-color)))
(cc-superimpose inner-tile outer-tile))
;; ---------------------------------------------------------------------------------------------------
(module+ test
(hexagon 20 #:border-color "black")
(filled-hexagon 20 #:color "red" #:border-color "black"))