Converted the first bunch of Script-Fu to the new context API:

2004-09-22  Sven Neumann  <sven@gimp.org>

	Converted the first bunch of Script-Fu to the new context API:

	* plug-ins/script-fu/scripts/[3a-c]*.scm: push and pop a context.
	Removed code that used to restore the context values changed by
	the scripts.
This commit is contained in:
Sven Neumann
2004-09-22 17:27:20 +00:00
committed by Sven Neumann
parent 2dffdbeb60
commit 0ef809d6d4
36 changed files with 303 additions and 279 deletions

View File

@ -35,9 +35,10 @@
(bg-layer (car (gimp-layer-new img width height
RGB-IMAGE "Background" 100 NORMAL-MODE)))
(pattern (car (gimp-layer-new img width height
RGBA-IMAGE "Pattern" 100 NORMAL-MODE)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
RGBA-IMAGE "Pattern" 100 NORMAL-MODE))))
(gimp-context-push)
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img pattern 1)
@ -60,7 +61,8 @@
(gimp-selection-all img)
(gimp-patterns-set-pattern text-pattern)
(gimp-edit-bucket-fill pattern PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
(gimp-edit-bucket-fill pattern
PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
(plug-in-bump-map noninteractive img pattern layer2
110.0 45.0 4 0 0 0 0 TRUE FALSE 0)
@ -82,8 +84,7 @@
(gimp-drawable-set-visible pattern TRUE)
;;(set! final (car (gimp-image-flatten img)))
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)))
(gimp-context-pop)))
(define (script-fu-3d-outline-logo-alpha img
logo-layer

View File

@ -168,10 +168,9 @@
(tiledraw2 (car (gimp-layer-new tile size size
RGB-IMAGE "Cooper" 100 NORMAL-MODE)))
(Xindex 0)
(Yindex 0)
(old-bg (car (gimp-palette-get-background)))
(old-fg (car (gimp-palette-get-foreground)))
)
(Yindex 0))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-image-undo-disable tile)
@ -205,12 +204,10 @@
)
(gimp-image-delete tile)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)
(gimp-image-undo-enable img)
(gimp-display-new img)
)
)
(gimp-context-pop)))
(script-fu-register "script-fu-3dtruchet"
_"<Toolbox>/Xtns/Script-Fu/Patterns/3_D Truchet..."

View File

@ -64,7 +64,7 @@
(offsets (gimp-drawable-offsets pic-layer))
(width (car (gimp-drawable-width pic-layer)))
(height (car (gimp-drawable-height pic-layer)))
(old-bg (car (gimp-palette-get-background)))
; Bumpmap has a one pixel border on each side
(bump-layer (car (gimp-layer-new image
(+ width 2)
@ -72,9 +72,10 @@
GRAY
"Bumpmap"
100
NORMAL-MODE)))
)
NORMAL-MODE))))
(gimp-context-push)
; If the layer we're bevelling is offset from the image's origin, we
; have to do the same to the bumpmap
(gimp-layer-set-offsets bump-layer (- (car offsets) 1)
@ -146,7 +147,6 @@
;
; Restore things
;
(gimp-palette-set-background old-bg)
(if (= bevelling-whole-image TRUE)
(gimp-selection-none image) ; No selection to start with
(gimp-selection-load select)
@ -160,23 +160,20 @@
(begin
(gimp-image-add-layer image bump-layer 1)
(gimp-drawable-set-visible bump-layer 0))
(gimp-drawable-delete bump-layer)
)
(gimp-drawable-delete bump-layer))
(gimp-image-set-active-layer image pic-layer)
; enable undo / end undo group
(if (= work-on-copy TRUE)
(begin
(gimp-display-new image)
(gimp-image-undo-enable image)
)
(gimp-image-undo-group-end image)
)
(begin
(gimp-display-new image)
(gimp-image-undo-enable image))
(gimp-image-undo-group-end image))
(gimp-displays-flush)
)
)
(gimp-context-pop)))
(script-fu-register "script-fu-add-bevel"
_"<Image>/Script-Fu/Decor/Add B_evel..."

View File

@ -99,12 +99,14 @@
(let* ((img (car (gimp-drawable-get-image adraw)))
(owidth (car (gimp-image-width img)))
(oheight (car (gimp-image-height img)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background)))
(width (+ owidth (* 2 xsize)))
(height (+ oheight (* 2 ysize)))
(layer (car (gimp-layer-new img width height RGBA-IMAGE "Border-Layer" 100 NORMAL-MODE))))
;Add this for debugging (verbose 4)
(gimp-context-push)
(gimp-image-undo-group-start img)
(gimp-drawable-fill layer TRANSPARENT-FILL)
(gimp-image-resize img
@ -153,10 +155,9 @@
(gimp-selection-none img)
(gimp-image-add-layer img layer 0)
(gimp-image-undo-group-end img)
(gimp-palette-set-background old-bg)
(gimp-displays-flush)
)
)
(gimp-context-pop)))
(script-fu-register "script-fu-addborder"
_"<Image>/Script-Fu/Decor/Add _Border..."

View File

@ -101,10 +101,9 @@
"Background" 100 NORMAL-MODE)))
(big-arrow (point-list->double-array
(rotate-points (make-arrow size offset)
size orientation)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
size orientation))))
(gimp-context-push)
(gimp-image-undo-disable img)
;(gimp-image-resize img (+ length height) (+ height height) 0 0)
@ -136,14 +135,13 @@
(gimp-palette-set-background bg-color)
(gimp-edit-fill bg-layer BACKGROUND-FILL)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)
(if (= flatten TRUE)
(gimp-image-flatten img))
(gimp-image-undo-enable img)
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-alien-glow-right-arrow"
_"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Alien Glow/_Arrow..."

