[racket] question about dc% and scale

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu May 10 10:57:26 EDT 2012

The problem is that the coordinates are "between" the pixels. There is an
explanation of this in the context of another library, but the issues are
the same:


http://docs.racket-lang.org/teachpack/2htdpimage.html?q=2htdp/image#%28part._nitty-gritty%29

hth,
Robby

On Thu, May 10, 2012 at 8:29 AM, Garrett Mitchener <
garrett.mitchener at gmail.com> wrote:

> Hi, I'm learning the racket GUI package, and I ran into something that
> doesn't make sense to me:
>
> #lang racket/gui
>
> (define black-pen
>   (new pen%
>        [width 1]
>        [color "black"]))
>
> (define blue-brush
>   (new brush%
>        [color "blue"]))
>
> (define (draw-test-2 dc)
>   (send dc scale 10 10)
>   (send dc set-pen black-pen)
>   (send dc set-brush blue-brush)
>   (send dc draw-rectangle 7 2 4 4))
>
> (define pic (make-bitmap 200 100))
>
> (define dc (new bitmap-dc% [bitmap pic]))
>
> (draw-test-2 dc)
>
> And at the end, pic looks like this:
>
> [image: Inline image 1]
> The outline and the filling don't line up.  What am I doing wrong?  This
> is with DrRacket 5.2.1 on linux.
>
> Thanks,
> -- Garrett Mitchener
>
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120510/6854fb08/attachment-0001.html>

Posted on the users mailing list.