[racket] draw circle over bitmap and erase old circle

From: Richard Cleis (rcleis at mac.com)
Date: Thu Oct 28 01:53:44 EDT 2010

Insert the two lines below to see that what you want is possible, but I doubt such a quick hack is the right way to do it. 

rac

On Oct 27, 2010, at 8:48 PM, kty1104 at gmail.com wrote:

> 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)


 (send dc draw-bitmap chipset 0 0)
 (send dc set-brush "blue" 'transparent)



> (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)_________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users



Posted on the users mailing list.