3 ms·
I asked the same question years ago. :) The probable answer is that he thought about modeling the rectangle with rounded rects with a single mathematical expre
by bhaak 2y ago
I asked the same question years ago. :)
The probable answer is that he thought about modeling the rectangle with rounded rects with a single mathematical expression. https://news.ycombinator.com/item?id=15073696 https://news.ycombinator.com/item?id=15073696
That's probably impossible (as rounded rects are not continuous) but also completely unnecessary as you can handle the quarter circle segments and line segments separately.
- Someone 2y ago> as you can handle the quarter circle segments and line segments separately. Possibly, but that is tricky in the presence of blitting modes such as XOR; the movement you accidentally draw a pixel twice, it would get flipped twice (nowadays, with anti-aliasing, it gets really tricky, but they didn’t have that problem yet) You may want to draw the four circle segments in one go, too, as that allows you to share large parts of the computations for what pixels to touch.
- int_19h 2y agoThe algorithm used to draw the ellipse should not have any issues with accidentally overdrawing even by a single pixel if your arcs are defined in 90-degree increments. And you can, in fact, draw the four circle segments in one go, since they will all be mirror images of each other. If, instead of the absolute coordinate of the pixel, you compute the offset from the starting point, then you can compute it once, negate it as needed, and draw 4 pixels on each step.