Snippets

Created by Nathaniel Knight
#lang racket
(require racket/draw)

(define xmax 200)
(define ymax (exact-round (/ xmax 1.61)))
(define offset (* xmax 0.08))

(define logo-pen (new pen%
                     [color "black"]
                     [style 'solid]
                     [width offset]
                     [cap 'butt]
                     [join 'miter]))
(define logo-brush (new brush%
                        [style 'transparent]))

(define (draw-logo dc dx dy)
  (send dc set-pen logo-pen)
  (send dc set-brush logo-brush)
  (send dc set-smoothing 'aligned)
  (let ([p (new dc-path%)]
        [x (- xmax offset)]
        [y (- ymax offset)])
    (send p move-to offset offset)
    (send p line-to x y)
    (send p line-to x offset)
    (send p line-to offset y)
    (send p close)
    (send dc draw-path p)))


;Draw
(define b (make-bitmap xmax ymax))
(define bdc (new bitmap-dc% [bitmap b]))
(draw-logo bdc xmax ymax)
(send b save-file "./nk-logo.png" 'png)

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.