View File

@ -29,15 +29,19 @@
(border (/ height 4))
(ruler-layer (car (gimp-layer-new img
(+ length height) (+ height height)
RGBA-IMAGE "Ruler" 100 NORMAL-MODE)))
RGBA-IMAGE "Ruler"
100 NORMAL-MODE)))
(glow-layer (car (gimp-layer-new img
(+ length height) (+ height height)
RGBA-IMAGE "ALien Glow" 100 NORMAL-MODE)))
RGBA-IMAGE "ALien Glow"
100 NORMAL-MODE)))
(bg-layer (car (gimp-layer-new img
(+ length height) (+ height height)
RGB-IMAGE "Backround" 100 NORMAL-MODE)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
RGB-IMAGE "Backround"
100 NORMAL-MODE))))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-image-resize img (+ length height) (+ height height) 0 0)
(gimp-image-add-layer img bg-layer 1)
@ -50,7 +54,9 @@
(gimp-edit-clear glow-layer)
(gimp-edit-clear ruler-layer)
(gimp-rect-select img (/ height 2) (/ height 2) length height CHANNEL-OP-REPLACE FALSE 0)
(gimp-rect-select img
(/ height 2) (/ height 2)
length height CHANNEL-OP-REPLACE FALSE 0)
(gimp-palette-set-foreground '(79 79 79))
(gimp-palette-set-background '(0 0 0))
@ -65,14 +71,14 @@
(gimp-selection-none img)
(plug-in-gauss-rle 1 img glow-layer 25 TRUE TRUE)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)
(gimp-image-undo-enable img)
(if (= flatten TRUE)
(gimp-image-flatten img))
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-alien-glow-horizontal-ruler"

View File

@ -47,9 +47,9 @@
(glow-layer (car (gimp-layer-new img diameter diameter RGBA-IMAGE
"ALien Glow" 100 NORMAL-MODE)))
(bg-layer (car (gimp-layer-new img diameter diameter RGB-IMAGE
"Background" 100 NORMAL-MODE)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
"Background" 100 NORMAL-MODE))))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-image-resize img diameter diameter 0 0)
@ -85,13 +85,12 @@
(plug-in-gauss-rle 1 img glow-layer 25 TRUE TRUE)
(plug-in-gauss-rle 1 img glow-layer 12 TRUE TRUE))
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)
(if (= flatten TRUE)
(gimp-image-flatten img))
(gimp-image-undo-enable img)
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-alien-glow-bullet"
_"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Alien Glow/_Bullet..."

View File

@ -55,9 +55,7 @@
padding
glow-radius
flatten)
(let* ((old-fg-color (car (gimp-palette-get-foreground)))
(old-bg-color (car (gimp-palette-get-background)))
(text-extents (gimp-text-get-extents-fontname text
(let* ((text-extents (gimp-text-get-extents-fontname text
size
PIXELS
font))
@ -83,6 +81,8 @@
layer-width layer-height RGBA-IMAGE
"Button" 100 NORMAL-MODE))))
(gimp-context-push)
(gimp-image-undo-disable img)
; Create bumpmap layer
@ -128,12 +128,13 @@
(+ (+ padding descent) (/ glow-radius 2))))
; Done
(gimp-selection-none img)
(gimp-palette-set-foreground old-fg-color)
(gimp-palette-set-background old-bg-color)
(gimp-image-undo-enable img)
(if (= flatten TRUE)
(gimp-image-flatten img))
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-alien-glow-button"
_"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Alien Glow/B_utton..."

View File

