<font><font face="arial,helvetica,sans-serif">By the way, the same sort of bug affects draw-ellipse and canvas%.</font></font><div><font><font face="arial,helvetica,sans-serif"><br></font></font></div><div><font><font face="arial,helvetica,sans-serif">-- Garrett Mitchener<br>
</font></font><br><div class="gmail_quote">On Thu, May 10, 2012 at 11:10 AM, Garrett Mitchener <span dir="ltr"><<a href="mailto:garrett.mitchener@gmail.com" target="_blank">garrett.mitchener@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font><font face="arial,helvetica,sans-serif">Okay, yes, using a dc-path% seems to work as intended.<br><br>Thanks!<span class="HOEnZb"><font color="#888888"><br>
<br>-- Garrett Mitchener<br></font></span></font></font><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote">On Thu, May 10, 2012 at 11:04 AM, Matthew Flatt <span dir="ltr"><<a href="mailto:mflatt@cs.utah.edu" target="_blank">mflatt@cs.utah.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Although pixel alignment can be confusing, I think this one is just a<br>
bug.<br>
<br>
The `draw-rectangle' method tries to adjust the width of an outline so<br>
that in the simple case --- a width 0 or 1 pen in unsmoothed or aligned<br>
mode with a bitmap target --- the rectangle outline is the given width<br>
and height, instead of extending an extra pixel. That adjustment isn't<br>
implemented correctly, and the problem is particularly clear with a<br>
large scaling factor.<br>
<br>
You can work around the problem by creating a rectangle `dc-path%' and<br>
drawing it with `draw-path'. Meanwhile, I'll fix `draw-rectangle'.<br>
<div><div><br>
At Thu, 10 May 2012 09:57:26 -0500, Robby Findler wrote:<br>
> The problem is that the coordinates are "between" the pixels. There is an<br>
> explanation of this in the context of another library, but the issues are<br>
> the same:<br>
><br>
><br>
> <a href="http://docs.racket-lang.org/teachpack/2htdpimage.html?q=2htdp/image#%28part._nitty-g" target="_blank">http://docs.racket-lang.org/teachpack/2htdpimage.html?q=2htdp/image#%28part._nitty-g</a><br>
> ritty%29<br>
><br>
> hth,<br>
> Robby<br>
><br>
> On Thu, May 10, 2012 at 8:29 AM, Garrett Mitchener <<br>
> <a href="mailto:garrett.mitchener@gmail.com" target="_blank">garrett.mitchener@gmail.com</a>> wrote:<br>
><br>
> > Hi, I'm learning the racket GUI package, and I ran into something that<br>
> > doesn't make sense to me:<br>
> ><br>
> > #lang racket/gui<br>
> ><br>
> > (define black-pen<br>
> > (new pen%<br>
> > [width 1]<br>
> > [color "black"]))<br>
> ><br>
> > (define blue-brush<br>
> > (new brush%<br>
> > [color "blue"]))<br>
> ><br>
> > (define (draw-test-2 dc)<br>
> > (send dc scale 10 10)<br>
> > (send dc set-pen black-pen)<br>
> > (send dc set-brush blue-brush)<br>
> > (send dc draw-rectangle 7 2 4 4))<br>
> ><br>
> > (define pic (make-bitmap 200 100))<br>
> ><br>
> > (define dc (new bitmap-dc% [bitmap pic]))<br>
> ><br>
> > (draw-test-2 dc)<br>
> ><br>
> > And at the end, pic looks like this:<br>
> ><br>
> > [image: Inline image 1]<br>
> > The outline and the filling don't line up. What am I doing wrong? This<br>
> > is with DrRacket 5.2.1 on linux.<br>
> ><br>
> > Thanks,<br>
> > -- Garrett Mitchener<br>
> ><br>
> > ____________________<br>
> > Racket Users list:<br>
> > <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
> ><br>
> ><br>
> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br></div>