[racket] Problem with hline in

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat May 26 10:53:51 EDT 2012

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))

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).

Robby

On Sat, May 26, 2012 at 9:48 AM, Jens Axel Søgaard
<jensaxel at soegaard.net> wrote:
> 2012/5/26 Robby Findler <robby at eecs.northwestern.edu>:
>> I think this is the result of cropping to the boundary box and the end
>> of the line is cropped on the left, but not the right (in the
>> attachment; in the program, it gets cropped along the bottom too).
>
> That's odd. The documentation on hline says the line is centered
> in its bounding box.
>
>> This looks right:
>>
>> #lang racket
>> (require slideshow)
>> (slide (scale (hline 30 1) 15))
>>
>> So if you're using this in some larger context, you need to take into
>> account the actual space of the line itself when cropping.
>
> I guess I didn't knew I was cropping :-)
>
> So when I type
>    (scale (hline 30 1) 15)
> into the interaction window, the cropping is done by pict->bitmap?
>
> How can I avoid the cropping?
>
> I tried a bunch of the bounding box adjusting functions, but no cigar.
>
> I even tried appending a blank to the left:
>    (hc-append (blank 1 1) (scale (hline 30 1) 30))
> but that didn't work either.
>
> /Jens Axel


Posted on the users mailing list.