[racket] Problem with hline in

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Sat May 26 11:09:33 EDT 2012

2012/5/26 Robby Findler <robby at eecs.northwestern.edu>:
> It is possible something is wrong with hline and/or its interaction
> with scaling, I'm not sure. But this adds enough space:
>
> #lang racket
> (require slideshow/pict)
> (hc-append (blank 15 0)
>           (vc-append (scale (hline 30 1) 30)
>                      (blank 0 15))
>           (blank 15 0))

So an educated guess on how much space to add would be
the line width times the scaling?

> I wonder if something is wrong somewhere, tho, because the bounding
> box of the above appears to have some pixels of empty space on the
> top.
>
> The space on the left and right is count for the pen cap, not the line
> itself so that seems fine.
>
> As for cropping, the DrRacket REPL is the thing that does the cropping
> (and, in some cases, it may not be cropping, actually, but two
> different parts of the window are fighting with each other for the
> pixels when something draws outside of its bounding box, as a scaled
> hline does).

Okay, I thought there was a guarantee that the drawing happened
inside the bounding box.

Something is fishy with hline or my understanding of hline though.
In order to avoid using scale I tried this:

    (pict->bitmap (hline (* 20 30) 20))

and got a one pixel line. See attached image.
(On version 5.3.0.6--2012-05-11 btw)

/Jens Axel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hline.png
Type: image/png
Size: 4448 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20120526/c87b108b/attachment.png>

Posted on the users mailing list.