; smiley plugin ; ; Original version ; Copyright (C) 2000 MARIN Laetitia ; titix@amin.unice.fr ; Version 0.2 Raymond Ostertag 2004/09 ; - Ported to Gimp2 ; - Changed menu entry (define (make-smile img smile radius) (let ((smile-pos (+ 10 (/ radius 3))) (smile-radius (* (/ radius 3) 4)) (eye-l-pos-x (+ 10 (/ (* radius 2) 3))) (eye-r-pos-x (+ 10 (- (+ radius (/ radius 3)) (/ radius 4)))) (eye-pos-y (+ 10 (/ radius 2))) (eye-radius-x (/ radius 4)) (eye-radius-y (/ radius 3))) (gimp-ellipse-select img smile-pos smile-pos smile-radius smile-radius CHANNEL-OP-REPLACE TRUE 0 0) (gimp-selection-border img 2) (gimp-rect-select img 10 10 (* radius 2) radius CHANNEL-OP-SUBTRACT TRUE 0) (gimp-ellipse-select img eye-l-pos-x eye-pos-y eye-radius-x eye-radius-y CHANNEL-OP-ADD TRUE 0 0) (gimp-ellipse-select img eye-r-pos-x eye-pos-y eye-radius-x eye-radius-y CHANNEL-OP-ADD TRUE 0 0) (gimp-palette-set-foreground '(0 0 0)) (gimp-edit-bucket-fill smile FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0))) (define (make-reflet img reflet radius) (begin (let ((reflet-pos (+ 10 (/ radius 2))) (reflet-radius (* (/ radius 5) 8))) (gimp-ellipse-select img 10 10 (* radius 2) (* radius 2) CHANNEL-OP-REPLACE TRUE 0 0) (gimp-ellipse-select img reflet-pos reflet-pos reflet-radius reflet-radius CHANNEL-OP-SUBTRACT TRUE 0 0)) (gimp-palette-set-foreground '(255 255 255)) (gimp-edit-bucket-fill reflet FG-BUCKET-FILL NORMAL-MODE 50 0 FALSE 0 0) (gimp-selection-none img) (plug-in-gauss-iir2 TRUE img reflet 15 15) (let ((reflet2 (car (gimp-layer-copy reflet TRUE)))) (gimp-image-add-layer img reflet2 1) (gimp-rotate reflet2 TRUE 3.14159)))) (define (script-fu-smiley radius) (let* ((old-bg-color (car (gimp-palette-get-background))) (old-fg-color (car (gimp-palette-get-foreground))) ;; image creation (img (car (gimp-image-new (+ (* radius 2) 20) (+ (* radius 2) 20) RGB))) ;; layers creation (reflet (car (gimp-layer-new img (+ (* radius 2) 20) (+ (* radius 2) 20) RGBA-IMAGE "reflet" 100 NORMAL-MODE))) (smile (car (gimp-layer-new img (+ (* radius 2) 20) (+ (* radius 2) 20) RGBA-IMAGE "smile" 100 NORMAL-MODE))) (shape (car (gimp-layer-new img (+ (* radius 2) 20) (+ (* radius 2) 20) RGBA-IMAGE "Shape" 100 NORMAL-MODE))) (background (car (gimp-layer-new img (+ (* radius 2) 20) (+ (* radius 2) 20) RGBA-IMAGE "background" 100 NORMAL-MODE)))) (gimp-image-undo-disable img) ;; add layers (gimp-image-add-layer img background 0) (gimp-image-add-layer img shape 0) (gimp-image-add-layer img reflet 0) (gimp-image-add-layer img smile 0) ;; Init layers back colors (gimp-edit-clear shape) (gimp-edit-clear smile) (gimp-edit-clear reflet) (gimp-palette-set-foreground '(255 255 255)) (gimp-edit-fill background FOREGROUND-FILL) ;; make shape (gimp-ellipse-select img 10 10 (* radius 2) (* radius 2) CHANNEL-OP-REPLACE TRUE 0 0) (gimp-palette-set-foreground '(255 255 0)) (gimp-edit-bucket-fill shape FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0) ;; make shape smiiiile (make-smile img smile radius) ;; make reflet (make-reflet img reflet radius) ;; bring back fore and back color (gimp-palette-set-foreground old-fg-color) (gimp-palette-set-background old-bg-color) (gimp-image-undo-enable img) (gimp-display-new img))) (script-fu-register "script-fu-smiley" "/Xtns/Script-Fu/Render/Smiley..." "yellow smiley face" "MARIN Laetitia" "MARIN Laetitia" "Fev 2000" "" SF-VALUE "Radius" "64")