home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 February / PCWorld_2001-02_cd.bin / Software / Topware / gimp / gimp-setup-20001226.exe / Main / basic2-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2000-12-27  |  3.7 KB  |  97 lines

  1. ;  HIGHLIGHT-DROP-SHADOW-LOGO
  2. ;  draw the specified text over a background with a drop shadow and a highlight
  3.  
  4. (define (color-highlight color)
  5.   (let ((r (car color))
  6.     (g (cadr color))
  7.     (b (caddr color)))
  8.     (set! r (+ r (* (- 255 r) 0.75)))
  9.     (set! g (+ g (* (- 255 g) 0.75)))
  10.     (set! b (+ b (* (- 255 b) 0.75)))
  11.     (list r g b)))
  12.  
  13. (define (apply-basic2-logo-effect img
  14.                   logo-layer
  15.                   bg-color
  16.                   text-color)
  17.   (let* ((width (car (gimp-drawable-width logo-layer)))
  18.      (height (car (gimp-drawable-height logo-layer)))
  19.      (bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
  20.      (highlight-layer (car (gimp-layer-copy logo-layer TRUE)))
  21.      (shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Shadow" 100 MULTIPLY)))
  22.      (old-fg (car (gimp-palette-get-foreground)))
  23.      (old-bg (car (gimp-palette-get-background))))
  24.     (gimp-image-resize img width height 0 0)
  25.     (gimp-image-add-layer img bg-layer 1)
  26.     (gimp-image-add-layer img shadow-layer 1)
  27.     (gimp-image-add-layer img highlight-layer 1)
  28.     (gimp-palette-set-foreground text-color)
  29.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  30.     (gimp-edit-fill logo-layer FG-IMAGE-FILL)
  31.     (gimp-edit-clear shadow-layer)
  32.     (gimp-palette-set-foreground (color-highlight text-color))
  33.     (gimp-layer-set-preserve-trans highlight-layer TRUE)
  34.     (gimp-edit-fill highlight-layer FG-IMAGE-FILL)
  35.     (gimp-palette-set-background bg-color)
  36.     (gimp-drawable-fill bg-layer BG-IMAGE-FILL)
  37.     (gimp-selection-layer-alpha logo-layer)
  38.     (gimp-palette-set-background '(0 0 0))
  39.     (gimp-selection-feather img 7.5)
  40.     (gimp-edit-fill shadow-layer BG-IMAGE-FILL)
  41.     (gimp-selection-none img)
  42.     (gimp-palette-set-foreground '(255 255 255))
  43.     (gimp-blend logo-layer FG-BG-RGB MULTIPLY RADIAL 100 20 REPEAT-NONE FALSE 0 0 0 0 width height)
  44.     (gimp-layer-translate shadow-layer 3 3)
  45.     (gimp-layer-translate highlight-layer -2 -2)
  46.     (gimp-layer-set-name highlight-layer "Highlight")
  47.     (gimp-palette-set-background old-bg)
  48.     (gimp-palette-set-foreground old-fg)))
  49.  
  50. (define (script-fu-basic2-logo-alpha img
  51.                      logo-layer
  52.                      bg-color
  53.                      text-color)
  54.   (begin
  55.     (gimp-undo-push-group-start img)
  56.     (apply-basic2-logo-effect img logo-layer bg-color text-color)
  57.     (gimp-undo-push-group-end img)
  58.     (gimp-displays-flush)))
  59.  
  60. (script-fu-register "script-fu-basic2-logo-alpha"
  61.             _"<Image>/Script-Fu/Alpha to Logo/Basic II..."
  62.             "Creates a simple logo with a shadow and a highlight"
  63.             "Spencer Kimball"
  64.             "Spencer Kimball"
  65.             "1996"
  66.             "RGBA"
  67.                     SF-IMAGE      "Image" 0
  68.                     SF-DRAWABLE   "Drawable" 0
  69.                    SF-COLOR      _"Background Color" '(255 255 255)
  70.             SF-COLOR      _"Text Color" '(206 6 50))
  71.  
  72. (define (script-fu-basic2-logo text
  73.                    size
  74.                    font
  75.                    bg-color
  76.                    text-color)
  77.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  78.      (text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font))))
  79.     (gimp-image-undo-disable img)
  80.     (gimp-layer-set-name text-layer text)
  81.     (apply-basic2-logo-effect img text-layer bg-color text-color)
  82.     (gimp-image-undo-enable img)
  83.     (gimp-display-new img)))
  84.  
  85. (script-fu-register "script-fu-basic2-logo"
  86.             _"<Toolbox>/Xtns/Script-Fu/Logos/Basic II..."
  87.             "Creates a simple logo with a shadow and a highlight"
  88.             "Spencer Kimball"
  89.             "Spencer Kimball"
  90.             "1996"
  91.             ""
  92.             SF-STRING     _"Text" "SCRIPT-FU"
  93.             SF-ADJUSTMENT _"Font Size (pixels)" '(150 2 1000 1 10 0 1)
  94.             SF-FONT       _"Font" "-*-futura_poster-*-r-*-*-24-*-*-*-p-*-*-*"
  95.             SF-COLOR      _"Background Color" '(255 255 255)
  96.             SF-COLOR      _"Text Color" '(206 6 50))
  97.