On Fri, 21 Jan 2005 01:04:12 +0100, Martijn Sipkema <[EMAIL PROTECTED]> wrote: > On Wed, 2005-01-19 at 21:07 -0500, Timothy Miller wrote: > > On Thu, 20 Jan 2005 02:03:09 +0100, Martijn Sipkema <[EMAIL PROTECTED]> > > wrote: > > > > What we want to do is compute coverate and turn it into alpha. Well, > > > > let's think about this for a moment. Any pixel that aligns exactly with > > > > the center of the line should have alpha of 1.0. Any pixel completely > > > > off the line should have alpha of 0, and any pixel which lies on the > > > > edge of the line should have alpha of 0.5. Why not draw a polygon which > > > > varies alpha from 1.0 at the center to 0.0 at the line width away from > > > > the center? > > > > > > That clearly won't give anything resembling the coverage. If you want to > > > use a polygon for (wide) lines, then you should just use a smooth polygon, > > > given that that is implemented. This won't even work correctly for width > > > 1.0 lines as a horizontal/vertical line at integer coordinate won't show. > > > You should be able to find an algorithm for smooth width 1.0 lines in > > > books/articles; the Gupta-Sproull algorithm seems to be suitable. > > > > Well, I've actually done a bit of work in the past on antialiased > > lines. I've implemented a number of different algorithms, etc. > > Having looked at a lot of them under zoom magnification, I think I > > have a pretty good idea of what to expect. > > > > That being said, I looked at the results from a few test cases, and > > they all looked like how I expected them to look. > > > > And I'm afraid you're incorrect about the horizontal/vertical lines. > > Try it. They show up just fine. With a vertical line at integer > > coordinates, you get a two-pixel-wide line, and each column is 50% > > gray. This is exactly right. (Well, actually if you take gamma into > > account, it should be 75%, but that's a whole other issue.) > > > > I think you need to look closer at the algorithm. A 1-pixel-wide line > > is rendered as a polygon which is TWO pixels wide, but since the alpha > > interpolates toward zero, out from the center, it's zero at the far > > edge, making it APPEAR 1 pixel wide, which is exactly what you want. > > And any pixel which lands in between shows up as some gray which > > matches the coverage value. As far as I can judge, diagrammatically > > and visually, it produces correct results. > > You are right of course. I shouldn't have posted at 02:00 after having > consumed a considerable amount of alcohol.. :)
The hardship is yours and yours alone. :) We, on the other hand, were very amused... to your credit. :) > > > I diagrammed it out, and as far as I can judge, you should get exactly > > the right results for all pixels if the width is 1.0. But it ONLY > > works for width 1.0. Wider lines are a bit more complex, because this > > gradient alpha occurs only at the far edges, while there's a solid > > rectangle in the center. > > Not exactly right, but it doesn't look bad. > > > And what do you mean that smooth polygons is what is implemented? I > > didn't implement smooth polygons. > > What I meant was that smooth wide lines can be implemented using > smooth polygons---if these are implemented that is. I've been told not to bother. And it's getting a little late for it to become a requirement. _______________________________________________ Open-graphics mailing list [email protected] http://lists.duskglow.com/mailman/listinfo/open-graphics List service provided by Duskglow Consulting, LLC (www.duskglow.com)
