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

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ; This program is free software; you can redistribute it and/or modify
  4. ; it under the terms of the GNU General Public License as published by
  5. ; the Free Software Foundation; either version 2 of the License, or
  6. ; (at your option) any later version.
  7. ; This program is distributed in the hope that it will be useful,
  8. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10. ; GNU General Public License for more details.
  11. ; You should have received a copy of the GNU General Public License
  12. ; along with this program; if not, write to the Free Software
  13. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. ;
  15. ;  Bovinated Logos v0.1 04/08/98
  16. ;  by Brian McFee <keebler@wco.com>
  17. ;  Creates Cow-spotted logs.. what else?
  18.  
  19. (define (apply-bovinated-logo-effect img
  20.                      logo-layer
  21.                      spots-x
  22.                      spots-y
  23.                      bg-color)
  24.   (let* ((width (car (gimp-drawable-width logo-layer)))
  25.      (height (car (gimp-drawable-height logo-layer)))
  26.      (bg-layer (car (gimp-layer-new img width height RGBA_IMAGE "Background" 100 NORMAL)))
  27.      (blur-layer (car (gimp-layer-new img width height RGBA_IMAGE "Blur" 100 NORMAL)))
  28.      (old-fg (car (gimp-palette-get-foreground)))
  29.      (old-bg (car (gimp-palette-get-background))))
  30.     (gimp-image-resize img width height 0 0)
  31.     (gimp-image-add-layer img bg-layer 1)
  32.     (gimp-image-add-layer img blur-layer 1)
  33.  
  34.     (gimp-selection-all img)
  35.     (gimp-palette-set-background bg-color)
  36.     (gimp-edit-fill bg-layer BG-IMAGE-FILL)
  37.     (gimp-selection-none img)
  38.  
  39.     (gimp-layer-set-preserve-trans blur-layer TRUE)
  40.     (gimp-palette-set-background '(255 255 255))
  41.     (gimp-selection-all img)
  42.     (gimp-edit-fill blur-layer BG-IMAGE-FILL)
  43.     (gimp-edit-clear blur-layer)
  44.     (gimp-palette-set-background '(191 191 191))
  45.     (gimp-selection-none img)
  46.     (gimp-layer-set-preserve-trans blur-layer FALSE)
  47.     (gimp-selection-layer-alpha logo-layer)
  48.     (gimp-edit-fill blur-layer BG-IMAGE-FILL)
  49.     (plug-in-gauss-rle 1 img blur-layer 5.0 1 1)
  50.     (gimp-selection-none img)
  51.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  52.     (gimp-selection-all img)
  53.     (plug-in-solid-noise 1 img logo-layer 0 0 23 1 spots-x spots-y)
  54.     (gimp-brightness-contrast logo-layer 0 127)
  55.     (gimp-selection-none img)
  56.     (gimp-layer-set-preserve-trans logo-layer FALSE)
  57.     (plug-in-bump-map 1 img logo-layer blur-layer 135 50 10 0 0 0 30 TRUE FALSE 0)
  58.     (gimp-layer-set-offsets blur-layer 5 5)
  59.     (gimp-invert blur-layer)
  60.     (gimp-layer-set-opacity blur-layer 50.0)
  61.     (gimp-image-set-active-layer img logo-layer)
  62.     (gimp-palette-set-background old-bg)
  63.     (gimp-palette-set-foreground old-fg)))
  64.  
  65. (define (script-fu-bovinated-logo-alpha img
  66.                     logo-layer
  67.                     spots-x
  68.                     spots-y
  69.                     bg-color)
  70.   (begin
  71.     (gimp-undo-push-group-start img)
  72.     (apply-bovinated-logo-effect img logo-layer spots-x spots-y bg-color)
  73.     (gimp-undo-push-group-end img)
  74.     (gimp-displays-flush)))
  75.  
  76. (script-fu-register "script-fu-bovinated-logo-alpha"
  77.             _"<Image>/Script-Fu/Alpha to Logo/Bovination..."
  78.             "Makes Cow-spotted logos"
  79.             "Brian McFee <keebler@wco.com>"
  80.             "Brian McFee"
  81.             "April 1998"
  82.             "RGBA"
  83.                     SF-IMAGE      "Image" 0
  84.                     SF-DRAWABLE   "Drawable" 0
  85.             SF-ADJUSTMENT _"Spots density X" '(16 1 16 1 10 0 1)
  86.             SF-ADJUSTMENT _"Spots density Y" '(4 1 16 1 10 0 1)
  87.             SF-COLOR      _"Background Color" '(255 255 255))
  88.  
  89. (define (script-fu-bovinated-logo text
  90.                   size
  91.                   font
  92.                   spots-x
  93.                   spots-y
  94.                   bg-color)
  95.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  96.          (border (/ size 4))
  97.      (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font))))
  98.     (gimp-image-undo-disable img)
  99.     (gimp-layer-set-name text-layer text)
  100.     (apply-bovinated-logo-effect img text-layer spots-x spots-y bg-color)
  101.     (gimp-image-undo-enable img)
  102.     (gimp-display-new img)))
  103.  
  104. (script-fu-register "script-fu-bovinated-logo"
  105.             _"<Toolbox>/Xtns/Script-Fu/Logos/Bovination..."
  106.             "Makes Cow-spotted logos"
  107.             "Brian McFee <keebler@wco.com>"
  108.             "Brian McFee"
  109.             "April 1998"
  110.             ""
  111.             SF-STRING     _"Text" "Fear the Cow"
  112.             SF-ADJUSTMENT _"Font Size (pixels)" '(80 2 1000 1 10 0 1)
  113.             SF-FONT       _"Font" "-*-roostheavy-*-r-*-*-24-*-*-*-p-*-*-*"
  114.             SF-ADJUSTMENT _"Spots density X" '(16 1 16 1 10 0 1)
  115.             SF-ADJUSTMENT _"Spots density Y" '(4 1 16 1 10 0 1)
  116.             SF-COLOR      _"Background Color" '(255 255 255))
  117.  
  118.