After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 147836 - ellipse-select antialiases poorly for eccentric ellipses
ellipse-select antialiases poorly for eccentric ellipses
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Tools
git master
Other Linux
: Normal enhancement
: 2.0
Assigned To: GIMP Bugs
GIMP Bugs
: 147874 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-07-18 19:04 UTC by weskaggs
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for app/core/gimpchannel-combine.c (8.19 KB, patch)
2004-07-18 19:05 UTC, weskaggs
none Details | Review

Description weskaggs 2004-07-18 19:04:30 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.
Comment 1 weskaggs 2004-07-18 19:05:55 UTC
Created attachment 29631 [details] [review]
patch for app/core/gimpchannel-combine.c

Patch is against current CVS.
Comment 2 Sven Neumann 2004-07-18 19:21:14 UTC
Looks good to me but IMO it's an enhancement and thus should only go into the
HEAD branch. Please commit it there.
Comment 3 Sven Neumann 2004-07-18 19:28:38 UTC
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.
Comment 4 weskaggs 2004-07-18 19:37:29 UTC
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.
Comment 5 Sven Neumann 2004-07-18 20:45:03 UTC
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
Comment 6 Sven Neumann 2004-07-19 10:11:23 UTC
*** Bug 147874 has been marked as a duplicate of this bug. ***
Comment 7 Sven Neumann 2004-07-19 13:16:37 UTC
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.
Comment 8 Sven Neumann 2004-07-19 14:27:16 UTC
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.
Comment 9 Sven Neumann 2004-07-19 18:42:20 UTC
I have now backported this change to the gimp-2-0 branch. It will be in the
2.0.4 release.