GNOME Bugzilla – Bug 147836
ellipse-select antialiases poorly for eccentric ellipses
Last modified: 2004-12-22 21:47:04 UTC
This bug report arises from a discussion on GUG; see http://gug.sunsite.dk/forum/?threadid=2170. The point is that in Gimp 2.0 as well as 2.1, creating a highly eccentric ellipse with the ellipse-select tool produces a jagged-looking result, even if antialiasing is turned on; there are other programs that create much better anti-aliased ellipses. Investigation reveals that the problem is with the algorithm for anti-aliasing. It calculates the distance of a point from the ellipse boundary by measuring along a radial line starting at the center of the ellipse. If the ellipse is eccentric, this method can be way off. I have come up with a patch that instead approximates the distance by measuring the distance in the X and Y directions and then doing some basic trigonometry. As far as I can tell the result looks much better. The patch is attached below.
Created attachment 29631 [details] [review] patch for app/core/gimpchannel-combine.c Patch is against current CVS.
Looks good to me but IMO it's an enhancement and thus should only go into the HEAD branch. Please commit it there.
You should probably change the gtk-doc comment to use the enum values so that they are properly cross-linked, i.e. "add" -> %GIMP_CHANNEL_OP_ADD.
Already commited to CVS head before seeing the previous comment, but I'll do that. 2004-07-18 Bill Skaggs <weskaggs@primate.ucdavis.edu> * app/core/gimpchannel-combine.c: improve anti-aliasing for elliptical selections, as described in bug #147836.
Can you please also fix these compiler warnings: gimpchannel-combine.c:223: warning: `a' might be used uninitialized in this function gimpchannel-combine.c:223: warning: `b' might be used uninitialized in this function
*** Bug 147874 has been marked as a duplicate of this bug. ***
Not only are there compiler warnings, the compiler is also complaining for a very good reason. Variables a and b are never calculated but still happily used. As a result the new code doesn't work at all. I have a patch here that slightly improves readability of the code but since it doesn't fix the algorithm, I'll leave it up to Bill to fix this issue.
Seems to work nicely know. Closing as FIXED. 2004-07-19 Sven Neumann <sven@gimp.org> * app/core/gimpchannel-combine.c (gimp_channel_combine_ellipse): moved variable declarations to the scope they are being used in, removed trailing whitespace, minor cleanups. 2004-07-19 Bill Skaggs <weskaggs@primate.ucdavis.edu> * app/core/gimpchannel-combine.c: put in two lines accidentally omitted in previous change, improve doc comment.
I have now backported this change to the gimp-2-0 branch. It will be in the 2.0.4 release.