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

  1. ;  FROZEN-TEXT effect
  2. ;  Thanks to Ed Mackey for this one
  3. ;   Written by Spencer Kimball
  4.  
  5. (define (min a b) (if (< a b) a b))
  6.  
  7. (define (apply-frosty-logo-effect img
  8.                   logo-layer
  9.                   size
  10.                   bg-color)
  11.   (let* ((border (/ size 5))
  12.      (width (car (gimp-drawable-width logo-layer)))
  13.      (height (car (gimp-drawable-height logo-layer)))
  14.      (logo-layer-mask (car (gimp-layer-create-mask logo-layer BLACK-MASK)))
  15.      (sparkle-layer (car (gimp-layer-new img width height RGBA_IMAGE "Sparkle" 100 NORMAL)))
  16.      (matte-layer (car (gimp-layer-new img width height RGBA_IMAGE "Matte" 100 NORMAL)))
  17.      (shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Shadow" 90 MULTIPLY)))
  18.      (bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
  19.      (selection 0)
  20.      (old-fg (car (gimp-palette-get-foreground)))
  21.      (old-bg (car (gimp-palette-get-background)))
  22.      (old-brush (car (gimp-brushes-get-brush)))
  23.      (old-paint-mode (car (gimp-brushes-get-paint-mode))))
  24.     (gimp-image-resize img width height 0 0)
  25.     (gimp-image-add-layer img sparkle-layer 2)
  26.     (gimp-image-add-layer img matte-layer 3)
  27.     (gimp-image-add-layer img shadow-layer 4)
  28.     (gimp-image-add-layer img bg-layer 5)
  29.     (gimp-selection-none img)
  30.     (gimp-edit-clear sparkle-layer)
  31.     (gimp-edit-clear matte-layer)
  32.     (gimp-edit-clear shadow-layer)
  33.     (gimp-selection-layer-alpha logo-layer)
  34.     (set! selection (car (gimp-selection-save img)))
  35.     (gimp-selection-feather img border)
  36.     (gimp-palette-set-background '(0 0 0))
  37.     (gimp-edit-fill sparkle-layer BG-IMAGE-FILL)
  38.     (plug-in-noisify 1 img sparkle-layer FALSE 0.2 0.2 0.2 0.0)
  39.     (plug-in-c-astretch 1 img sparkle-layer)
  40.     (gimp-selection-none img)
  41.     (plug-in-sparkle 1 img sparkle-layer 0.03 0.5 (/ (min width height) 2) 6 15 1.0 0.0 0.0 0.0 FALSE FALSE FALSE 0)
  42.     (gimp-levels sparkle-layer 1 0 255 0.2 0 255)
  43.     (gimp-levels sparkle-layer 2 0 255 0.7 0 255)
  44.     (gimp-selection-layer-alpha sparkle-layer)
  45.     (gimp-palette-set-foreground '(0 0 0))
  46.     (gimp-brushes-set-brush "Circle Fuzzy (11)")
  47.     (gimp-edit-stroke matte-layer)
  48.     (gimp-selection-feather img border)
  49.     (gimp-edit-fill shadow-layer BG-IMAGE-FILL)
  50.     (gimp-selection-none img)
  51.     (gimp-palette-set-background bg-color)
  52.     (gimp-edit-fill bg-layer BG-IMAGE-FILL)
  53.     (gimp-palette-set-background '(0 0 0))
  54.     (gimp-edit-fill logo-layer BG-IMAGE-FILL)
  55.     (gimp-image-add-layer-mask img logo-layer logo-layer-mask)
  56.     (gimp-selection-load selection)
  57.     (gimp-palette-set-background '(255 255 255))
  58.     (gimp-edit-fill logo-layer-mask BG-IMAGE-FILL)
  59.     (gimp-selection-feather img border)
  60.     (gimp-selection-translate img (/ border 2) (/ border 2))
  61.     (gimp-edit-fill logo-layer BG-IMAGE-FILL)
  62.     (gimp-image-remove-layer-mask img logo-layer 0)
  63.     (gimp-selection-load selection)
  64.     (gimp-brushes-set-brush "Circle Fuzzy (07)")
  65.     (gimp-brushes-set-paint-mode BEHIND)
  66.     (gimp-palette-set-foreground '(186 241 255))
  67.     (gimp-edit-stroke logo-layer)
  68.     (gimp-selection-none img)
  69.     (gimp-image-remove-channel img selection)
  70.     (gimp-layer-translate shadow-layer border border)
  71.     (gimp-palette-set-foreground old-fg)
  72.     (gimp-palette-set-background old-bg)
  73.     (gimp-brushes-set-brush old-brush)
  74.     (gimp-brushes-set-paint-mode old-paint-mode)))
  75.  
  76. (define (script-fu-frosty-logo-alpha img
  77.                      logo-layer
  78.                      size
  79.                      bg-color)
  80.   (begin
  81.     (gimp-undo-push-group-start img)
  82.     (apply-frosty-logo-effect img logo-layer size bg-color)
  83.     (gimp-undo-push-group-end img)
  84.     (gimp-displays-flush)))
  85.  
  86.  
  87. (script-fu-register "script-fu-frosty-logo-alpha"
  88.             _"<Image>/Script-Fu/Alpha to Logo/Frosty..."
  89.             "Frozen logos with drop shadows"
  90.             "Spencer Kimball & Ed Mackey"
  91.             "Spencer Kimball & Ed Mackey"
  92.             "1997"
  93.             "RGBA"
  94.                     SF-IMAGE      "Image" 0
  95.                     SF-DRAWABLE   "Drawable" 0
  96.             SF-ADJUSTMENT _"Effect Size (pixels)" '(100 2 1000 1 10 0 1)
  97.             SF-COLOR  _"Background Color" '(255 255 255)
  98.             )
  99.  
  100. (define (script-fu-frosty-logo text
  101.                    size
  102.                    font
  103.                    bg-color)
  104.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  105.      (border (/ size 5))
  106.      (text-layer (car (gimp-text-fontname img -1 0 0 text (* border 2) TRUE size PIXELS font))))
  107.     (gimp-image-undo-disable img)
  108.     (gimp-layer-set-name text-layer text)
  109.     (apply-frosty-logo-effect img text-layer size bg-color)
  110.     (gimp-image-undo-enable img)
  111.     (gimp-display-new img)))
  112.  
  113. (script-fu-register "script-fu-frosty-logo"
  114.             _"<Toolbox>/Xtns/Script-Fu/Logos/Frosty..."
  115.             "Frozen logos with drop shadows"
  116.             "Spencer Kimball & Ed Mackey"
  117.             "Spencer Kimball & Ed Mackey"
  118.             "1997"
  119.             ""
  120.             SF-STRING _"Text" "The GIMP"
  121.             SF-ADJUSTMENT _"Font Size (pixels)" '(100 2 1000 1 10 0 1)
  122.             SF-FONT   _"Font" "-*-Becker-*-r-*-*-24-*-*-*-p-*-*-*"
  123.             SF-COLOR  _"Background Color" '(255 255 255)
  124.             )
  125.