[racket] New turtle graphics package + a few questions

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Feb 19 09:07:35 EST 2013

On Feb 19, 2013, at 6:00 AM, Daniel Prager wrote:

> I've written an interactive turtle graphics package, complete with
> animated turtle imagery, aimed at Dr Racket using parents with elementary-school aged kids.



Thanks, that's great. In what way did you find the existing one lacking? 


> 1. Code organization:


As Sam said. 



> 2. How do I turn an image built up from (empty-scene ...) into a bitmap% ?  I want to use (write-animated-gif ...) to make a few animated gifs to spruce up my documentation.

 #lang racket/gui

(require 2htdp/image mrlib/gif)

(define width 100)
(define height 80)

(define image 
  (overlay
   (rectangle (- width 10) (-  height 10) 'solid 'red)
   (rectangle width height 'solid 'blue)))

image

(define bm (make-object bitmap% width height))
(define dc (make-object bitmap-dc% bm))
(send dc clear)
(send image draw dc 0 0 0 0 width height 0 0 #f)

(define file "/tmp/foo.gif")
(when (file-exists? file) (delete-file file))

(write-animated-gif (list bm bm) 5 file)



> Finally, is this the kind of thing that would be worth putting up on PLaneT straight-away, or better to mature it a bit on github?


Consider keeping it on github and turning it into a Planet2 package (beta) instead of Planet1. 

-- Matthias






Posted on the users mailing list.