Align both brush and pen drawing in draw-ellipse - #26
Conversation
For some reason, draw-ellipse went out of its way to *not* align coordinates when drawing with the brush, but that doesn’t make a lot of sense. Not only is it weird and inconsistent, it could cause problems where the stroke would actually get drawn inside the boundary of the ellipse, leaving part of the fill peeking out from “under” the edge. This just aligns both sets of coordinates, which is more consistent and fixes the problem.
|
I think it's not just I forget why things work the way they do, and I'll try to remember. |
Ah, it seems like you’re right—I hadn’t even thought to check! I didn’t gather that from the documentation, though rereading it again, it doesn’t contradict what you’re saying, either. The trouble going on here really only happens because I’m drawing to a I’d still like to understand why strokes are aligned but fills are not, but I’d be satisfied with an amendment to the documentation. |
|
When I try then it looks bad to me in 'aligned mode with or without the patch. Consistent alignment seems to require My best guess at the explanation for the current state: it took me a long time to sort out the pen-width correction (along the same lines as your patch for drawing dots), and older drawing backends used to have different rules. Long enough ago, trying to align functions for pen and brush drawing produced worse results, either because the alignment functions still weren't right or the backend was uncooperative. Although I'm reluctant to change drawing calculations that have been in place a long time, it's worth exploring whether using brush alignment (the right one, consistently) would be better than the current state. Are you interested in exploring that more? If so, along with whatever else you look at, |
What you’ve said makes sense to me. I may be interested in exploring that further, especially if I run into further issues, but it is admittedly a larger undertaking than I’m likely to pursue right now. I have thought a little more about this issue since your previous comment, and the question I asked still seems relevant: would it make sense to simply not use Doing something like changing the default alignment mode of |
|
Using |
|
Alright. I’m going to close this PR, since either way, it doesn’t seem right. I’ll experiment with the slideshow change, and I may open a PR there if it seems to work out. |
Using the 'aligned alignment mode doesn't make sense when printing, since the PS/PDF output is scalable, and the pixel grid it will be rasterized to is not known. Also see the discussion in racket/draw#26.
Using the 'aligned alignment mode doesn't make sense when printing, since the PS/PDF output is scalable, and the pixel grid it will be rasterized to is not known. Also see the discussion in racket/draw#26.
For some reason,
draw-ellipsegoes out of its way to not align coordinates when drawing with the brush, but that doesn’t make a lot of sense. Not only is it weird and inconsistent, it can cause problems where the stroke would actually get drawn inside the boundary of the ellipse, leaving part of the fill peeking out from “under” the edge. Here’s a highly zoomed-in example:Here, I’ve drawn a circle with a white fill and a grey stroke, superimposed on top of a black line. You can see that the edge of the fill is not fully covered by the stroke, so there’s an extra white fringe.
This PR just aligns both sets of coordinates, which is more consistent and fixes the problem. Here’s the same example with this change: