dinasset wrote:
Saul,
the problem IMO is as follows:
- the value returned from round is considered an exact integer but is interpreted in an incorrect manner by some filters.
:
:
:
- passing the result of the same division using the scheme function round it gets 4.0 which is accepted but interpreted as 40! hence the filter works badly
I am wondering what you are seeing to indicate that the line width is interpreted as "40". If this is true, there is likely a bug in the engrave script. I have not delved into the script to find what might be wrong, but I do notice a misapprehension in the author's description of the SF-ADJUSTMENT statement.
Quote:
SF-ADJUSTMENT "Line width" '(25 3 127 1 5 0 1) ; List (start-value min-value max-value small-step large-step [int=0 or float=1] [slider=0 or roll-box=1])
The highlighted parameter has nothing to do with determining whether the result is an integer or a float, it is the number of fractional digits that should appear in the
displayed number (e.g., 0="1", 1="1.0", 2="1.00", 3="1.000"). Regardless of that parameter's value, the number passed to the script is the fully accurate floating point value (it is never an integer).
Try the following code to see what I am struggling to convey (unless you already know all this):
(define (test x)
(gimp-message (number->string x)))
(script-fu-register "test"
"Test..."
""
"Saul Goode"
"Saul Goode"
"December 2014"
""
SF-ADJUSTMENT "Test" '(0 0 1 1 1 0 0)
)
(script-fu-menu-register "test"
"<Image>/Filters/Misc"
)
Even though the displayed number is an integer -- either "0" or "1" depending upon which half of the slider you're on -- the value passed to the script is a full-precision floating point number ("0.3124142857", for example). If you change the SF-ADJUSTMENT configuration to
'(0 0 1 1 1 4 0) then the displayed value will be shown accurate to a ten thousandth of a unit (e.g., "0.3124") but the script will still receive the fully accurate floating point value.
It is up to the script to convert such arguments to their intended precision. If the script requires an integer then it should round or truncate the supplied floating point number.