From ce73864f2418680f76a8a3f31a2bcc33fca68f43 Mon Sep 17 00:00:00 2001 From: siddharth ravikumar Date: Sun, 19 Jun 2022 17:29:15 -0400 Subject: static: update peach.rkt Refactor so that it will be possible to generate the logo in different sizes. --- static/logo/peach.png | Bin 11642 -> 11617 bytes static/logo/peach.rkt | 23 +++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/static/logo/peach.png b/static/logo/peach.png index f47deb6..3673d06 100644 Binary files a/static/logo/peach.png and b/static/logo/peach.png differ diff --git a/static/logo/peach.rkt b/static/logo/peach.rkt index cfd6e11..98e01e0 100644 --- a/static/logo/peach.rkt +++ b/static/logo/peach.rkt @@ -13,18 +13,25 @@ (send dc set-brush "black" 'solid)) ;; Draws a moon. -(define (moon-drawing) - (let ((moon (new dc-path%))) - (send moon arc -50 50 320 320 1.57 4.36 #f) - (send moon arc 1 4 490 490 3.54 2.20 #t) +(define (moon-drawing size) + (let* ((moon (new dc-path%)) + (inner-arc-x (/ (* size -50) 500.0)) + (inner-arc-y (* -1 inner-arc-x)) + (inner-arc-size (/ (* size 320) 500.0)) + (outer-arc-x (/ (* size 5) 500.0)) + (outer-arc-y outer-arc-x) + (outer-arc-size (/ (* size 490) 500.0))) + (send moon arc inner-arc-x inner-arc-y inner-arc-size inner-arc-size 1.57 4.36 #f) + (send moon arc outer-arc-x outer-arc-y outer-arc-size outer-arc-size 3.54 2.20 #t) moon)) ;; Draws the peach logo in a bitmap and returns the bitmap. -(define (draw-logo) - (let* ((target (make-bitmap 500 500)) +(define (draw-logo size) + (let* ((target (make-bitmap size size)) (dc (new bitmap-dc% (bitmap target)))) (setup-dc dc) - (send dc draw-path (moon-drawing)) + (send dc set-brush "black" 'solid) + (send dc draw-path (moon-drawing size)) target)) ;; Exports the logo into PNG. @@ -32,7 +39,7 @@ (send logo save-file "peach.png" 'png)) ;; Peach logo as a bitmap. -(define peach-logo (draw-logo)) +(define peach-logo (draw-logo 500)) ;; Render logo in racket shell. (make-object image-snip% peach-logo) -- cgit v1.2.3