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 109475 - script-fu-selection-round is off by one in certain cases
script-fu-selection-round is off by one in certain cases
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Script-Fu
unspecified
Other All
: Normal minor
: ---
Assigned To: GIMP Bugs
Daniel Egger
Depends on:
Blocks:
 
 
Reported: 2003-03-29 05:08 UTC by Pedro Gimeno
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch for the off-by-one bug in selection-round.scm (1.51 KB, patch)
2003-03-29 05:12 UTC, Pedro Gimeno
none Details | Review
New patch for the off-by-one selection-round bug (730 bytes, patch)
2003-03-29 06:42 UTC, Pedro Gimeno
none Details | Review
Patch to add the trunc function to Script-Fu and solve bug #109475 the right way. (1.62 KB, patch)
2003-04-10 12:49 UTC, Pedro Gimeno
none Details | Review

Description Pedro Gimeno 2003-03-29 05:08:12 UTC
When making a rectangle with round bordes using script-fu-selection-round
it sometimes creates a non-antialiased step, clearly visible when
activating qmask.

How to reproduce:

 1. Create a new image.
 2. Create a rectangular selection inside it.
 3. Select <image>/Script-Fu/Selection/Round...
 4. Set the relative radius to 0.2 and press OK.
 5. Activate QuickMask.

A zoom on the bottom or rightmost part of the rectangle will reveal an
aliased step near the end of the circle.

It seems to be caused by a problem with rounding in the script. Happens in
all versions. Patch follows.
Comment 1 Pedro Gimeno 2003-03-29 05:12:03 UTC
Created attachment 15292 [details] [review]
Proposed patch for the off-by-one bug in selection-round.scm
Comment 2 Pedro Gimeno 2003-03-29 06:40:50 UTC
Oops! The patch above breaks it the other way around (e.g. when radius
= 0.5). Would need a (truncate x) function, but in its absence the
following patch solves the problem. Forget about the +1 in the
previous patch.
Comment 3 Pedro Gimeno 2003-03-29 06:42:02 UTC
Created attachment 15293 [details] [review]
New patch for the off-by-one selection-round bug
Comment 4 Sven Neumann 2003-03-30 19:17:56 UTC
IIRC, SIOD has the trunc procedure. Why doesn't your patch use that
instead of the ugly hack?
Comment 5 Pedro Gimeno 2003-03-31 00:27:42 UTC
The SIOD docs say that there is a function called trunc (even if the
standard one is truncate, according to r5rs; ref:
<http://www.swiss.ai.mit.edu/~jaffer/r5rs_8.html#SEC55>) but it seems
not to be implemented in Gimp. Apart from the fact that it does not
work in the console, doing `grep -ri "trunc" plug-ins/script-fu'
returns no results. I couldn't figure out any other way to do the same.
Comment 6 Sven Neumann 2003-03-31 10:00:57 UTC
It seems you are right and we lack the trunc function. It would be
worth to add the implementation and I think it should be rather trivial.
Comment 7 Pedro Gimeno 2003-04-10 12:49:39 UTC
Created attachment 15611 [details] [review]
Patch to add the trunc function to Script-Fu and solve bug #109475 the right way.
Comment 8 Sven Neumann 2003-04-10 13:38:12 UTC
Is there any reason why your patch doesn't use trunc(3) to implement
trunc?
Comment 9 Sven Neumann 2003-04-10 13:45:40 UTC
Ah, I see, trunc(3) is only in C99. I've applied your patch as is:

2003-04-10  Sven Neumann  <sven@gimp.org>

  * plug-ins/script-fu/interp_sliba.c
  * plug-ins/script-fu/scripts/selection-round.scm: applied a patch
  from Pedro Gimeno that adds the trunc() function to our scheme
  interpreter and fixes bug #109475 the right way.