
2006-10-15 Kevin Cozens <kcozens@cvs.gnome.org> With this commit we finally say goodbye to SIOD. This large set of changes updates the Script-Fu plug-in to use the TinyScheme Scheme interpreter. These changes originated with changes originally made to Script-Fu which created Tiny-Fu (aka. the gimp-tiny-fu module). * plug-ins/script-fu/Makefile.am * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-interface.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-scripts.h * plug-ins/script-fu/script-fu-server.c * plug-ins/script-fu/script-fu-text-console.c * plug-ins/script-fu/script-fu.c: Updated with the changes made to these files as part of the work on the Tiny-Fu project. * plug-ins/script-fu/scheme-wrapper.c * plug-ins/script-fu/scheme-wrapper.h: Renamed from siod-wrapper.[ch] and updated based on differences to ts-wrapper.[ch] from gimp-tiny-fu. * plug-ins/script-fu/ftx/* * plug-ins/script-fu/re/* * plug-ins/script-fu/tinyscheme/* * plug-ins/script-fu/scripts/script-fu.init * plug-ins/script-fu/scripts/script-fu-compat.init * plug-ins/script-fu/scripts/contactsheet.scm * plug-ins/script-fu/scripts/script-fu-set-cmap.scm * plug-ins/script-fu/scripts/script-fu-util-setpt.scm * plug-ins/script-fu/scripts/ts-helloworld.scm: Added all of these files and directories from Tiny-Fu. Updated the Makefile.am files of ftx, re, and tinyscheme now they are in the GIMP source tree. * plug-ins/script-fu/scripts/*.scm: All scripts have been updated as needed to ensure they will work with the TinyScheme interpreter. Most of the files have been reformatted making it easier to see the syntax of Scheme and making them easier to read. * plug-ins/script-fu/scripts/Makefile.am: Updated script file lists. * plug-ins/script-fu/siod-wrapper.c * plug-ins/script-fu/siod-wrapper.h * plug-ins/script-fu/siod/*: Removed obsolete files. * configure.in: Updated list of files in AC_CONFIG_FILES. Changed --disable-script-fu to --without-script-fu which it should have been when originally added. * INSTALL: Updated to show change to --without-script-fu.
132 lines
4.5 KiB
Scheme
132 lines
4.5 KiB
Scheme
; "Rippling Image" animation generator (ripply-anim.scm)
|
|
; Adam D. Moss (adam@foxbox.org)
|
|
; 97/05/18
|
|
;
|
|
; Designed to be used in conjunction with a plugin capable
|
|
; of saving animations (i.e. the GIF plugin).
|
|
;
|
|
|
|
(define (script-fu-ripply-anim img drawable displacement num-frames edge-type)
|
|
|
|
(define (copy-layer-ripple dest-image dest-drawable source-image source-drawable)
|
|
(gimp-selection-all dest-image)
|
|
(gimp-edit-clear dest-drawable)
|
|
(gimp-selection-none dest-image)
|
|
(gimp-selection-all source-image)
|
|
(gimp-edit-copy source-drawable)
|
|
(gimp-selection-none source-image)
|
|
(gimp-floating-sel-anchor (car (gimp-edit-paste dest-drawable FALSE)))
|
|
)
|
|
|
|
(let* (
|
|
(width (car (gimp-drawable-width drawable)))
|
|
(height (car (gimp-drawable-height drawable)))
|
|
(ripple-image (car (gimp-image-new width height GRAY)))
|
|
(ripple-layer (car (gimp-layer-new ripple-image width height GRAY-IMAGE "Ripple Texture" 100 NORMAL-MODE)))
|
|
(rippletiled-ret)
|
|
(rippletiled-image)
|
|
(rippletiled-layer)
|
|
(remaining-frames)
|
|
(xpos)
|
|
(ypos)
|
|
(xoffset)
|
|
(yoffset)
|
|
(dup-image)
|
|
(layer-name)
|
|
(this-image)
|
|
(this-layer)
|
|
(dup-layer)
|
|
)
|
|
|
|
(gimp-context-push)
|
|
|
|
; this script generates its own displacement map
|
|
|
|
(gimp-image-undo-disable ripple-image)
|
|
(gimp-context-set-background '(127 127 127) )
|
|
(gimp-image-add-layer ripple-image ripple-layer 0)
|
|
(gimp-edit-fill ripple-layer BACKGROUND-FILL)
|
|
(plug-in-noisify 1 ripple-image ripple-layer FALSE 1.0 1.0 1.0 0.0)
|
|
; tile noise
|
|
(set! rippletiled-ret (plug-in-tile 1 ripple-image ripple-layer (* width 3) (* height 3) TRUE))
|
|
(gimp-image-undo-enable ripple-image)
|
|
(gimp-image-delete ripple-image)
|
|
|
|
(set! rippletiled-image (car rippletiled-ret))
|
|
(set! rippletiled-layer (cadr rippletiled-ret))
|
|
(gimp-image-undo-disable rippletiled-image)
|
|
|
|
; process tiled noise into usable displacement map
|
|
(plug-in-gauss-iir 1 rippletiled-image rippletiled-layer 35 TRUE TRUE)
|
|
(gimp-equalize rippletiled-layer TRUE)
|
|
(plug-in-gauss-rle 1 rippletiled-image rippletiled-layer 5 TRUE TRUE)
|
|
(gimp-equalize rippletiled-layer TRUE)
|
|
|
|
; displacement map is now in rippletiled-layer of rippletiled-image
|
|
|
|
; loop through the desired frames
|
|
|
|
(set! remaining-frames num-frames)
|
|
(set! xpos (/ width 2))
|
|
(set! ypos (/ height 2))
|
|
(set! xoffset (/ width num-frames))
|
|
(set! yoffset (/ height num-frames))
|
|
|
|
(let* ((out-imagestack (car (gimp-image-new width height RGB))))
|
|
|
|
(gimp-image-undo-disable out-imagestack)
|
|
|
|
(while (> remaining-frames 0)
|
|
(set! dup-image (car (gimp-image-duplicate rippletiled-image)))
|
|
(gimp-image-undo-disable dup-image)
|
|
(gimp-image-crop dup-image width height xpos ypos)
|
|
|
|
(set! layer-name (string-append "Frame "
|
|
(number->string (- num-frames remaining-frames) 10)
|
|
" (replace)"))
|
|
(set! this-layer (car (gimp-layer-new out-imagestack
|
|
width height RGB
|
|
layer-name 100 NORMAL-MODE)))
|
|
(gimp-image-add-layer out-imagestack this-layer 0)
|
|
|
|
(copy-layer-ripple out-imagestack this-layer img drawable)
|
|
|
|
(set! dup-layer (car (gimp-image-get-active-layer dup-image)))
|
|
(plug-in-displace 1 out-imagestack this-layer
|
|
displacement displacement
|
|
TRUE TRUE dup-layer dup-layer edge-type)
|
|
|
|
(gimp-image-undo-enable dup-image)
|
|
(gimp-image-delete dup-image)
|
|
|
|
(set! remaining-frames (- remaining-frames 1))
|
|
(set! xpos (+ xoffset xpos))
|
|
(set! ypos (+ yoffset ypos))
|
|
)
|
|
|
|
(gimp-image-undo-enable rippletiled-image)
|
|
(gimp-image-delete rippletiled-image)
|
|
(gimp-image-undo-enable out-imagestack)
|
|
(gimp-display-new out-imagestack))
|
|
|
|
(gimp-context-pop)
|
|
)
|
|
)
|
|
|
|
(script-fu-register "script-fu-ripply-anim"
|
|
_"_Rippling..."
|
|
_"Create a multi-layer image by adding a ripple effect to the current image"
|
|
"Adam D. Moss (adam@foxbox.org)"
|
|
"Adam D. Moss"
|
|
"1997"
|
|
"RGB* GRAY*"
|
|
SF-IMAGE "Image to animage" 0
|
|
SF-DRAWABLE "Drawable to animate" 0
|
|
SF-ADJUSTMENT _"Rippling strength" '(3 0 256 1 10 1 0)
|
|
SF-ADJUSTMENT _"Number of frames" '(15 0 256 1 10 0 1)
|
|
SF-OPTION _"Edge behavior" '(_"Wrap" _"Smear" _"Black")
|
|
)
|
|
|
|
(script-fu-menu-register "script-fu-ripply-anim"
|
|
"<Image>/Filters/Animation/Animators")
|