; balloon.scm ; Creates speech balloons like in comics. ; 2004-12-08: Gimp 2 adaptation ; 2000-05-20: Initial release ; (C) Copyright 2000-2004 by Michael Spunt (define (round-balloon img drawable bw bh rect np orientation revert lw) (let* ((x 0)) (if (= np FALSE) (begin (set! x (- (* bw 0.5) (* bw 0.2))) (gimp-ellipse-select img x (* bh 0.5) (* bw 0.4) (* bh 0.4) REPLACE TRUE FALSE 0) (set! x (- (* bw 0.5) (* bw 0.2) (* bw orientation -0.1))) (gimp-ellipse-select img x (* bh 0.5) (* bw 0.4) (* bh 0.4) SUB TRUE FALSE 0))) (if (= revert FALSE) (gimp-selection-translate img (* bw orientation 0.3) 0)) (if (= rect FALSE) (gimp-ellipse-select img (* bw 0.1) (* bh 0.1) (* bw 0.8) (* bh 0.65) ADD TRUE FALSE 0)) (if (= rect TRUE) (gimp-rect-select img (* bw 0.1) (* bh 0.1) (* bw 0.8) (* bh 0.65) ADD TRUE FALSE 0)) (gimp-edit-fill drawable 0) (gimp-selection-shrink img lw) (gimp-edit-fill drawable 1))) (define (round-think-balloon img drawable bw bh rect np orientation revert lw) (let* ((x 0)) (if (= np FALSE) (begin (set! x (+ (* bw 0.5) (* bw -0.025) (* bw orientation 0.3))) (gimp-ellipse-select img x (* bh 0.85) (* bw 0.05) (* bh 0.05) REPLACE TRUE FALSE 0) (set! x (+ (* bw 0.5) (* bw -0.05) (* bw orientation 0.2))) (gimp-ellipse-select img x (* bh 0.75) (* bw 0.1) (* bh 0.1) ADD TRUE FALSE 0))) (if (= revert TRUE) (gimp-selection-translate img (* orientation bw -0.3) 0)) (if (= rect FALSE) (gimp-ellipse-select img (* bw 0.1) (* bh 0.1) (* bw 0.8) (* bh 0.65) ADD TRUE FALSE 0)) (if (= rect TRUE) (gimp-rect-select img (* bw 0.1) (* bh 0.1) (* bw 0.8) (* bh 0.625) ADD TRUE FALSE 0)) (gimp-edit-fill drawable 0) (gimp-selection-shrink img lw) (gimp-edit-fill drawable 1))) (define (script-fu-balloon bw bh rect np think right revert lw) (let* ( (orientation 1) (side 1) (img (car (gimp-image-new bw bh RGB))) (balloon (car (gimp-layer-new img bw bh RGBA-IMAGE "Balloon" 100 NORMAL)))) (if (= right FALSE) (set! orientation -1)) (gimp-image-add-layer img balloon 1) (gimp-display-new img) (gimp-edit-clear balloon) (if (= think FALSE) (round-balloon img balloon bw bh rect np orientation revert lw)) (if (= think TRUE) (round-think-balloon img balloon bw bh rect np orientation revert lw)) (gimp-selection-none img) (gimp-displays-flush))) (script-fu-register "script-fu-balloon" "/Xtns/Script-Fu/Text/Balloon" "Creates speech balloons like in comics." "Michael Spunt" "Copyright 2000-2004, Michael Spunt" "December 08, 2004" "" SF-VALUE "Width" "240" SF-VALUE "Height" "160" SF-TOGGLE "Rectangle" FALSE SF-TOGGLE "No pointer" TRUE SF-TOGGLE "Think" FALSE SF-TOGGLE "Right oriented" FALSE SF-TOGGLE "Change side" FALSE SF-VALUE "Line width" "2" )