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


On 9/10/2019 8:12 AM, Robby Findler wrote:
Another trick I use is to crop the picture that is nominally below the image and then just draw it again, but this time on top.

Robby

On Mon, Sep 9, 2019 at 2:15 PM Jens Axel Søgaard <jensa...@soegaard.net <mailto:jensa...@soegaard.net>> wrote:

    You can use a path with an even-odd-fill to cut out parts.

    An example:

    #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)
        (brushstipple (pict->bitmap p)
                      (eofill (rectangle (pt 0 0) (pt w h))
                              (circle x y r)))))

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

    /Jens Axel

    The result (the yellowish color is the background color in my editor):

    image.png


    Den man. 9. sep. 2019 kl. 20.20 skrev Hendrik Boom
    <hend...@topoi.pooq.com <mailto:hend...@topoi.pooq.com>>:

        I'm wondering how to cut a transparent hole in something.

        Say I have a rectangle and I want to make part of it
        transparent so
        that I cn see what's behind it.
        Drawing a transparent rectangle on top of it won't workm
        because it'll
        just reveal the original rectangle.
        The only way I cn see it to draw the original rectangle in
        pieces,
        careful avoiding the area I want to make transparent. (that
        may be
        tricky if the transparent area is, say, a circle).

        Is there some convenient operation in Pict that can accomplish
        this
        more directly?  Kind of the union and intersection and
        complementation
        on constructive solid geometry, but now 2D.

        My guess is no.  I haven't found it.  So I ask.

        Maybe I'll need some other drawing tool than Pict. Suggestions
        welcome.

        -- hendrik

-- 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 racket-users+unsubscr...@googlegroups.com
        <mailto:racket-users%2bunsubscr...@googlegroups.com>.
        To view this discussion on the web visit
        
https://groups.google.com/d/msgid/racket-users/20190909182018.74o322qfwehrmqaz%40topoi.pooq.com.



-- -- Jens Axel Søgaard

-- 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 racket-users+unsubscr...@googlegroups.com
    <mailto:racket-users+unsubscr...@googlegroups.com>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/racket-users/CABefVgy0cxZD1dJv6dA51_rTEFqk3wu-zBSpGdQV-eD1fmurag%40mail.gmail.com
    
<https://groups.google.com/d/msgid/racket-users/CABefVgy0cxZD1dJv6dA51_rTEFqk3wu-zBSpGdQV-eD1fmurag%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
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 racket-users+unsubscr...@googlegroups.com <mailto:racket-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAL3TdOMM1rPLCGyicrcEv50USDaHmtOs-hPo4r%2BaKCACAgJw%3Dw%40mail.gmail.com <https://groups.google.com/d/msgid/racket-users/CAL3TdOMM1rPLCGyicrcEv50USDaHmtOs-hPo4r%2BaKCACAgJw%3Dw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
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 racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/a8e5c22e-08d6-0839-1b22-cebe912aa409%40comcast.net.

Reply via email to