Я недавно начал изучать схемы GIMP и написал сценарий «Создай сердце». Я хочу узнать, как создать SF-ADJUSTMENT, чтобы сделать сердце разных размеров? Я создал корректировку Высота и Ширина. Когда я запускаю скрипт, в диалоговом окне я могу изменить «ширину и высоту» и изменить размер слоя, но изображение сердца не меняется. Что я делаю не так?
(define (script-fu-create-heart imgWidth imgHeight foreground-color heart-color)
(let* (
(img (car (gimp-image-new imgWidth imgHeight RGB)))
(layer (car (gimp-layer-new img imgWidth imgHeight RGB-IMAGE "Background" 100 LAYER-MODE-NORMAL)))
(theheart (car (gimp-layer-new img imgWidth imgHeight RGB "Heart" 100 LAYER-MODE-NORMAL)))
(heartcopy 0)
(heart 0)
(theshadow (car (gimp-layer-new img imgWidth imgHeight RGB "Inner shadow" 100 LAYER-MODE-NORMAL)))
(thereflection (car (gimp-layer-new img imgWidth imgHeight RGB "Reflection" 100 LAYER-MODE-NORMAL)))
)
(gimp-context-push)
(gimp-image-undo-group-start img)
;Create the Background
(gimp-image-insert-layer img layer 0 0)
(gimp-context-set-foreground foreground-color)
(gimp-drawable-fill layer FILL-FOREGROUND)
;Create the heart layer
(gimp-image-add-layer img theheart -1)
(gimp-layer-add-alpha theheart)
(gimp-drawable-fill theheart FILL-TRANSPARENT)
;Create the the first half of the heart
(gimp-image-select-ellipse img 2 60 105 385 285)
(gimp-image-select-rectangle img 1 0 0 500 250)
(gimp-image-select-ellipse img 0 60 125 385 250)
(gimp-context-set-foreground heart-color)
(gimp-drawable-edit-fill theheart FILL-FOREGROUND)
(gimp-selection-none img)
(gimp-drawable-transform-rotate theheart 44.75 TRUE 250 250 0 2 TRUE 1 0)
(gimp-layer-resize-to-image-size theheart)
(gimp-image-select-rectangle img 2 250 0 250 500)
(gimp-edit-cut theheart)
(gimp-selection-none img)
;Create the second half of the heart
(set! heartcopy (car (gimp-layer-copy theheart TRUE)))
(gimp-image-add-layer img heartcopy -1)
(gimp-item-transform-flip-simple heartcopy 0 1 0)
(gimp-image-merge-down img heartcopy 1)
;Create a selection
(set! heartcopy (car (gimp-image-get-active-drawable img)))
(gimp-image-select-color img CHANNEL-OP-REPLACE heartcopy heart-color)
;Create inner shadow layer
(gimp-image-add-layer img theshadow -1)
(gimp-layer-add-alpha theshadow)
(gimp-drawable-fill theshadow FILL-TRANSPARENT)
;Shrink the selection and set the foreground color
(gimp-selection-shrink img 8)
(gimp-context-set-foreground '(0 0 0))
;Set the brush and the size apply
(gimp-context-set-brush "2. Hardness 100")
(gimp-context-get-brush)
(gimp-context-set-brush-size 8)
;Stroke selection and apply gaussian blur
(gimp-edit-stroke theshadow)
(gimp-selection-none img)
(plug-in-gauss RUN-NONINTERACTIVE img theshadow 48 48 1)
;Create the light reflection on the heart
;Create light reflection layer
(gimp-image-add-layer img thereflection 0)
(gimp-layer-add-alpha thereflection)
(gimp-drawable-fill thereflection FILL-TRANSPARENT)
;Draw the dot on the left side and apply gaussian blur
(gimp-image-select-ellipse img 2 150 150 25 25)
(gimp-edit-fill thereflection 2)
(gimp-selection-none img)
;Merge the top two layer
(plug-in-gauss RUN-NONINTERACTIVE img thereflection 18 18 1)
(gimp-image-merge-down img thereflection 1)
(set! theshadow (car (gimp-image-get-active-drawable img)))
(gimp-image-merge-down img theshadow 1)
(gimp-image-undo-group-end img)
(gimp-context-pop)
(gimp-display-new img)
(gimp-displays-flush)
)
)
(script-fu-register
"script-fu-create-heart"
"Create a heart"
"Creates a heart shape image"
"Pocholo"
"Pocholo"
"April 2020"
""
SF-ADJUSTMENT "Width" '(500 50 1000 1 10 0 1)
SF-ADJUSTMENT "Height" '(500 50 1000 1 10 0 1)
SF-COLOR "Foreground color" "Black"
SF-COLOR "Heart color" "Red"
)
(script-fu-menu-register "script-fu-create-heart" "<Image>/File/Create")