我正在尝试为 GIMP 编写一个基本脚本,但它似乎不想正常工作。在我做出选择后它应该遵循这个顺序:降低活动层,扩大选择 2px,用前景色填充,提高活动层。最终产品应该是我在顶层线条下方的纯色。但是使用我编写的代码,它会跳过活动层,但会在顶层而不是下面的层上填充。这是我的代码:
(define (quick-fill image drawable)
(gimp-undo-push-group-start image)
(let* ((layer (car (gimp-image-get-active-layer image))))
(gimp-selection-grow image 2)
(gimp-image-set-active-layer image (aref (cadr (gimp-image-get-layers image)) 1))
(gimp-bucket-fill drawable FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
(gimp-image-set-active-layer image (aref (cadr (gimp-image-get-layers image)) 0)))
(gimp-undo-push-group-end image)
(gimp-displays-flush))