Is it possible to output a drawing made with the draw module or Metapict or the turtle graphics library to a file such as png or jpeg?
1 Like
The save-pict function from metapict can be used to save picts as png files (or jpeg for that matter).
Do you mean something like that:
#lang racket
(require pict)
(require racket/draw)
(require pict-abbrevs)
(define points '((100 . 100) (0 . 0)))
(define (connect-points dc dx dy join)
(define a-pen
(send the-pen-list find-or-create-pen "black" 10 'solid 'round join))
(send dc set-pen a-pen)
(send dc draw-lines points dx dy))
(define a-dc
(dc
(λ (dc dx dy)
(define old-pen (send dc get-pen))
(connect-points dc 20 50 'round)
(send dc set-pen old-pen))
460 170))
(save-pict "foo.png" a-dc 'png)