我想创建一个像notebooke纸这样的图像,我认为如果绘制线条的部分是自动化的,这很容易。
为了做到这一点,我决定使用名为 'gimp-rect-select' 的 gimp 函数并指定小的高度值。
我用谷歌搜索并编写了一个方案文件,但是当我从 gimp 的 Script-Fu 菜单运行它时,gimp 向我显示了如下消息。
Error while executing FU01-multi-rect-select:
Error: ( : 1)
Invalid number of arguments for gimp-rect-select
(expected 8 but received 9)
我想让你看看我的第一个脚本,并指出哪里出了问题。
对我来说,我的自定义函数被定义为有 8 个参数,而不是 9 个。以下是我的代码
(define (FU01-multi-rect-select
image
drawable
x1
y1
w
h
p-offset
p-repeat
)
;definition of variables
(let*
(
(X nil)
(Y nil)
(width nil)
(height nil)
(offset nil)
(repeat nil)
;are they below necessary?
(theLayer nil)
(theImage nil)
)
;(gimp-context-push )
(gimp-image-undo-group-start image)
;(set! X (string->number x1))
;(set! Y (string->number y1))
;(set! width (string->number w))
;(set! height (string->number h))
;(set! offset (string->number p-offset))
;(set! repeat (string->number p-repeat))
(set! X x1)
(set! Y y1)
(set! width w)
(set! height h)
(set! offset p-offset)
(set! repeat p-repeat)
(gimp-image-set-active-layer image drawable)
(set! theLayer
(car (gimp-image-get-active-layer image) )
)
; select rectangle and after that,
; add it to current selection
; multiple times that is specified with 'repeat'
(while (> repeat 0)
(gimp-rect-select image X Y width height
CHANNEL-OP-ADD FALSE 0 0)
(set! Y (+ Y height offset))
(set! repeat (- repeat 1))
)
(gimp-image-undo-group-end image)
) ; end of let sentences
)
(script-fu-register "FU01-multi-rect-select"
"<Image>/Script-Fu/Select/multi rect select"
"add a rect selection to current selection multiple times\
each time a rect is selected it is moved\
in y axis by the value of offset"
"Masaaki Fujioka"
"copy right 2014 Masaaki Fujioka"
"August 3 2014"
"*"
SF-IMAGE "SF-IMAGE" 0
SF-DRAWABLE "SF-DRAWABLE" 0
SF-VALUE "start x" "0"
SF-VALUE "start y" "0"
SF-VALUE "width" "0"
SF-VALUE "height" "0"
SF-VALUE "offset" "0"
SF-VALUE "repeat" "0"
)