Gimp/plug-ins/script-fu/scripts/chrome-logo.scm
Kevin Cozens 6239dddda3 With this commit we finally say goodbye to SIOD. This large set of changes
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.
2006-10-16 01:08:54 +00:00

129 lines
4.7 KiB
Scheme

; CHROME-LOGOS
(define (apply-chrome-logo-effect img
logo-layer
offsets
bg-color)
(let* (
(offx1 (* offsets 0.4))
(offy1 (* offsets 0.3))
(offx2 (* offsets (- 0.4)))
(offy2 (* offsets (- 0.3)))
(feather (* offsets 0.5))
(width (car (gimp-drawable-width logo-layer)))
(height (car (gimp-drawable-height logo-layer)))
(layer1 (car (gimp-layer-new img width height RGBA-IMAGE "Layer 1" 100 DIFFERENCE-MODE)))
(layer2 (car (gimp-layer-new img width height RGBA-IMAGE "Layer 2" 100 DIFFERENCE-MODE)))
(layer3 (car (gimp-layer-new img width height RGBA-IMAGE "Layer 3" 100 NORMAL-MODE)))
(shadow (car (gimp-layer-new img width height RGBA-IMAGE "Drop Shadow" 100 NORMAL-MODE)))
(background (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(layer-mask (car (gimp-layer-create-mask layer1 ADD-BLACK-MASK)))
)
(gimp-context-push)
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img background 1)
(gimp-image-add-layer img shadow 1)
(gimp-image-add-layer img layer3 1)
(gimp-image-add-layer img layer2 1)
(gimp-image-add-layer img layer1 1)
(gimp-context-set-background '(255 255 255))
(gimp-selection-none img)
(gimp-edit-fill layer1 BACKGROUND-FILL)
(gimp-edit-fill layer2 BACKGROUND-FILL)
(gimp-edit-fill layer3 BACKGROUND-FILL)
(gimp-edit-clear shadow)
(gimp-selection-layer-alpha logo-layer)
(gimp-drawable-set-visible logo-layer FALSE)
(gimp-drawable-set-visible shadow FALSE)
(gimp-drawable-set-visible background FALSE)
(gimp-context-set-background '(0 0 0))
(gimp-edit-fill layer1 BACKGROUND-FILL)
(gimp-selection-translate img offx1 offy1)
(gimp-selection-feather img feather)
(gimp-edit-fill layer2 BACKGROUND-FILL)
(gimp-selection-translate img (* 2 offx2) (* 2 offy2))
(gimp-edit-fill layer3 BACKGROUND-FILL)
(gimp-selection-none img)
(set! layer1 (car (gimp-image-merge-visible-layers img CLIP-TO-IMAGE)))
(gimp-invert layer1)
(gimp-layer-add-mask layer1 layer-mask)
(gimp-selection-layer-alpha logo-layer)
(gimp-context-set-background '(255 255 255))
(gimp-selection-feather img feather)
(gimp-edit-fill layer-mask BACKGROUND-FILL)
(gimp-context-set-background '(0 0 0))
(gimp-selection-translate img offx1 offy1)
(gimp-edit-fill shadow BACKGROUND-FILL)
(gimp-selection-none img)
(gimp-context-set-background bg-color)
(gimp-edit-fill background BACKGROUND-FILL)
(gimp-drawable-set-visible shadow TRUE)
(gimp-drawable-set-visible background TRUE)
(gimp-drawable-set-name layer1 (car (gimp-drawable-get-name logo-layer)))
(gimp-image-remove-layer img logo-layer)
(gimp-context-pop)
)
)
(define (script-fu-chrome-logo-alpha img
logo-layer
offsets
bg-color)
(begin
(gimp-image-undo-group-start img)
(apply-chrome-logo-effect img logo-layer offsets bg-color)
(gimp-image-undo-group-end img)
(gimp-displays-flush)
)
)
(script-fu-register "script-fu-chrome-logo-alpha"
_"C_hrome..."
_"Add a simple chrome effect to the selected region (or alpha)"
"Spencer Kimball"
"Spencer Kimball & Peter Mattis"
"1997"
"RGBA"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT _"Offsets (pixels * 2)" '(10 2 100 1 10 0 1)
SF-COLOR _"Background Color" '(191 191 191)
)
(script-fu-menu-register "script-fu-chrome-logo-alpha"
"<Image>/Filters/Alpha to Logo")
(define (script-fu-chrome-logo text
size
font
bg-color)
(let* (
(img (car (gimp-image-new 256 256 RGB)))
(b-size (* size 0.2))
(text-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
)
(gimp-image-undo-disable img)
(apply-chrome-logo-effect img text-layer (* size 0.1) bg-color)
(gimp-image-undo-enable img)
(gimp-display-new img)
)
)
(script-fu-register "script-fu-chrome-logo"
_"C_hrome..."
_"Create a simplistic, but cool, chromed logo"
"Spencer Kimball"
"Spencer Kimball & Peter Mattis"
"1997"
""
SF-STRING _"Text" "The GIMP"
SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
SF-FONT _"Font" "Bodoni"
SF-COLOR _"Background color" '(191 191 191)
)
(script-fu-menu-register "script-fu-chrome-logo"
"<Toolbox>/Xtns/Logos")