Gimp/plug-ins/script-fu/scripts/ripply-anim.scm
Henrik Brix Andersen f36a63f68c removed function gimp_menu_path_strip_uline() ...
2003-08-09 Henrik Brix Andersen <brix@gimp.org>

* gimp/app/widgets/gimpwidgets-utils.[ch]: removed function
gimp_menu_path_strip_uline() ...

* gimp/libgimpbase/gimputils.[ch]: ... and added it here under the
name gimp_strip_uline()

* gimp/devel-docs/libgimpbase/libgimpbase-sections.txt: added
gimp_strip_uline to gimputils section

* gimp/app/plug-in/plug-in.c
* gimp/app/widgets/gimpitemfactory.c
* gimp/app/widgets/gimptoolbox.
* gimp/app/gui/plug-in-menus.c: changed accordingly

* gimp/plug-ins/script-fu/script-fu-scripts.c
(script_fu_interface): use gimp_strip_uline() to strip mnemonics
from script-fu menu paths

* gimp/app/gui/vectors-menu.c
* gimp/app/gui/templates-menu.c
* gimp/app/gui/qmask-menu.c
* gimp/app/gui/palettes-menu.c
* gimp/app/gui/palette-editor-menu.c
* gimp/app/gui/images-menu.c
* gimp/app/gui/gradients-menu.c
* gimp/app/gui/gradient-editor-menu.c
* gimp/app/gui/documents-menu.c
* gimp/app/gui/dialogs-menu.c
* gimp/app/gui/colormap-editor-menu.c
* gimp/app/gui/channels-menu.c
* gimp/app/gui/buffers-menu.c
* gimp/app/gui/brushes-menu.c
* gimp/app/gui/layers-menu.c
* gimp/plug-ins/pygimp/plug-ins/clothify.py
* gimp/plug-ins/pygimp/plug-ins/shadow_bevel.py
* gimp/plug-ins/pygimp/plug-ins/whirlpinch.py
* gimp/plug-ins/pygimp/plug-ins/foggify.py
* gimp/plug-ins/script-fu/scripts/*.scm
* gimp/plug-ins/script-fu/script-fu.c: added mnemonics fixing more
of bug #106991

* gimp/app/gui/error-console-menu.c (error_console_menu_update):
updated menu item names, added mnemonics

* gimp/plug-ins/common/animoptimize.c *
gimp/plug-ins/common/animationplay.c: don't prepend every menu
entry with "Animation"
2003-08-11 17:14:32 +00:00

106 lines
4 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 (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)
(let ((floating-sel (car (gimp-edit-paste dest-drawable FALSE))))
(gimp-floating-sel-anchor floating-sel)))
(define (script-fu-ripply-anim img drawable displacement num-frames edge-type)
(let* ((old-bg (car (gimp-palette-get-background)))
(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))))
; this script generates its own displacement map
(gimp-image-undo-disable ripple-image)
(gimp-palette-set-background '(127 127 127) )
(gimp-image-add-layer ripple-image ripple-layer 0)
(gimp-edit-fill ripple-layer BG-IMAGE-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)))
(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-palette-set-background old-bg)
(gimp-image-undo-enable out-imagestack)
(gimp-display-new out-imagestack))))
(script-fu-register "script-fu-ripply-anim"
_"<Image>/Script-Fu/Animators/_Rippling..."
"Ripple any image by creating animation frames as layers"
"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 Behaviour" '(_"Wrap" _"Smear" _"Black"))