@ -15,9 +15,9 @@
"Background" 100 NORMAL-MODE)))
(glow-layer (car (gimp-layer-new img
width height RGBA-IMAGE
"Alien Glow" 100 NORMAL-MODE)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
"Alien Glow" 100 NORMAL-MODE))))
(gimp-context-push)
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
@ -42,8 +42,7 @@
FALSE 0 0 TRUE
0 0 1 1)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)))
(gimp-context-pop)))
(define (script-fu-alien-glow-logo-alpha img
logo-layer
@ -75,11 +74,11 @@
(border (/ size 4))
(grow (/ size 30))
(feather (/ size 4))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
(text-layer (car (gimp-text-fontname img
-1 0 0 text border TRUE
size PIXELS font)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(height (car (gimp-drawable-height text-layer))))
(gimp-image-undo-disable img)
(gimp-drawable-set-name text-layer text)

View File

@ -41,9 +41,10 @@
(width (car (gimp-drawable-width logo-layer)))
(height (car (gimp-drawable-height logo-layer)))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(bands-layer (car (gimp-layer-new img width height RGBA-IMAGE "Bands" 100 NORMAL-MODE)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(bands-layer (car (gimp-layer-new img width height RGBA-IMAGE "Bands" 100 NORMAL-MODE))))
(gimp-context-push)
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img bg-layer 1)
(gimp-image-add-layer img bands-layer 1)
@ -93,11 +94,11 @@
;; (gimp-layer-remove-mask bands-layer MASK-APPLY)
; Clean up and exit.
(gimp-palette-set-foreground old-fg)
(gimp-palette-set-background old-bg)
(gimp-drawable-set-visible logo-layer 0)
(gimp-image-set-active-layer img bands-layer)
(gimp-displays-flush)))
(gimp-displays-flush)
(gimp-context-pop)))
(define (script-fu-alien-neon-logo-alpha img
logo-layer

View File

@ -32,17 +32,16 @@
inBackColor
inBufferAmount)
(set! old-bg (car (gimp-palette-get-background)))
(set! theImage (car (gimp-image-new 10 10 RGB) ) )
(set! theImage (car (gimp-image-new 10 10 RGB)))
(set! theLayer (car (gimp-layer-new theImage
10
10
RGBA-IMAGE
"layer 1"
100
NORMAL-MODE) ) )
NORMAL-MODE)))
(gimp-context-push)
(gimp-palette-set-background inBackColor)
(gimp-drawable-set-name theLayer "Background")
@ -51,9 +50,9 @@
(script-fu-asc-2-img-layer theImage theLayer inFile inFont inFontSize
inTextColor inBufferAmount)
(set! theBuffer (* inFontSize (/ inBufferAmount 100) ) )
(set! theImageWidth (+ theImageWidth theBuffer theBuffer ))
(set! theImageHeight (+ theImageHeight theBuffer theBuffer ))
(set! theBuffer (* inFontSize (/ inBufferAmount 100)))
(set! theImageWidth (+ theImageWidth theBuffer theBuffer))
(set! theImageHeight (+ theImageHeight theBuffer theBuffer))
(gimp-image-resize theImage
theImageWidth
@ -68,17 +67,17 @@
(gimp-selection-all theImage)
(if (= inTrans TRUE)
(gimp-edit-clear theLayer)
(gimp-edit-fill theLayer BACKGROUND-FILL)
)
(gimp-edit-fill theLayer BACKGROUND-FILL))
(gimp-selection-none theImage)
(gimp-palette-set-background old-bg)
(gimp-display-new theImage)
(gimp-image-clean-all theImage)
(gimp-displays-flush)
(cons theImage () )
(gimp-context-pop)
(cons theImage ())
)
(define (script-fu-asc-2-img-layer inImage
@ -88,7 +87,6 @@
inFontSize
inTextColor)
(set! old-fg (car (gimp-palette-get-foreground)))
(set! theImage inImage)
(set! theLayer inLayer)
(set! theFile (fopen inFile))
@ -97,6 +95,8 @@
(set! nLayers (car (gimp-image-get-layers theImage)))
(set! n nLayers)
(gimp-context-push)
(gimp-palette-set-foreground inTextColor)
(gimp-selection-none theImage)
(set! theData ())
@ -161,9 +161,8 @@
inFont
inFontSize)
(set! n nLayers)
(gimp-palette-set-foreground old-fg)
(gimp-displays-flush)
)
(gimp-context-pop))
(define (cjg-add-text inData inIndentList inFont inFontSize)
(if (equal? () inData)

View File

@ -8,9 +8,9 @@
(let* ((width (car (gimp-drawable-width logo-layer)))
(height (car (gimp-drawable-height logo-layer)))
(bg-layer (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE))))
(gimp-context-push)
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
@ -35,8 +35,8 @@
0 0 width height)
(gimp-layer-translate shadow-layer 3 3)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)))
(gimp-context-pop)))
(define (script-fu-basic1-logo-alpha img
logo-layer

View File

@ -21,9 +21,9 @@
(posy (- (cadr (gimp-drawable-offsets logo-layer))))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(highlight-layer (car (gimp-layer-copy logo-layer TRUE)))
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE))))
(gimp-context-push)
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
@ -54,8 +54,8 @@
(gimp-layer-translate shadow-layer 3 3)
(gimp-layer-translate highlight-layer (- posx 2) (- posy 2))
(gimp-drawable-set-name highlight-layer "Highlight")
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)))
(gimp-context-pop)))
(define (script-fu-basic2-logo-alpha img
logo-layer

View File

@ -58,10 +58,7 @@
padding
bevel-width
pressed)
(let* ((old-fg-color (car (gimp-palette-get-foreground)))
(old-bg-color (car (gimp-palette-get-background)))
(text-extents (gimp-text-get-extents-fontname text
(let* ((text-extents (gimp-text-get-extents-fontname text
size
PIXELS
font))
@ -82,6 +79,8 @@
img-width img-height RGBA-IMAGE
"Gradient" 100 NORMAL-MODE))))
(gimp-context-push)
(gimp-image-undo-disable img)
; Create bumpmap layer
@ -131,10 +130,10 @@
; Done
(gimp-selection-none img)
(gimp-palette-set-foreground old-fg-color)
(gimp-palette-set-background old-bg-color)
(gimp-image-undo-enable img)
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-button00"
_"<Toolbox>/Xtns/Script-Fu/Buttons/Simple _Beveled Button..."

View File

@ -72,14 +72,15 @@
; the main function
(let* ((old-bg-color (car (gimp-palette-get-background)))
(img (car (gimp-image-new size size RGB)))
(let* ((img (car (gimp-image-new size size RGB)))
(background (car (gimp-layer-new img size size RGB-IMAGE "Arrow" 100 NORMAL-MODE)))
(bumpmap (car (gimp-layer-new img size size RGB-IMAGE "Bumpmap" 100 NORMAL-MODE)))
(big-arrow (point-list->double-array (rotate-points (make-arrow size 6) size orientation)))
(med-arrow (point-list->double-array (rotate-points (make-arrow size 7) size orientation)))
(small-arrow (point-list->double-array (rotate-points (make-arrow size 8) size orientation))))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-image-add-layer img background -1)
(gimp-image-add-layer img bumpmap -1)
@ -132,9 +133,10 @@
(gimp-image-flatten img)
(gimp-palette-set-background old-bg-color)
(gimp-image-undo-enable img)
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-beveled-pattern-arrow"

View File

@ -21,10 +21,12 @@
(define (script-fu-beveled-pattern-bullet diameter pattern transparent)
(let* ((old-bg-color (car (gimp-palette-get-background)))
(img (car (gimp-image-new diameter diameter RGB)))
(let* ((img (car (gimp-image-new diameter diameter RGB)))
(background (car (gimp-layer-new img diameter diameter RGBA-IMAGE "Bullet" 100 NORMAL-MODE)))
(bumpmap (car (gimp-layer-new img diameter diameter RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE))))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-image-add-layer img background -1)
(gimp-image-add-layer img bumpmap -1)
@ -68,9 +70,10 @@
(if (= transparent FALSE)
(gimp-image-flatten img))
(gimp-palette-set-background old-bg-color)
(gimp-image-undo-enable img)
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-beveled-pattern-bullet"

View File

@ -39,9 +39,7 @@
(define (script-fu-beveled-pattern-button
text text-size font text-color pattern pressed)
(let* ((old-bg-color (car (gimp-palette-get-background)))
(text-extents (gimp-text-get-extents-fontname
(let* ((text-extents (gimp-text-get-extents-fontname
text text-size PIXELS font))
(ascent (text-ascent text-extents))
(descent (text-descent text-extents))
@ -61,6 +59,8 @@
(gimp-text-fontname
img -1 0 0 text 0 TRUE text-size PIXELS font))))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-image-add-layer img background 1)
(gimp-image-add-layer img bumpmap 1)
@ -106,9 +106,10 @@
(gimp-image-remove-layer img bumpmap)
(gimp-image-flatten img)
(gimp-palette-set-background old-bg-color)
(gimp-image-undo-enable img)
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-beveled-pattern-button"

View File

@ -28,9 +28,7 @@
(define (script-fu-beveled-pattern-heading
text text-size font pattern transparent)
(let* ((old-bg-color (car (gimp-palette-get-background)))
(img (car (gimp-image-new 10 10 RGB)))
(let* ((img (car (gimp-image-new 10 10 RGB)))
(textl
(car
(gimp-text-fontname img -1 0 0 text 0 TRUE text-size PIXELS font)))
@ -38,8 +36,14 @@
(width (car (gimp-drawable-width textl)))
(height (car (gimp-drawable-height textl)))
(background (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
(bumpmap (car (gimp-layer-new img width height RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE))))
(background (car (gimp-layer-new img
width height RGBA-IMAGE
"Background" 100 NORMAL-MODE)))
(bumpmap (car (gimp-layer-new img
width height RGBA-IMAGE
"Bumpmap" 100 NORMAL-MODE))))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-image-resize img width height 0 0)
@ -51,7 +55,8 @@
(gimp-palette-set-background '(0 0 0))
(gimp-edit-fill background BACKGROUND-FILL)
(gimp-patterns-set-pattern pattern)
(gimp-edit-bucket-fill background PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
(gimp-edit-bucket-fill background
PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
; Create bumpmap layer
@ -88,9 +93,10 @@
(if (= transparent FALSE)
(gimp-image-flatten img))
(gimp-palette-set-background old-bg-color)
(gimp-image-undo-enable img)
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-beveled-pattern-heading"

View File

@ -21,10 +21,16 @@
(define (script-fu-beveled-pattern-hrule width height pattern)
(let* ((old-bg-color (car (gimp-palette-get-background)))
(img (car (gimp-image-new width height RGB)))
(background (car (gimp-layer-new img width height RGB-IMAGE "Hrule" 100 NORMAL-MODE)))
(bumpmap (car (gimp-layer-new img width height RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE))))
(let* ((img (car (gimp-image-new width height RGB)))
(background (car (gimp-layer-new img
width height RGB-IMAGE
"Hrule" 100 NORMAL-MODE)))
(bumpmap (car (gimp-layer-new img
width height RGBA-IMAGE
"Bumpmap" 100 NORMAL-MODE))))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-image-add-layer img background -1)
(gimp-image-add-layer img bumpmap -1)
@ -57,9 +63,10 @@
(gimp-image-set-active-layer img background)
(gimp-image-remove-layer img bumpmap)
(gimp-palette-set-background old-bg-color)
(gimp-image-undo-enable img)
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-beveled-pattern-hrule"

View File

@ -39,10 +39,7 @@
width height RGBA-IMAGE
"Drop Shadow" 100 MULTIPLY-MODE)))
(dsl-layer-mask (car (gimp-layer-create-mask drop-shadow-layer
ADD-BLACK-MASK)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background)))
(old-grad (car (gimp-gradients-get-gradient))))
ADD-BLACK-MASK))))
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img shadow-layer 1)
@ -94,9 +91,8 @@
(gimp-edit-fill dsl-layer-mask BACKGROUND-FILL)
(gimp-layer-remove-mask drop-shadow-layer MASK-APPLY)
(gimp-selection-none img)
(gimp-palette-set-foreground old-fg)
(gimp-palette-set-background old-bg)
(gimp-gradients-set-gradient old-grad)))
(gimp-context-pop)))
(define (script-fu-blended-logo-alpha img
logo-layer
@ -148,19 +144,23 @@
blend-gradient-reverse)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(b-size (scale size 0.1))
(text-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
(old-fg (car (gimp-palette-get-foreground))))
(text-layer (car (gimp-text-fontname img
-1 0 0 text b-size TRUE
size PIXELS font))))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-drawable-set-name text-layer text)
(gimp-palette-set-foreground text-color)
(gimp-layer-set-preserve-trans text-layer TRUE)
(gimp-edit-fill text-layer FOREGROUND-FILL)
(gimp-palette-set-foreground old-fg)
(apply-blended-logo-effect img text-layer b-size bg-color
blend-mode blend-fg blend-bg
blend-gradient blend-gradient-reverse)
(gimp-image-undo-enable img)
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-blended-logo"
_"<Toolbox>/Xtns/Script-Fu/Logos/Blen_ded..."

View File

@ -26,10 +26,15 @@
bg-color)
(let* ((width (car (gimp-drawable-width logo-layer)))
(height (car (gimp-drawable-height logo-layer)))
(bg-layer (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
(blur-layer (car (gimp-layer-new img width height RGBA-IMAGE "Blur" 100 NORMAL-MODE)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(bg-layer (car (gimp-layer-new img
width height RGBA-IMAGE
"Background" 100 NORMAL-MODE)))
(blur-layer (car (gimp-layer-new img
width height RGBA-IMAGE
"Blur" 100 NORMAL-MODE))))
(gimp-context-push)
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img bg-layer 1)
(gimp-image-add-layer img blur-layer 1)
@ -57,13 +62,14 @@
(gimp-brightness-contrast logo-layer 0 127)
(gimp-selection-none img)
(gimp-layer-set-preserve-trans logo-layer FALSE)
(plug-in-bump-map 1 img logo-layer blur-layer 135 50 10 0 0 0 30 TRUE FALSE 0)
(plug-in-bump-map 1 img logo-layer blur-layer
135 50 10 0 0 0 30 TRUE FALSE 0)
(gimp-layer-set-offsets blur-layer 5 5)
(gimp-invert blur-layer)
(gimp-layer-set-opacity blur-layer 50.0)
(gimp-image-set-active-layer img logo-layer)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)))
(gimp-context-pop)))
(define (script-fu-bovinated-logo-alpha img
logo-layer

View File

@ -25,9 +25,7 @@
(let* (
;--- main variable: "bl-x" runs from 0 to layer-width
(bl-x 0)
(frame-nr 0)
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(frame-nr 0))
(if (< speed 1)
(set! speed (* -1 speed)) )
@ -37,6 +35,8 @@
;--- 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 )
@ -171,10 +171,10 @@
(gimp-image-undo-enable img)
(gimp-image-clean-all img)
(set! img-display (car (gimp-display-new img)))
(gimp-palette-set-foreground old-fg)
(gimp-palette-set-background old-bg)
(gimp-displays-flush))
(gimp-displays-flush)
(gimp-context-pop))
;--- false form of "if-1"
(gimp-message _"Burn-In: Need two layers in total!"

View File

@ -21,10 +21,9 @@
(define (script-fu-camo-pattern inSize inGrain inColor1 inColor2 inColor3 inSmooth inFlatten)
(set! old-bg (car (gimp-palette-get-background)))
(set! theWidth inSize)
(set! theHeight inSize)
(set! theImage (car(gimp-image-new theWidth theHeight RGB)))
(set! theImage (car (gimp-image-new theWidth theHeight RGB)))
(set! baseLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Background" 100 NORMAL-MODE)))
(gimp-image-add-layer theImage baseLayer 0)
@ -35,6 +34,8 @@
(set! thinLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Camo Thin Layer" 100 NORMAL-MODE)))
(gimp-image-add-layer theImage thinLayer 0)
(gimp-context-push)
(gimp-selection-all theImage)
(gimp-palette-set-background inColor1)
(gimp-drawable-fill baseLayer BACKGROUND-FILL)
@ -73,10 +74,11 @@
(if (= inFlatten TRUE)
(gimp-image-flatten theImage)
()
)
(gimp-palette-set-background old-bg)
)
(gimp-display-new theImage)
)
(gimp-context-pop))

View File

@ -73,10 +73,10 @@
(bg-type (car (gimp-drawable-type bg-layer)))
(bg-image (car (gimp-drawable-get-image bg-layer)))
(layer1 (car (gimp-layer-new img bg-width bg-height bg-type "Layer1" 100 NORMAL-MODE)))
(inset-layer (car (gimp-layer-new img bg-width bg-height bg-type "inset1" 100 NORMAL-MODE)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background)))
(old-brush (car (gimp-brushes-get-brush))))
(inset-layer (car (gimp-layer-new img bg-width bg-height bg-type "inset1" 100 NORMAL-MODE))))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-selection-all img)
(gimp-edit-clear inset-layer)
@ -170,11 +170,10 @@
(gimp-drawable-set-name cast-shadow-layer "Cast Shadow")
(gimp-drawable-set-name inset-layer "Inset")
(gimp-palette-set-foreground old-fg)
(gimp-palette-set-background old-bg)
(gimp-brushes-set-brush old-brush)
(gimp-display-new img)
(gimp-image-undo-enable img)))
(gimp-image-undo-enable img)
(gimp-context-pop)))
(script-fu-register "script-fu-carve-it"
_"<Image>/Script-Fu/Stencil Ops/C_arve-It..."

View File

@ -46,10 +46,10 @@
(cast-shadow-layer 0)
(csl-mask 0)
(inset-layer 0)
(il-mask 0)
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background)))
(old-brush (car (gimp-brushes-get-brush))))
(il-mask 0))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-image-set-filename img "")
@ -146,11 +146,10 @@
(gimp-drawable-set-name cast-shadow-layer "Cast Shadow")
(gimp-drawable-set-name inset-layer "Inset")
(gimp-palette-set-foreground old-fg)
(gimp-palette-set-background old-bg)
(gimp-brushes-set-brush old-brush)
(gimp-display-new img)
(gimp-image-undo-enable img)))
(gimp-image-undo-enable img)
(gimp-context-pop)))
(script-fu-register "script-fu-carved-logo"
_"<Toolbox>/Xtns/Script-Fu/Logos/Carved..."

View File

@ -26,9 +26,11 @@
bg-color)
(let* ((width (car (gimp-drawable-width logo-layer)))
(height (car (gimp-drawable-height logo-layer)))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(bg-layer (car (gimp-layer-new img
width height RGB-IMAGE
"Background" 100 NORMAL-MODE))))
(gimp-context-push)
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
@ -51,13 +53,12 @@
(gimp-edit-clear logo-layer)
(gimp-selection-none img)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)))
(gimp-context-pop)))
(define (script-fu-chalk-logo-alpha img
logo-layer
bg-color)
logo-layer
bg-color)
(begin
(gimp-image-undo-group-start img)
(apply-chalk-logo-effect img logo-layer bg-color)
@ -73,8 +74,7 @@
"RGBA"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-COLOR _"Background color" '(0 0 0)
)
SF-COLOR _"Background color" '(0 0 0))
(define (script-fu-chalk-logo text
@ -84,17 +84,20 @@
chalk-color)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(border (/ size 4))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
(old-fg (car (gimp-palette-get-foreground))))
(text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font))))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-drawable-set-name text-layer text)
(gimp-palette-set-foreground chalk-color)
(gimp-layer-set-preserve-trans text-layer TRUE)
(gimp-edit-fill text-layer FOREGROUND-FILL)
(gimp-palette-set-foreground old-fg)
(apply-chalk-logo-effect img text-layer bg-color)
(gimp-image-undo-enable img)
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-chalk-logo"
_"<Toolbox>/Xtns/Script-Fu/Logos/_Chalk..."
@ -107,5 +110,4 @@
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT _"Font" "Cooper"
SF-COLOR _"Background color" '(0 0 0)
SF-COLOR _"Chalk color" '(255 255 255)
)
SF-COLOR _"Chalk color" '(255 255 255))

