[racket] Annulus with dc%?

From: J. Ian Johnson (ianj at ccs.neu.edu)
Date: Fri Sep 20 15:24:40 EDT 2013

Excellent, thanks, Jens. I changed the line-to to move-to in order to not draw over the filled color.
-Ian
----- Original Message -----
From: "Jens Axel Søgaard" <jensaxel at soegaard.net>
To: "J. Ian Johnson" <ianj at ccs.neu.edu>
Cc: "users" <users at racket-lang.org>
Sent: Friday, September 20, 2013 2:11:12 PM GMT -05:00 US/Canada Eastern
Subject: Re: [racket] Annulus with dc%?



Here is one way to draw an annulus on a 400x400 bitmap 
with center (200,200) and radii 100 and 200 respectively. 


#lang racket 
( require racket/draw ) 

( define bm ( make-object bitmap% 400 400 )) 
( define dc ( new bitmap-dc% [ bitmap bm ])) 
( define p ( new dc-path% )) 

( send p move-to 300 200 ) 
( send p arc 100 100 200 200 0 ( * 2 pi )) 
( send p line-to 400 200 ) 
( send p arc 0 0 400 400 0 ( * 2 pi )) 
( send p close ) 

( define blue ( send the-color-database find-color "blue" )) 
( define blue-brush ( send the-brush-list find-or-create-brush blue 'solid )) 
( define blue-pen ( send the-pen-list find-or-create-pen blue 0 'solid )) 
( send dc set-brush blue-brush ) 
( send dc set-pen blue-pen ) 
( send dc draw-path p ) 

bm 






2013/9/20 J. Ian Johnson < ianj at ccs.neu.edu > 


I'm trying to make some visuals for a slideshow presentation, and I want to have a ring with borders (inner and outer ring borders) to draw over another image, thus a transparent center is necessary. 
I haven't been able to find a way to do this with the current API. Anyone have a suggestion (other than, "don't do that")? 

Thanks, 
-Ian 
____________________ 
Racket Users list: 
http://lists.racket-lang.org/users 




-- 
-- 
Jens Axel Søgaard 



Posted on the users mailing list.