
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.
237 lines
9.0 KiB
Scheme
237 lines
9.0 KiB
Scheme
;
|
|
; burn-in-anim.scm V2.1 - script-fu for the GIMP 1.1 and higher
|
|
;
|
|
; Copyright (C) 9/2000 Roland Berger
|
|
; roland@fuchur.leute.server.de
|
|
; http://fuchur.leute.server.de
|
|
;
|
|
; Let text appear and fade out with a "burn-in" like SFX.
|
|
; Works on an image with a text and a background layer
|
|
;
|
|
; Copying Policy: GNU Public License http://www.gnu.org
|
|
;
|
|
|
|
(define (script-fu-burn-in-anim org-img
|
|
org-layer
|
|
glow-color
|
|
fadeout
|
|
bl-width
|
|
corona-width
|
|
after-glow
|
|
show-glow
|
|
optimize
|
|
speed)
|
|
|
|
(let* (
|
|
;--- main variable: "bl-x" runs from 0 to layer-width
|
|
(bl-x 0)
|
|
(frame-nr 0)
|
|
(img)
|
|
(source-layer)
|
|
(bg-source-layer)
|
|
(source-layer-width)
|
|
(bg-layer)
|
|
(bg-layer-name)
|
|
(bl-layer)
|
|
(bl-layer-name)
|
|
(bl-mask)
|
|
(bl-layer-width)
|
|
(bl-height)
|
|
(bl-x-off)
|
|
(bl-y-off)
|
|
(nofadeout-bl-x-off)
|
|
(nofadeout-bl-width)
|
|
(blended-layer)
|
|
(img-display)
|
|
)
|
|
|
|
(if (< speed 1)
|
|
(set! speed (* -1 speed)) )
|
|
|
|
;--- check image and work on a copy
|
|
(if (= (car (gimp-image-get-layers org-img)) 2)
|
|
|
|
;--- main program structure starts here, begin of "if-1"
|
|
(begin
|
|
(gimp-context-push)
|
|
|
|
(set! img (car (gimp-image-duplicate org-img)))
|
|
(gimp-image-undo-disable img)
|
|
(if (> (car (gimp-drawable-type org-layer)) 1 )
|
|
(gimp-image-convert-rgb img))
|
|
(set! source-layer (aref (cadr (gimp-image-get-layers img)) 0 ))
|
|
(set! bg-source-layer (aref (cadr (gimp-image-get-layers img)) 1 ))
|
|
(set! source-layer-width (car (gimp-drawable-width source-layer)))
|
|
|
|
;--- hide layers, cause we want to "merge visible layers" later
|
|
(gimp-drawable-set-visible source-layer FALSE)
|
|
(gimp-drawable-set-visible bg-source-layer FALSE)
|
|
|
|
;--- process image horizontal with pixel-speed
|
|
(while (< bl-x (+ source-layer-width bl-width))
|
|
(set! bl-layer (car (gimp-layer-copy source-layer TRUE)))
|
|
(set! bl-layer-name (string-append "fr-nr"
|
|
(number->string frame-nr 10) ) )
|
|
|
|
(gimp-image-add-layer img bl-layer -2)
|
|
(gimp-drawable-set-name bl-layer bl-layer-name)
|
|
(gimp-drawable-set-visible bl-layer TRUE)
|
|
(gimp-layer-set-lock-alpha bl-layer TRUE)
|
|
(gimp-layer-add-alpha bl-layer)
|
|
|
|
;--- add an alpha mask for blending and select it
|
|
(gimp-selection-layer-alpha bl-layer)
|
|
(set! bl-mask (car (gimp-layer-create-mask bl-layer ADD-BLACK-MASK)))
|
|
(gimp-layer-add-mask bl-layer bl-mask)
|
|
|
|
;--- handle layer geometry
|
|
(set! bl-layer-width source-layer-width)
|
|
(set! bl-height (car (gimp-drawable-height bl-layer)))
|
|
(set! bl-x-off (- bl-x bl-width))
|
|
(set! bl-x-off (+ bl-x-off (car (gimp-drawable-offsets bl-layer))))
|
|
(set! bl-y-off (cadr (gimp-drawable-offsets bl-layer)))
|
|
|
|
;--- select a rectangular area to blend
|
|
(gimp-rect-select img bl-x-off bl-y-off bl-width bl-height CHANNEL-OP-REPLACE 0 0)
|
|
;--- select at least 1 pixel!
|
|
(gimp-rect-select img bl-x-off bl-y-off (+ bl-width 1) bl-height CHANNEL-OP-ADD 0 0)
|
|
|
|
(if (= fadeout FALSE)
|
|
(begin
|
|
(set! nofadeout-bl-x-off (car (gimp-drawable-offsets bl-layer)))
|
|
(set! nofadeout-bl-width (+ nofadeout-bl-x-off bl-x))
|
|
(set! nofadeout-bl-width (max nofadeout-bl-width 1))
|
|
(gimp-rect-select img nofadeout-bl-x-off bl-y-off
|
|
nofadeout-bl-width bl-height
|
|
CHANNEL-OP-REPLACE 0 0)
|
|
)
|
|
)
|
|
|
|
;--- alpha blending text to trans (fadeout)
|
|
(gimp-context-set-foreground '(255 255 255))
|
|
(gimp-context-set-background '( 0 0 0))
|
|
(if (= fadeout TRUE)
|
|
(begin
|
|
; blend with 20% offset to get less transparency in the front
|
|
(gimp-edit-blend bl-mask FG-BG-RGB-MODE NORMAL-MODE
|
|
GRADIENT-LINEAR 100 20 REPEAT-NONE FALSE
|
|
FALSE 0 0 TRUE
|
|
(+ bl-x-off bl-width) 0 bl-x-off 0)
|
|
)
|
|
)
|
|
|
|
(if (= fadeout FALSE)
|
|
(begin
|
|
(gimp-context-set-foreground '(255 255 255))
|
|
(gimp-edit-bucket-fill bl-mask FG-BUCKET-FILL NORMAL-MODE
|
|
100 255 0 0 0)
|
|
)
|
|
)
|
|
|
|
(gimp-layer-remove-mask bl-layer MASK-APPLY)
|
|
|
|
;--- add bright glow in front
|
|
(if (= show-glow TRUE)
|
|
(begin
|
|
;--- add some brightness to whole text
|
|
(if (= fadeout TRUE)
|
|
(gimp-brightness-contrast bl-layer 100 0)
|
|
)
|
|
|
|
;--- blend glow color inside the letters
|
|
(gimp-context-set-foreground glow-color)
|
|
(gimp-edit-blend bl-layer FG-TRANSPARENT-MODE NORMAL-MODE
|
|
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
|
|
FALSE 0 0 TRUE
|
|
(+ bl-x-off bl-width) 0
|
|
(- (+ bl-x-off bl-width) after-glow) 0)
|
|
|
|
;--- add corona effect
|
|
(gimp-selection-layer-alpha bl-layer)
|
|
(gimp-selection-sharpen img)
|
|
(gimp-selection-grow img corona-width)
|
|
(gimp-layer-set-lock-alpha bl-layer FALSE)
|
|
(gimp-selection-feather img corona-width)
|
|
(gimp-context-set-foreground glow-color)
|
|
(gimp-edit-blend bl-layer FG-TRANSPARENT-MODE NORMAL-MODE
|
|
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
|
|
FALSE 0 0 TRUE
|
|
(- (+ bl-x-off bl-width) corona-width) 0
|
|
(- (+ bl-x-off bl-width) after-glow) 0)
|
|
)
|
|
)
|
|
|
|
;--- merge with bg layer
|
|
(set! bg-layer (car (gimp-layer-copy bg-source-layer FALSE)))
|
|
(gimp-image-add-layer img bg-layer -1)
|
|
(gimp-image-lower-layer img bg-layer)
|
|
(set! bg-layer-name (string-append "bg-"
|
|
(number->string frame-nr 10)))
|
|
(gimp-drawable-set-name bg-layer bg-layer-name)
|
|
(gimp-drawable-set-visible bg-layer TRUE)
|
|
(set! blended-layer (car (gimp-image-merge-visible-layers img
|
|
CLIP-TO-IMAGE)))
|
|
;(set! blended-layer bl-layer)
|
|
(gimp-drawable-set-visible blended-layer FALSE)
|
|
|
|
;--- end of "while" loop
|
|
(set! frame-nr (+ frame-nr 1))
|
|
(set! bl-x (+ bl-x speed))
|
|
)
|
|
|
|
;--- finalize the job
|
|
(gimp-selection-none img)
|
|
(gimp-image-remove-layer img source-layer)
|
|
(gimp-image-remove-layer img bg-source-layer)
|
|
|
|
(gimp-image-set-filename img "burn-in")
|
|
|
|
(if (= optimize TRUE)
|
|
(begin
|
|
(gimp-image-convert-indexed img 1 WEB-PALETTE 250 FALSE TRUE "")
|
|
(set! img-out (car (plug-in-animationoptimize 0
|
|
img
|
|
bl-layer)))
|
|
)
|
|
)
|
|
|
|
(gimp-drawable-set-visible (aref (cadr (gimp-image-get-layers img)) 0)
|
|
TRUE)
|
|
(gimp-image-undo-enable img)
|
|
(gimp-image-clean-all img)
|
|
(set! img-display (car (gimp-display-new img)))
|
|
|
|
(gimp-displays-flush)
|
|
|
|
(gimp-context-pop)
|
|
)
|
|
|
|
;--- false form of "if-1"
|
|
(gimp-message _"Burn-In: Needs two layers in total!\nA foreground text layer with transparency and a background layer.")
|
|
)
|
|
)
|
|
)
|
|
|
|
|
|
(script-fu-register "script-fu-burn-in-anim"
|
|
_"B_urn-In..."
|
|
_"Create intermediate layers to produce an animated 'burn-in' transition between two layers"
|
|
"Roland Berger roland@fuchur.leute.server.de"
|
|
"Roland Berger"
|
|
"January 2001"
|
|
"RGBA GRAYA INDEXEDA"
|
|
SF-IMAGE "The image" 0
|
|
SF-DRAWABLE "Layer to animate" 0
|
|
SF-COLOR _"Glow color" '(255 255 255)
|
|
SF-TOGGLE _"Fadeout" FALSE
|
|
SF-VALUE _"Fadeout width" "100"
|
|
SF-VALUE _"Corona width" "7"
|
|
SF-VALUE _"After glow" "50"
|
|
SF-TOGGLE _"Add glowing" TRUE
|
|
SF-TOGGLE _"Prepare for GIF" FALSE
|
|
SF-VALUE _"Speed (pixels/frame)" "50"
|
|
)
|
|
|
|
(script-fu-menu-register "script-fu-burn-in-anim"
|
|
"<Image>/Filters/Animation/Animators")
|