(define (script-fu-lentilka10v sizex sizey uradius lradius bg ucolor lcolor pressed effect) (let* ( (midx (/ sizex 2)) (midy (/ sizey 2)) (img (car (gimp-image-new sizex sizey RGB))) (background (car (gimp-layer-new img sizex sizey RGB_IMAGE "Background" 100 NORMAL))) (lower (car (gimp-layer-new img sizex sizey RGB_IMAGE "Lower" 100 NORMAL))) (upper (car (gimp-layer-new img sizex sizey RGB_IMAGE "Upper" 100 NORMAL))) (old-fg (car (gimp-palette-get-foreground))) (old-bg (car (gimp-palette-get-background))) ) ;Do all as a one step (gimp-image-disable-undo img) ;Save original bg and fg colors to be able to set it back (gimp-palette-set-background bg) (gimp-palette-set-foreground lcolor) ;Add upper layer to image (gimp-layer-add-alpha upper) (gimp-image-add-layer img upper 0) (gimp-selection-all img) ;We want to have blend to bg color (gimp-drawable-fill upper BG-IMAGE-FILL) ;Add lower layer to image (gimp-layer-add-alpha lower) (gimp-image-add-layer img lower 2) (gimp-selection-all img) (gimp-drawable-fill lower BG-IMAGE-FILL) ;Add background layer (gimp-image-add-layer img background 20) (gimp-drawable-fill background BG-IMAGE-FILL) (gimp-ellipse-select img (- midx lradius) (- midy lradius) (* 2 lradius) (* 2 lradius) REPLACE TRUE FALSE 0) (gimp-palette-set-foreground lcolor) (gimp-bucket-fill img lower FG-BUCKET-FILL MULTIPLY 100 0 FALSE 0 0) (gimp-selection-invert img) (gimp-edit-cut img lower) (gimp-blend img lower FG-TRANS SCREEN SHAPEBURST-SPHERICAL 100 0 REPEAT-NONE FALSE 0 0 midx midy (+ midx lradius) (+ midy lradius)) (let ((pressed-layer (car (gimp-layer-copy lower 0)))) (gimp-layer-set-mode pressed-layer SCREEN) (gimp-image-add-layer img pressed-layer 1) (if (= pressed TRUE) (gimp-layer-set-visible pressed-layer 1) ) (if (= pressed FALSE) (gimp-layer-set-visible pressed-layer 0) ) ) (gimp-ellipse-select img (- midx uradius) (- midy uradius) (* 2 uradius) (* 2 uradius) REPLACE TRUE FALSE 0) (gimp-palette-set-foreground ucolor) (gimp-bucket-fill img upper FG-BUCKET-FILL MULTIPLY 100 0 FALSE 0 0) (gimp-selection-invert img) (gimp-edit-cut img upper) (gimp-blend img upper FG-TRANS SCREEN SHAPEBURST-SPHERICAL 100 0 REPEAT-NONE FALSE 0 0 midx midy (+ midx uradius) (+ midy uradius)) (gimp-ellipse-select img (- midx (* uradius 2)) (- midy (* uradius 2)) (* 2 uradius) (* 2 uradius) REPLACE TRUE FALSE 0) (gimp-edit-cut img upper) (if (= effect TRUE) (let (()) (plug-in-noisify 1 img upper 0 23.0 23.0 23.0 0) (plug-in-gauss-rle 1 img upper 2.0 1 1) (plug-in-colorify 1 img upper ucolor) ) ) (gimp-selection-none img) (gimp-palette-set-background old-bg) (gimp-palette-set-foreground old-fg) (gimp-image-enable-undo img) (gimp-display-new img)) ) (script-fu-register "script-fu-lentilka10v" "/Xtns/Script-Fu/APG/Lentilka10v" "Creates a simple buttone in shape of unfinished lenticel." "(c) 2001 Michal Ambroz (O_O)" "License GPL" "January 10, 2001" "" SF-VALUE "Image sizex" "100" SF-VALUE "Image sizey" "100" SF-VALUE "Upper Radius:" "45" SF-VALUE "Lower Radius:" "40" SF-COLOR "Background:" '(255 255 255) SF-COLOR "Upper Color:" '(0 0 150) SF-COLOR "Lower Color:" '(0 150 180) SF-TOGGLE "Pressed:" FALSE SF-TOGGLE "Random Effect:" FALSE ;SF-VALUE "Whirl Effect:(-360..360)" "0" )