Borders in pict

22 views
Skip to first unread message

Hendrik Boom

unread,
Sep 2, 2019, 9:18:06 PM9/2/19
to us...@racket-lang.org
With rectangle and filled-rectangle, I can specify a border width:

(rectangle 100 100 #:border-width 5)

Does that border sit inside the 100 x 100 rectangle, or is it around the
rectangle making the result take 110 x 110 pixels. I can't see where this
is specified in the documentation.

-- hendrik

Ben Greenman

unread,
Sep 2, 2019, 10:22:09 PM9/2/19
to Hendrik Boom, us...@racket-lang.org
Inside

Welcome to Racket v7.4.0.1.
> (require pict)
> (pict-width (rectangle 100 100 #:border-width 5))
100
> (pict-height (rectangle 100 100 #:border-width 5))
100

Robby Findler

unread,
Sep 3, 2019, 7:23:55 AM9/3/19
to Ben Greenman, Hendrik Boom, us...@racket-lang.org
These change the pen width and I believe the pen sits right on the border of the rectangle. As Ben points out, they don't affect the width and height of the pict, but picts draw outside their bounding box sometimes. 

Robby

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAFUu9R5ngc%2BUdL_pPCLARkO2ZDeXq6CPXMrYZpiAgJ1RgstoqQ%40mail.gmail.com.

Hendrik Boom

unread,
Sep 3, 2019, 8:10:55 AM9/3/19
to Robby Findler, us...@racket-lang.org
On Tue, Sep 03, 2019 at 06:23:41AM -0500, Robby Findler wrote:
> These change the pen width and I believe the pen sits right on the border
> of the rectangle. As Ben points out, they don't affect the width and height
> of the pict, but picts draw outside their bounding box sometimes.

So the drawn border would sit across the edge of the rectangle, some of
it inside and some of it outside. That would explain the variation in
line widths I see because the border is later clipped to the size of the
rectangle.

Thank you.

-- hendrik
Reply all
Reply to author
Forward
0 new messages