; ; simple-button.scm ; ; creates a simple-button -- with beveled looking edges ; ; created: Sun Feb 8 16:10:31 EST 1998 Kyle R. Burton ; Copyright 1998, Kyle R. Burton, All Rights Reserved ; mortis@voicenet.com ; http://www.voicenet.com/~mortis ; ; ;; i have to admit, I stole this funciton [for-each] from ;; beveled-pattern-arrow.scm that came with the distribution (define (for-each proc seq) (if (not (null? seq)) (begin (proc (car seq)) (for-each proc (cdr seq))))) ;; this too (define (make-double-array double_list) (let* ((size (length double_list)) (a (cons-array size 'double)) (count 0)) (for-each (lambda (p) (aset a count p) (set! count (+ count 1))) double_list) a)) ;; ok, here's the new work (lame as it is) (define (script-fu-make-simple-button inColor inWidth inHeight inEdge) ; create a new canvas (set! theImage (car (gimp-image-new inWidth inHeight RGB))) ; create a new layer (set! theLayer1 (car (gimp-layer-new theImage inWidth inHeight RGB_IMAGE "layer 1" 100 NORMAL))) ; add the new layer to the canvas (gimp-image-add-layer theImage theLayer1 0) ; set the background color -- otherwise we'd have ; to use a fill, and some other tricks to color in ; the selections... (gimp-palette-set-background inColor) ; select the entire image, and clear it to the ; background color. then de-select the image (gimp-selection-all theImage) (gimp-edit-clear theImage theLayer1) (gimp-selection-none theImage) ; compute the bevel edge width (set! rect_width (* inEdge inWidth) ) ; first area -- top left to (bottom left/top right) (set! points (make-double-array (list 0 0 inWidth 0 (- inWidth rect_width) rect_width rect_width rect_width rect_width (- inHeight rect_width) 0 inHeight))) (gimp-free-select theImage (length points) points 0 0 0 0) ;; make it lighter in color... (gimp-brightness-contrast theImage theLayer1 50 0) ;; now for the second part... (gimp-selection-none theImage) ;; top right to bottom right, and bottom right to bottom left (set! points (make-double-array (list (- inWidth rect_width) rect_width inWidth 0 inWidth inHeight 0 inHeight rect_width (- inHeight rect_width) (- inWidth rect_width) (- inHeight rect_width) ))) (gimp-free-select theImage (length points) points 0 0 0 0) (gimp-brightness-contrast theImage theLayer1 -50 0) (gimp-selection-none theImage) (gimp-image-clean-all theImage) (gimp-display-new theImage) (cons theImage ()) ) (script-fu-register "script-fu-make-simple-button" "/Xtns/Script-Fu/Buttons/Simple Button" "Creates a simple button." "Kyle R. Burton mortis@voicenet.com" "Copyright 1998 Kyle R. Burton" "Wed Sep 30 09:56:26 EDT 1998" "" SF-COLOR "Color:" '(28 159 220) SF-VALUE "Width:" "100" SF-VALUE "Height:" "100" SF-VALUE "Edge Width (%):" "0.06" )