;; pattern-tileable-tempest.scm -*-scheme-*- ;; based on "Swirl-tile" by Adrian Likins ;; http://www4.ncsu.edu/eos/users/a/aklikins/pub/gimp/ ;; Swirl Tile produced a seamlessly tiling swirling effect (as a new image). ;; (It was never seamless, look closer) ;; Rewritten by Alan Horkan, Trinity College Dublin, Ireland. 2004. ;; See the About information for full description. ;; Alan Horkan claims no copyright on his modifications to this script. ;; and would have licensed it as Public Domain, however ;; No license was specified by the original author, and we ;; cannot assume it is anything other than GPL like the rest of the Gimp. (define (script-fu-pattern-tempest image drawable depth azimuth elevation blur-radius whirl-amount roughness) (let* ( ; get height and width of current image (height (car (gimp-drawable-height drawable)) ) (width (car (gimp-drawable-width drawable)) ) ; roughness is noise level as a percentage (noise-level (/ roughness 100)) (centre-x (/ width 2)) (centre-y (/ height 2)) ) ; (gimp-undo-push-group-start image) ; gimp 1.2 (gimp-image-undo-group-start image) ; noisify does not work with INDEXED RGB images, convert to RGB (if (= INDEXED (car (gimp-image-base-type image))) (gimp-convert-rgb image) ) ; whirl can be clockwise/anticlockwise, psuedo-randomly change whirl direction ; (if (= 1 (rand 2)) (set! whirl-amount (* -1 whirl-amount)) ) ; effect does not work properly if there is a selection (gimp-selection-none image) ; this noise gets pushed to the corners by gimp-channel-ops-offset (plug-in-noisify 1 image drawable FALSE noise-level noise-level noise-level 1.0) ; whirl the centre (whirl image drawable whirl-amount) ; pushes the old middle to the corners, to make the image tileable ; (gimp-channel-ops-offset drawable TRUE 0 centre-x centre-y) ; gimp 1.2 (gimp-drawable-offset drawable TRUE 0 centre-x centre-y) ; whirl the new centre (whirl image drawable whirl-amount) ;; gaussian blur plug-in, requires blur radius >= 1.0. This allows choice of No Blur. (if (not (= blur-radius 0)) (plug-in-gauss-rle 1 image drawable blur-radius TRUE TRUE) ) ; warning: depth of zero cause bumpmap to fail (and crash on win32) (plug-in-bump-map 1 image drawable drawable azimuth elevation depth 0 0 0 0 FALSE FALSE 0) ; (gimp-undo-push-group-end image) (gimp-image-undo-group-end image) (gimp-displays-flush) ) ) ;; abstracted the whirl to avoid unnecessary repitition and allow easier modification. ;; unfortunately must repeat whirl-pinch, cannot just multiply whirl-angle by 3 (define (whirl image drawable whirl-angle) (plug-in-whirl-pinch 1 image drawable whirl-angle 0.0 1.0) (plug-in-whirl-pinch 1 image drawable whirl-angle 0.0 1.0) (plug-in-whirl-pinch 1 image drawable whirl-angle 0.0 1.0) ) ; whirl could be optimized for lower values (whirl by 360 once, not whirl 120 three times) ; but worst case would remain the same so it is better to keep it simple ;; Renamed to Tempest, "Swirl (Tile)" and "Swirly" were confusingly similar (script-fu-register "script-fu-pattern-tempest" _"/Filters/Render/Pattern/Tempest..." ; ; About Dialog, Script Description and Information. "Tempest, whirls up a storm. Swirls the whole of the current image to create a tileable pattern, that looks something like a storm system. The tiling good but not totally seamless, the edges are not perfect. To repeat the pattern use with: Filters, Map, Tile... Indexed RGB images are automatically converted to RGB to allow this effect to work. SEE ALSO Xtns, Script-Fu, Pattern, Swirl Tile. " "Alan Horkan. Adrian Likins. " ; author(s) "Adrian Likins. " ; copyright? "April 2004" ; date, was "1997" "" ; supported image types SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 ; bugfix: depth of zero cause bumpmap to fail (and crash on win32) SF-ADJUSTMENT _"Depth" '(10 1 65 1 1 0 0) ; dict. def. Azimuth Arc of the heavens extending from the zenith to the horizon, which it cuts at right angles. ; still so vague I cannot come up with an appropriate simpler synonym. SF-ADJUSTMENT _"Azimuth" '(135 0 360 1 10 0 0) ; Elevation 0 is indistinguishable from black flood fill ; Elevation 5 has some rough features but is still very black SF-ADJUSTMENT _"Elevation" '(45 0 90 1 10 0 0) ; blur radius works well at about a quarter of image size SF-ADJUSTMENT _"Blur Radius" '(2 0 100 1 10 0 0) SF-ADJUSTMENT _"Whirl Amount" '(320 -360 360 1 10 0 0) ; changed to a slider for consistency, changed to percentages too SF-ADJUSTMENT _"Roughness" '(50 0 100 1 1 0 0) )