Den tir. 10. sep. 2019 kl. 14.54 skrev George Neuner <>:

> Or create a region with a hole through it and use it to clip the drawing.

Great suggestion. That's much better than using pict->bitmap.

I have extended "clipped" to handle regions defined by more than one path.
Now (clipped c ... p) will make a region from the curves c ... and use
the region to clip the pict p. Most common uses:

   (clipped c p)          the part of p inside c
   (clipped c1 c2 p)   the part of p between c1 and c2 (if c2 is inside c1)

The example now becomes:

#lang racket
(require metapict metapict/polygons)

(define (cutout p x y r)
  (defv (w h) (pict-size p))
  (with-window (window 0 w 0 h)
    (clipped (rectangle (pt 0 0) (pt w h))
             (circle (pt x y) r)

(set-curve-pict-size 400 400)
(def p (brushcolor "red" (fill (regular-polygon 5))))
(cutout p 200 200 50)

Before only one curve was supported and the result of clipped was the
so the old clipped couldn't cut holes.

/Jens Axel

You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To view this discussion on the web visit

Reply via email to