1 2011-09-30 09:57

Тема: Программирование: не работает скрипт (script-fu)

(define (script-fu-border ?)
(let* ((img (car (gimp-drawable-get-image ?)))
(owidth (car (gimp-image-width img)))
(oheight (car (gimp-image-height img)))
(border (car (if (< oheight owidth) (* 2 (round (/ oheight 25))) (* 2 (round (/ owidth 25))) )))
(width (+ owidth border))
(height (+ height border))
(layer (car (gimp-layer-new img width height 0 “Border-Layer” 100 BEHIND-MODE))) )
(gimp-image-undo-group-start img)
(gimp-image-add-layer img layer 0)
(gimp-image-undo-group-end img) ))
(script-fu-register 
“script-fu-border”
“script-fu-border”
“”
“”
“”
“”
“”
“RGB”)
(script-fu-menu-register 
“script-fu-border”
“/Filters/My scripts”)

2 2011-10-05 10:24

Re: Программирование: не работает скрипт (script-fu)

Видимо нужно что-то такое:

(define
    (script-fu-border
        Image
        Drawable
    )

    (let* 
        (
        (Width_In (car (gimp-drawable-width Drawable)))
        (Height_In (car (gimp-drawable-height Drawable)))
        (Border (if (> Width_In Height_In) (round(/ Height_In 25)) (round(/ Width_In 25))))
        (New_Width (+ Width_In (* 2 Border)))
        (New_Height (+ Height_In (* 2 Border)))
        )

        (gimp-image-undo-group-start Image)
        (gimp-image-resize Image New_Width New_Height Border Border)
        (gimp-image-flatten Image)
        (gimp-displays-flush) 
        (gimp-image-undo-group-end Image)
    )
)

(script-fu-register "script-fu-border"
            _"<Image>/My-Fu/Border..."
            "Border"
            "BigBoots <tarnoga@gmail.com>"
            "Vladimir Golovin"
            "2011/10/05"
            "*"
            SF-IMAGE "Image" 0
            SF-DRAWABLE "Drawable" 0
)

3 2011-10-05 10:31

Re: Программирование: не работает скрипт (script-fu)

Спасибо, заработало)