View File

@ -49,10 +49,10 @@
(let* ((width (car (gimp-drawable-width logo-layer)))
(height (car (gimp-drawable-height logo-layer)))
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
(bump-layer (car (gimp-layer-new img width height RGBA-IMAGE "Bump Layer" 100 NORMAL-MODE)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background)))
(old-pattern (car (gimp-patterns-get-pattern))))
(bump-layer (car (gimp-layer-new img width height RGBA-IMAGE "Bump Layer" 100 NORMAL-MODE))))
(gimp-context-push)
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img bg-layer 1)
(gimp-layer-set-preserve-trans logo-layer TRUE)
@ -106,10 +106,7 @@
(if (= keep-back FALSE)
(gimp-image-remove-layer img bg-layer))
(gimp-patterns-set-pattern old-pattern)
(gimp-palette-set-foreground old-fg)
(gimp-palette-set-background old-bg)
))
(gimp-context-pop)))
(define (script-fu-chip-away-logo-alpha img
logo-layer

View File

@ -85,11 +85,10 @@
(layer3 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 3" 100 NORMAL-MODE)))
(shadow (car (gimp-layer-new img width height GRAYA-IMAGE "Drop Shadow" 100 NORMAL-MODE)))
(mask-fs 0)
(layer-mask 0)
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background)))
(old-brush (car (gimp-brushes-get-brush)))
(old-pattern (car (gimp-patterns-get-pattern))))
(layer-mask 0))
(gimp-context-push)
(gimp-image-undo-disable img)
(gimp-image-add-channel img mask 0)
@ -174,12 +173,10 @@
(gimp-image-remove-channel img mask)
(gimp-palette-set-foreground old-fg)
(gimp-palette-set-background old-bg)
(gimp-brushes-set-brush old-brush)
(gimp-patterns-set-pattern old-pattern)
(gimp-display-new img)
(gimp-image-undo-enable img)))
(gimp-image-undo-enable img)
(gimp-context-pop)))
(script-fu-register "script-fu-sota-chrome-it"
_"<Image>/Script-Fu/Stencil Ops/C_hrome-It..."

View File

@ -16,9 +16,10 @@
(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)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(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)
@ -60,8 +61,8 @@
(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-palette-set-foreground old-fg)
(gimp-palette-set-background old-bg)))
(gimp-context-pop)))
(define (script-fu-chrome-logo-alpha img
logo-layer

View File

@ -40,9 +40,10 @@
(type (car (gimp-drawable-type-with-alpha drawable)))
(image-width (car (gimp-image-width image)))
(image-height (car (gimp-image-height image)))
(old-fg (car (gimp-palette-get-foreground)))
)
(gimp-context-push)
(gimp-image-undo-group-start image)
(gimp-layer-add-alpha drawable)
@ -85,12 +86,10 @@
(gimp-image-set-active-layer image effect-layer )))
(set! active-layer (car (gimp-image-get-active-layer image)))
(if (and
(= remove-bg TRUE)
(= old-bg '(0 0 0)))
(if (= remove-bg TRUE)
(gimp-palette-set-foreground '(0 0 0))
(gimp-palette-set-foreground '(14 14 14)))
(gimp-selection-load active-selection)
(plug-in-maze 1 image active-layer 5 5 TRUE 0 seed 57 1)
(plug-in-oilify 1 image active-layer mask-size 0)
@ -112,8 +111,6 @@
FALSE)
(gimp-edit-clear active-layer)))
(gimp-palette-set-foreground old-fg)
(if (= keep-selection FALSE)
(gimp-selection-none image))
@ -122,7 +119,9 @@
(gimp-image-undo-group-end image)
(gimp-displays-flush)))
(gimp-displays-flush)
(gimp-context-pop)))
(script-fu-register "script-fu-circuit"
_"<Image>/Script-Fu/Render/_Circuit..."

View File

@ -5,38 +5,39 @@
; Tim Newsome <drz@froody.bloke.com> 4/11/97
(define (script-fu-clothify timg tdrawable bx by azimuth elevation depth)
(let* (
(width (car (gimp-drawable-width tdrawable)))
(height (car (gimp-drawable-height tdrawable)))
(img (car (gimp-image-new width height RGB)))
; (layer-two (car (gimp-layer-new img width height RGB-IMAGE "Y Dots" 100 MULTIPLY-MODE)))
(layer-one (car (gimp-layer-new img width height RGB-IMAGE "X Dots" 100 NORMAL-MODE)))
(old-bg (car (gimp-palette-get-background))))
(let*
((width (car (gimp-drawable-width tdrawable)))
(height (car (gimp-drawable-height tdrawable)))
(img (car (gimp-image-new width height RGB)))
; (layer-two (car (gimp-layer-new img width height RGB-IMAGE "Y Dots" 100 MULTIPLY-MODE)))
(layer-one (car (gimp-layer-new img width height RGB-IMAGE "X Dots" 100 NORMAL-MODE))))
(gimp-image-undo-disable img)
(gimp-palette-set-background '(255 255 255))
(gimp-edit-fill layer-one BACKGROUND-FILL)
(gimp-image-add-layer img layer-one 0)
(gimp-context-push)
(plug-in-noisify 1 img layer-one FALSE 0.7 0.7 0.7 0.7)
(gimp-image-undo-disable img)
(gimp-palette-set-background '(255 255 255))
(gimp-edit-fill layer-one BACKGROUND-FILL)
(gimp-image-add-layer img layer-one 0)
(set! layer-two (car (gimp-layer-copy layer-one 0)))
(gimp-layer-set-mode layer-two MULTIPLY-MODE)
(gimp-image-add-layer img layer-two 0)
(plug-in-noisify 1 img layer-one FALSE 0.7 0.7 0.7 0.7)
(plug-in-gauss-rle 1 img layer-one bx TRUE FALSE)
(plug-in-gauss-rle 1 img layer-two by FALSE TRUE)
(gimp-image-flatten img)
(set! bump-layer (car (gimp-image-get-active-layer img)))
(set! layer-two (car (gimp-layer-copy layer-one 0)))
(gimp-layer-set-mode layer-two MULTIPLY-MODE)
(gimp-image-add-layer img layer-two 0)
(plug-in-c-astretch 1 img bump-layer)
(plug-in-noisify 1 img bump-layer FALSE 0.2 0.2 0.2 0.2)
(plug-in-gauss-rle 1 img layer-one bx TRUE FALSE)
(plug-in-gauss-rle 1 img layer-two by FALSE TRUE)
(gimp-image-flatten img)
(set! bump-layer (car (gimp-image-get-active-layer img)))
(plug-in-bump-map 1 img tdrawable bump-layer azimuth elevation depth 0 0 0 0 FALSE FALSE 0)
(gimp-image-delete img)
(gimp-palette-set-background old-bg)
(gimp-displays-flush)
))
(plug-in-c-astretch 1 img bump-layer)
(plug-in-noisify 1 img bump-layer FALSE 0.2 0.2 0.2 0.2)
(plug-in-bump-map 1 img tdrawable bump-layer azimuth elevation depth 0 0 0 0 FALSE FALSE 0)
(gimp-image-delete img)
(gimp-displays-flush)
(gimp-context-pop)))
(script-fu-register "script-fu-clothify"

View File

@ -21,13 +21,14 @@
inNumber
inDark)
(set! old-gradient (car (gimp-gradients-get-gradient)))
(set! theImage inImage)
(set! theHeight (car (gimp-image-height theImage)))
(set! theWidth (car (gimp-image-width theImage)))
(set! theNumber inNumber)
(set! theSize (min theWidth theHeight))
(gimp-context-push)
(gimp-image-undo-group-start theImage)
(while (> theNumber 0)
@ -66,8 +67,9 @@
(gimp-image-undo-group-end theImage)
(gimp-gradients-set-gradient old-gradient)
(gimp-displays-flush))
(gimp-displays-flush)
(gimp-context-pop))
; Register the function with the GIMP:

View File

@ -33,10 +33,9 @@
(bg-layer (car (gimp-layer-new img width height RGBA-IMAGE
"Background" 100 NORMAL-MODE)))
(white-layer (car (gimp-layer-copy logo-layer 1)))
(black-layer (car (gimp-layer-copy logo-layer 1)))
(old-gradient (car (gimp-gradients-get-gradient)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(black-layer (car (gimp-layer-copy logo-layer 1))))
(gimp-context-push)
(script-fu-util-image-resize-from-layer img logo-layer)
(gimp-image-add-layer img bg-layer 1)
@ -88,9 +87,8 @@
(gimp-brightness-contrast logo-layer 0 30)
(plug-in-threshold-alpha 1 img logo-layer 60)
(gimp-image-set-active-layer img logo-layer)
(gimp-gradients-set-gradient old-gradient)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)))
(gimp-context-pop)))
(define (script-fu-comic-logo-alpha img
logo-layer

View File

@ -27,10 +27,9 @@
(reflect-layer (car (gimp-layer-new img width height RGBA-IMAGE "Reflection" 100 NORMAL-MODE)))
(channel 0)
(fs 0)
(layer-mask 0)
(old-gradient (car (gimp-gradients-get-gradient)))
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background))))
(layer-mask 0))
(gimp-context-push)
(gimp-selection-none img)
(gimp-image-resize img img-width img-height posx posy)
@ -102,9 +101,7 @@
(gimp-image-remove-channel img channel)
(gimp-gradients-set-gradient old-gradient)
(gimp-palette-set-background old-bg)
(gimp-palette-set-foreground old-fg)))
(gimp-context-pop)))
(define (script-fu-cool-metal-logo-alpha img

View File

@ -92,10 +92,10 @@
(layer3 (car (gimp-layer-new img width height GRAYA-IMAGE "Layer 3" 100 NORMAL-MODE)))
(layer-mask 0)
(layer-mask2 0)
(disp-map 0)
(old-fg (car (gimp-palette-get-foreground)))
(old-bg (car (gimp-palette-get-background)))
(old-brush (car (gimp-brushes-get-brush))))
(disp-map 0))
(gimp-context-push)
(gimp-image-delete back-img)
(gimp-image-undo-disable img)
(gimp-image-resize img width height 0 0)
@ -179,11 +179,10 @@
(gimp-drawable-set-name bg-layer "Background")
(gimp-drawable-set-name text-layer "Shadow")
(gimp-palette-set-foreground old-fg)
(gimp-palette-set-background old-bg)
(gimp-brushes-set-brush old-brush)
(gimp-image-undo-enable img)
(gimp-display-new img)))
(gimp-display-new img)
(gimp-context-pop)))
(script-fu-register "script-fu-crystal-logo"