; The GIMP -- an image manipulation program ; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; ; Lava effect ; Copyright (c) 1997 Adrian Likins ; aklikins@eos.ncsu.edu ; ; based on a idea by Sven Riedel ; tweaked a little by Sven Neumann ; ; 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 (rand-num ) (srand (realtime)) (/ (rand 10) 10)) (define (set-pt a index x y) (prog1 (aset a (* index 2) x) (aset a (+ (* index 2) 1) y))) (define (spline-shag-it) (let* ((a (cons-array 18 'byte))) (set-pt a 0 0 0) (set-pt a 1 31 235) (set-pt a 2 63 23) (set-pt a 3 95 230) 0(set-pt a 4 127 25) (set-pt a 5 159 21) (set-pt a 6 191 200) (set-pt a 7 223 24) (set-pt a 8 255 255) a)) (define (script-fu-shag image drawable random-values redx redy greenx greeny bluex bluey keep-selection seperate-layer) (let* ( (type (car (gimp-drawable-type-with-alpha drawable))) (image-width (car (gimp-image-width image))) (image-height (car (gimp-image-height image))) (old-bg (car (gimp-palette-get-background)))) (srand (realtime)) (gimp-image-disable-undo image) (gimp-layer-add-alpha drawable) (if (= (car (gimp-selection-is-empty image)) TRUE) (begin (gimp-selection-layer-alpha image drawable) (set! active-selection (car (gimp-selection-save image))) (set! from-selection FALSE)) (begin (set! from-selection TRUE) (set! active-selection (car (gimp-selection-save image))))) (set! selection-bounds (gimp-selection-bounds image)) (set! select-offset-x (cadr selection-bounds)) (set! select-offset-y (caddr selection-bounds)) (set! select-width (- (cadr (cddr selection-bounds)) select-offset-x)) (set! select-height (- (caddr (cddr selection-bounds)) select-offset-y)) (if (= seperate-layer TRUE) (begin (set! shag-layer (car (gimp-layer-new image select-width select-height type "Shag Layer" 100 NORMAL))) (gimp-layer-set-offsets shag-layer select-offset-x select-offset-y) (gimp-image-add-layer image shag-layer -1) (gimp-selection-none image) (gimp-edit-clear image shag-layer) (gimp-selection-load image active-selection) (gimp-image-set-active-layer image shag-layer))) (set! active-layer (car (gimp-image-get-active-layer image))) (if (= random-values TRUE) (begin (plug-in-harmonic 1 image active-layer (/ (rand 100) 100) (/ (rand 100) 100) (/ (rand 100) 100) (/ (rand 100) 100) (/ (rand 100) 100) (/ (rand 100) 100))) (plug-in-harmonic 1 image active-layer redx redy greenx greeny bluex bluey)) (gimp-curves-spline image active-layer 0 18 (spline-shag-it)) (gimp-brightness-contrast image active-layer 0 127) (if (= keep-selection FALSE) (gimp-selection-none image)) (gimp-image-set-active-layer image drawable) (gimp-image-remove-channel image active-selection) (gimp-image-enable-undo image) (gimp-displays-flush))) (script-fu-register "script-fu-shag" "/Script-Fu/Decor/Shagadelic" "Generates shagadelic patterns. Groovy, baby!." "Adrian Likins " "Adrian Likins" "10/12/97" "RGB RGBA GRAY GRAYA" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-TOGGLE "Random values?" TRUE SF-VALUE "Red X" ".25" SF-VALUE "Red Y" ".40" SF-VALUE "Green X" ".89" SF-VALUE "Green Y" ".33" SF-VALUE "Blue X" ".10" SF-VALUE "Blue Y" ".75" SF-TOGGLE "Keep Selection?" TRUE SF-TOGGLE "Seperate Layer?" TRUE)