; ; Vista button ; ; Vladimir Fekete (biliuqemuir@gmail.com) ; ; Script is based on tutorial made by 'Gimper'. It can be ; found here: http://gimp-tutorials.net/node/111 ; I tryied to follow the tutorial as best as I could, however I made ; some small changes: ; - blend is not generated but I used Web 2.0 styles instead. ; - differnet positions in blending of highlightnings due to different ; blend type ; Shadow can be turned on/off ; ; Later I have a plan to adjust additional outline and blending to different ; 2.0 styles not just black one. ; ; 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 2 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. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; ; Define the function: (define (script-fu-vista-button image drawable width height gradient_type highlight shadow) (gimp-image-undo-group-start image) (let* ( (newheight (+ height (/ height 2))) (if (= shadow TRUE) (set! newheight height)) ;Create new layer with button (vistabutton (car (gimp-layer-new image (+ width 1) (+ newheight 1) RGB-IMAGE "Vista Button" 100 NORMAL-MODE))) ) ;Make the layer transparent (gimp-layer-add-alpha vistabutton) (gimp-drawable-fill vistabutton TRANSPARENT-FILL) (gimp-image-add-layer image vistabutton -1) ;Fill background of button, which is outline (gimp-rect-select image 0 0 (+ width 1) (+ height 1) CHANNEL-OP-ADD FALSE 0) (gimp-context-set-foreground '(42 42 42)) ;for differnt gradient type we should choose different color (later... :) ) (gimp-edit-fill vistabutton FOREGROUND-FILL) (gimp-selection-none image) ;Fill main part of button with gradient (gimp-rect-select image 1 1 (- width 1) (- height 1) CHANNEL-OP-ADD FALSE 0) (if (= gradient_type 0) (gimp-context-set-gradient "Web 2.0 Black Gloss")) (if (= gradient_type 1) (gimp-context-set-gradient "Web 2.0 Blue Gloss")) (if (= gradient_type 2) (gimp-context-set-gradient "Web 2.0 Brown Gloss")) (if (= gradient_type 3) (gimp-context-set-gradient "Web 2.0 Fire Gloss")) (if (= gradient_type 4) (gimp-context-set-gradient "Web 2.0 Ice Gloss")) (if (= gradient_type 5) (gimp-context-set-gradient "Web 2.0 Lpink Gloss")) (if (= gradient_type 6) (gimp-context-set-gradient "Web 2.0 Orange Gloss")) (if (= gradient_type 7) (gimp-context-set-gradient "Web 2.0 Pink Gloss")) (if (= gradient_type 8) (gimp-context-set-gradient "Web 2.0 Red Gloss")) (if (= gradient_type 9) (gimp-context-set-gradient "Web 2.0 White Gloss")) (gimp-edit-blend vistabutton CUSTOM-MODE NORMAL-MODE GRADIENT-LINEAR 100 0 REPEAT-NONE TRUE FALSE 1 0 TRUE 0 0 0 height) (gimp-selection-none image) ;All remaining blend will be made with FG->Transparent gradient (gimp-context-set-gradient "FG to Transparent") ;Fill uppert part of button with light outline (gimp-rect-select image 1 1 (- width 1) (- (/ height 2) 1) CHANNEL-OP-ADD FALSE 0) (gimp-rect-select image 2 2 (- width 3) (- (/ height 2) 3) CHANNEL-OP-SUBTRACT FALSE 0) (gimp-context-set-foreground '(255 255 255)) (gimp-edit-blend vistabutton CUSTOM-MODE NORMAL-MODE GRADIENT-LINEAR 64 0 REPEAT-NONE FALSE FALSE 1 0 TRUE 0 0 0 (/ height 2)) (gimp-selection-none image) ;Fill lower half of button with radial highlight (gimp-rect-select image 1 (+ (/ height 2) 1) (- width 1) (- (/ height 2) 1) CHANNEL-OP-ADD FALSE 0) (gimp-context-set-foreground highlight) (gimp-edit-blend vistabutton CUSTOM-MODE NORMAL-MODE GRADIENT-RADIAL 37 0 REPEAT-NONE FALSE FALSE 1 0 TRUE (+ (/ width 2) 1) (+ (* height 0.75) 1) (+ (/ width 2) 1) (+ (* height 0.75) 101)) (gimp-selection-none image) ;Fill bottom part of button with radial highlight (gimp-rect-select image 1 (- height 1) (- width 1) 1 CHANNEL-OP-ADD FALSE 0) (gimp-context-set-foreground highlight) (gimp-edit-blend vistabutton CUSTOM-MODE NORMAL-MODE GRADIENT-RADIAL 85 0 REPEAT-NONE FALSE FALSE 1 0 TRUE (+ (/ width 2) 1) (+ height 20) (+ (/ width 2) 1) (+ height 75)) (gimp-selection-none image) ;add shadow (if (= shadow TRUE) (begin (gimp-rect-select image 0 (+ height 1) (+ width 1) (/ height 2) CHANNEL-OP-ADD FALSE 0) (gimp-context-set-foreground '(205 203 203)) (gimp-edit-blend vistabutton CUSTOM-MODE NORMAL-MODE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE FALSE 1 0 TRUE 0 0 0 newheight) (gimp-selection-none image) ) ) (gimp-displays-flush) ) (gimp-image-undo-group-end image) ) (script-fu-register "script-fu-vista-button" "Vista Button" "Create a vista button according to tutorial made by Gimper that can be found at http://gimp-tutorials.net/node/111 I decided to use Ultimate Web 2.0 Layer Styles instead of creating a new style as in mentioned tutorial." "Vladimir Fekete" "Vladimir Fekete, 2008. Tutorial is work of 'Gimper'." "February 12, 2008" "RGB*" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-VALUE _"Width" "100" SF-VALUE _"Height" "40" ;SF-OPTION _"Gradient" '("Web 2.0 Black Gloss" "Web 2.0 Blue Gloss" "Web 2.0 Brown Gloss" "Web 2.0 Fire Gloss" "Web 2.0 Ice Gloss" "Web 2.0 Lpink Gloss" "Web 2.0 Orange Gloss" "Web 2.0 Pink Gloss" "Web 2.0 Red Gloss" "Web 2.0 White Gloss") SF-OPTION _"Gradient" '("Web 2.0 Black Gloss") SF-COLOR _"Highlight" '(179 179 179) SF-TOGGLE _"Drop Shadow" TRUE ) (script-fu-menu-register "script-fu-vista-button" "/Script-Fu/Vista Button")