basic2-logo.scm の変更
ドロップシャドウの付いた、タイトルまたはボタンをとりあえず作りたい時、
オリジナルのままではちょっと違うので Script-fu を少し変更します
↓( style='border-width:2px;border-style:outset' )
; HIGHLIGHT-DROP-SHADOW-LOGO ; draw the specified text over a background with a drop shadow and a highlight (define (color-highlight color) (let ((r (car color)) (g (cadr color)) (b (caddr color))) (set! r (+ r (* (- 255 r) 0.75))) (set! g (+ g (* (- 255 g) 0.75))) (set! b (+ b (* (- 255 b) 0.75))) (list r g b))) (define (apply-basic2ex-logo-effect img logo-layer bg-color text-color) (let* ((width (car (gimp-drawable-width logo-layer))) (height (car (gimp-drawable-height logo-layer))) (posx (- (car (gimp-drawable-offsets logo-layer)))) (posy (- (cadr (gimp-drawable-offsets logo-layer)))) (bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL))) (highlight-layer (car (gimp-layer-copy logo-layer TRUE))) (shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Shadow" 100 MULTIPLY))) (old-fg (car (gimp-palette-get-foreground))) (old-bg (car (gimp-palette-get-background)))) (gimp-selection-none img) (script-fu-util-image-resize-from-layer img logo-layer) (gimp-image-add-layer img bg-layer 1) (gimp-image-add-layer img shadow-layer 1) (gimp-image-add-layer img highlight-layer 1) (gimp-palette-set-foreground text-color) (gimp-layer-set-preserve-trans logo-layer TRUE) (gimp-edit-fill logo-layer FG-IMAGE-FILL) (gimp-edit-clear shadow-layer) (gimp-palette-set-foreground (color-highlight text-color)) (gimp-layer-set-preserve-trans highlight-layer TRUE) (gimp-edit-fill highlight-layer FG-IMAGE-FILL) (gimp-palette-set-background bg-color) (gimp-drawable-fill bg-layer BG-IMAGE-FILL) (gimp-selection-layer-alpha logo-layer) (gimp-palette-set-background '(0 0 0)) (gimp-selection-feather img 7.5) (gimp-edit-fill shadow-layer BG-IMAGE-FILL) (gimp-selection-none img) (gimp-palette-set-foreground '(255 255 255)) ; グラデーションは使用しない ; (gimp-blend logo-layer FG-BG-RGB MULTIPLY RADIAL 100 20 REPEAT-NONE FALSE 0 0 0 0 width height) (gimp-layer-translate shadow-layer 3 3) (gimp-layer-translate highlight-layer (- posx 2) (- posy 2)) (gimp-layer-set-name highlight-layer "Highlight") (gimp-palette-set-background old-bg) (gimp-palette-set-foreground old-fg))) (define (script-fu-basic2ex-logo-alpha img logo-layer bg-color text-color) (begin (gimp-undo-push-group-start img) (apply-basic2ex-logo-effect img logo-layer bg-color text-color) (gimp-undo-push-group-end img) (gimp-displays-flush))) (script-fu-register "script-fu-basic2ex-logo-alpha" _"<Image>/Script-Fu/Alpha to Logo/Basic II Button..." "Creates a simple logo with a shadow and a highlight" "Spencer Kimball" "Spencer Kimball" "1996" "RGBA" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-COLOR _"Background Color" '(255 255 255) SF-COLOR _"Text Color" '(206 6 50)) (define (script-fu-basic2ex-logo text size font bg-color text-color) (let* ((img (car (gimp-image-new 256 256 RGB))) (text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))) (gimp-image-undo-disable img) (gimp-layer-set-name text-layer text) (apply-basic2ex-logo-effect img text-layer bg-color text-color) (gimp-image-undo-enable img) ; lightbox add (set! imgwidth (- (car (gimp-image-width img)) 8)) (set! imgheight (- (car (gimp-image-height img)) 8)) (gimp-image-resize img imgwidth imgheight -4 -4) (gimp-image-merge-visible-layers img 1) ; (gimp-display-new img))) (script-fu-register "script-fu-basic2ex-logo" _"<Toolbox>/Xtns/Script-Fu/Logos lightbox/Basic2Button" "Creates a simple logo with a shadow and a highlight" "Spencer Kimball" "Spencer Kimball" "1996" "" SF-STRING _"Text" "BUTTON" SF-ADJUSTMENT _"Font Size (pixels)" '(24 2 1000 1 10 0 1) SF-FONT _"Font" "-*-futura_poster-*-r-*-*-24-*-*-*-p-*-*-*" SF-COLOR _"Background Color" '(255 255 255) SF-COLOR _"Text Color" '(206 6 50))
上記スクリプトが存在するという前提で、以下、幅指定バージョン
; HIGHLIGHT-DROP-SHADOW-LOGO ; draw the specified text over a background with a drop shadow and a highlight (define (script-fu-lightbox-logo1 text size font baseWidth bg-color text-color) (let* ((img (car (gimp-image-new 256 256 RGB))) (text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))) (gimp-image-undo-disable img) (gimp-layer-set-name text-layer text) (apply-basic2ex-logo-effect img text-layer bg-color text-color) (gimp-image-undo-enable img) ; lightbox add (set! imgwidth baseWidth) (set! imgheight (- (car (gimp-image-height img)) 8)) (gimp-image-resize img imgwidth imgheight -4 -4) (set! new-layer (car (gimp-layer-new img imgwidth imgheight RGB-IMAGE "Layer 1" 100 NORMAL) ) ) (gimp-image-merge-visible-layers img 1) (gimp-image-add-layer img new-layer 1) (gimp-drawable-fill new-layer 2) (gimp-image-merge-visible-layers img 1) ; (gimp-display-new img))) (script-fu-register "script-fu-lightbox-logo1" _"<Toolbox>/Xtns/Script-Fu/Logos lightbox/Logo1" "Creates a simple logo with a shadow and a highlight" "Spencer Kimball" "Spencer Kimball" "1996" "" SF-STRING _"Text" "BUTTON" SF-ADJUSTMENT _"Font Size (pixels)" '(24 2 1000 1 10 0 1) SF-FONT _"Font" "-*-futura_poster-*-r-*-*-24-*-*-*-p-*-*-*" SF-ADJUSTMENT _"Width" '(300 20 2000 1 10 0 1) SF-COLOR _"Background Color" '(255 255 255) SF-COLOR _"Text Color" '(206 6 50))