Skip to content

Instantly share code, notes, and snippets.

@apg
Last active August 29, 2015 14:25
Show Gist options
  • Save apg/3da6d986b20e5475332e to your computer and use it in GitHub Desktop.
Save apg/3da6d986b20e5475332e to your computer and use it in GitHub Desktop.
#lang racket
(require racket/draw)
(define target (make-bitmap 500 500))
(define dc (new bitmap-dc% [bitmap target]))
(define (square-star dc)
;; background
(send dc set-alpha 1.0)
(send dc set-brush "black" 'solid)
(send dc draw-rectangle 0 0 500 500)
(send dc translate 250 250)
(send dc set-pen "white" 1 'transparent)
(for-each (lambda (color)
(send dc rotate (/ pi 3.5))
(send dc set-brush color 'solid)
(send dc set-alpha .25)
(send dc draw-rectangle 0 0 100 100))
'("red" "orange" "yellow" "green" "blue" "purple"))
(for-each (lambda (color)
(send dc rotate (/ pi -2.5))
(send dc set-brush color 'solid)
(send dc set-alpha .25)
(send dc draw-rectangle 0 0 140 140))
'("red" "orange" "yellow" "green" "blue" "purple")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment