5. New parameters in the modern function: level difficultFinally the last family of deprecated functions introduces new parameters often
unknown parameters.
As usual, the first function is the deprecated function:
(gimp-invert drawable)
(gimp-drawable-invert drawable linear) ; linear: Whether to invert in linear space (TRUE or FALSE)
The second function is the associated modern function having
linear as new last parameter.
Since there is only one occurrence of
gimp-invert in
Aqua btn, you can
manually replace it with the modern function.
However, the rewriting rule with regex could be:
Notepad++ menu "
Search" > "
Replace..."
[x]
Regular expressionFind what: The hypothesis is that the parameter
drawable is a variable but
not the result of the call of a function including parenthesis.
Replace with: gimp-drawable-invert \1 TRUE)
In line 167 of
AquaBou2_10_28.scm, AlSchemist preferred TRUE for
linear however this is an open discussion.
The final result of the generated aqua pill does not suffer to this new parameter with the modern function.
In the final example, PDB could not help anymore.
The
difficulty increases with the number of options for the new parameter code-named
operation:
(gimp-selection-layer-alpha layer)
(gimp-image-select-item image operation item) ; operation: CHANNEL-OP-ADD (0), CHANNEL-OP-SUBTRACT (1), CHANNEL-OP-REPLACE (2), CHANNEL-OP-INTERSECT (3)
The alignment indicates that layer = item.
According to the following rewriting rule, AlSchemist chose "
CHANNEL-OP-REPLACE" for
operationhowever the relationship with the selection of layer alpha is
not patent.
Notepad++ menu "
Search" > "
Replace..."
[x]
Regular expressionFind what: gimp-selection-layer-alpha\s+(\w+)
Replace with: gimp-image-select-item img CHANNEL-OP-REPLACE \1
There are four occurrences: lines 39, 52, 58 and 168.
It is up to you to test the
other alternatives if you prefer them.
This post
concludes
the series of articles about:
migrating Script-Fu deprecated functions in Gimp 2.10.28