; Comix Bubble rel 0.01 ; Created by Graechan ; Comments directed to http://gimpchat.com or http://gimpscripts.com ; ; License: GPLv3 ; This program is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; To view a copy of the GNU General Public License ; visit: http://www.gnu.org/licenses/gpl.html ; ; ; ------------ ;| Change Log | ; ------------ ; Rel 0.01 - Initial Release (define (script-fu-comix-bubble img-width img-height shape type orientation outline-color bubble-fill bubble-color shadow conserve) (let* ( (image (car (gimp-image-new img-width (+ img-height (/ img-height 1.85)) RGB))) (width (car (gimp-image-width image))) (height (car (gimp-image-height image))) (image-layer 0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (x 0) ) (gimp-context-push) (gimp-context-set-default-colors) (set! image-layer (car (gimp-layer-new image width height RGBA-IMAGE "Background" 100 NORMAL-MODE))) (gimp-image-add-layer image image-layer 1) ;;;;begin the script;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;create the speach bubble (if (= type 0) (begin (set! x (- (* width 0.5) (* width 0.2))) (gimp-ellipse-select image x (* height 0.5) (* width 0.4) (* height 0.4) 2 TRUE FALSE 0) (set! x (- (* width 0.5) (* width 0.2) (* width 1 -0.1))) (gimp-ellipse-select image x (* height 0.5) (* width 0.4) (* height 0.4) 1 TRUE FALSE 0) (if (< orientation 2) (gimp-selection-translate image (* width 1 0.3) 0)))) ;;;;create the thought bubble (if (= type 1) (begin (set! x (+ (* width 0.5) (* width -0.025) (* width 1 0.3))) (gimp-ellipse-select image x (* height 0.85) (* width 0.05) (* height 0.05) 2 TRUE FALSE 0) (set! x (+ (* width 0.5) (* width -0.05) (* width 1 0.2))) (gimp-ellipse-select image x (* height 0.75) (* width 0.1) (* height 0.1) 0 TRUE FALSE 0) (if (= orientation 2) (gimp-selection-translate image (* 1 width -0.3) 0)))) ;;;;create the bubble shape (if (= shape 0) (gimp-ellipse-select image 0 0 width img-height 0 TRUE FALSE 0)) (if (= shape 1) (gimp-rect-select image 0 0 width img-height 0 FALSE 0)) (if (= shape 2) (gimp-round-rect-select image 0 0 width img-height 50 50 0 TRUE FALSE 0 0)) ;;;;create the outline (gimp-context-set-foreground outline-color) (gimp-edit-fill image-layer FOREGROUND-FILL) ;;;;create the bubble fill (if (= bubble-fill TRUE) (begin (gimp-selection-shrink image 2) (gimp-context-set-background bubble-color) (gimp-edit-fill image-layer BACKGROUND-FILL))) (gimp-selection-none image) (if (= orientation 0) (gimp-drawable-transform-flip-simple image-layer 0 TRUE 0 FALSE)) (if (= bubble-fill FALSE) (begin (gimp-selection-layer-alpha image-layer) (gimp-selection-shrink image 2) (gimp-edit-clear image-layer) (gimp-selection-none image))) ;;;;add the drop shadow (if (= shadow TRUE) (begin (script-fu-drop-shadow image image-layer 8 8 15 '(0 0 0) 80 TRUE))) ;;;;finish the script;;;;;;;;;;;;;;;;;;;;;;;;;;; (if (= conserve FALSE) (begin (set! image-layer (car (gimp-image-merge-visible-layers image EXPAND-AS-NECESSARY))) (gimp-drawable-set-name image-layer "Comix Bubble"))) (gimp-display-new image) (gimp-displays-flush) (gimp-context-pop) ) ) (script-fu-register "script-fu-comix-bubble" "Comix Bubble" "Instructions" "Graechan" "Graechan - http://gimpchat.com" "Oct 2012" "" SF-ADJUSTMENT "Bubble width (pixels)" '(600 1 1000 1 10 0 1) SF-ADJUSTMENT "Bubble height(pixels)" '(400 1 1000 1 10 0 1) SF-OPTION "Bubble Shape" '("Ellipse" "Rectangle" "Rounded Rectangle") SF-OPTION "Bubble Type" '("Speech" "Thought") SF-OPTION "Bubble Orientation" '("Left" "Right" "Centre") SF-COLOR "Outline Color" '(0 0 0) SF-TOGGLE "Color the Bubble" TRUE SF-COLOR "Bubble Color" '(255 255 255) SF-TOGGLE "Add a Drop Shadow" FALSE SF-TOGGLE "Keep the Layers" FALSE ) (script-fu-menu-register "script-fu-comix-bubble" "/Script-Fu/Create New/")