[racket] draw circle over bitmap and erase old circle

From: kty1104 at gmail.com (kty1104 at gmail.com)
Date: Wed Oct 27 22:48:15 EDT 2010

hello
I finally circle the bitmap where I point by mouse
but there are several problem
1. the circle filled with white color that I can't see bitmap through the  
circle
2. the drawn circle didn't erased after I point another coordinates

could somebody give me an little advice?

my code looks messy and not neat but
I paste the code for make it easier to understand


#lang scheme
(require 2htdp/image
racket/gui)
(define chipset (make-object bitmap% "town.png" 'png))
(define (check dc m)
(define x (send m get-x))
(define y (send m get-y))
(send dc draw-ellipse (- x (modulo x 16)) (- y (modulo y 16)) 16 16))
(define f (new frame% (label "map editor")))
(define xymsg (new message% (label "nth so far") (parent f)))
(define select%
(class canvas%
(override on-event on-paint)
(define on-paint (λ () (send (send this get-dc) draw-bitmap chipset 0 0)))
(define on-event (λ (m)
(send xymsg set-label
(string-append "x:"
(number->string (send m get-x))
" y:"
(number->string (send m get-y))))
(when (send m get-left-down) (check (send this get-dc) m))))

(super-new )
))
(new select% (parent f) (min-width (image-width chipset)) (min-height  
(image-height chipset)) )
(send f show #t)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101028/e511f55e/attachment.html>

Posted on the users mailing list.