Commit 27bef34b authored by Kevin Cozens's avatar Kevin Cozens

Don't change global context and protect scripts from global context settings.

parent 05d4e788
......@@ -82,6 +82,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
; disable undo on copy, start group otherwise
(if (= work-on-copy TRUE)
......
......@@ -128,8 +128,7 @@
)
(gimp-context-push)
(gimp-context-set-antialias TRUE)
(gimp-context-set-feather FALSE)
(gimp-context-set-defaults)
(gimp-image-undo-disable img)
;(gimp-image-resize img (+ length height) (+ height height) 0 0)
......
......@@ -20,8 +20,7 @@
)
(gimp-context-push)
(gimp-context-set-antialias TRUE)
(gimp-context-set-feather FALSE)
(gimp-context-set-defaults)
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
......
......@@ -45,6 +45,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(script-fu-util-image-resize-from-layer img logo-layer)
(script-fu-util-image-add-layers img bands-layer bg-layer)
......
......@@ -13,6 +13,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
......
......@@ -31,6 +31,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
......
......@@ -83,8 +83,7 @@
)
(gimp-context-push)
(gimp-context-set-antialias TRUE)
(gimp-context-set-feather FALSE)
(gimp-context-set-defaults)
(gimp-image-undo-disable img)
(gimp-image-insert-layer img background 0 -1)
......
......@@ -27,8 +27,7 @@
)
(gimp-context-push)
(gimp-context-set-antialias TRUE)
(gimp-context-set-feather FALSE)
(gimp-context-set-defaults)
(gimp-image-undo-disable img)
(gimp-image-insert-layer img background 0 -1)
......
......@@ -45,6 +45,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-undo-disable img)
(gimp-image-resize img width height 0 0)
......
......@@ -108,6 +108,7 @@
blend-gradient-reverse)
(begin
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-undo-group-start img)
(apply-blended-logo-effect img logo-layer b-size bg-color
......
......@@ -35,6 +35,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(script-fu-util-image-resize-from-layer img logo-layer)
(script-fu-util-image-add-layers img blur-layer bg-layer)
......
......@@ -55,7 +55,7 @@
;--- main program structure starts here, begin of "if-1"
(begin
(gimp-context-push)
(gimp-context-set-feather FALSE)
(gimp-context-set-defaults)
(set! img (car (gimp-image-duplicate org-img)))
(gimp-image-undo-disable img)
......
......@@ -31,6 +31,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-insert-layer theImage baseLayer 0 0)
......
......@@ -77,6 +77,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-undo-disable img)
......
......@@ -51,6 +51,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-undo-disable img)
......
......@@ -53,6 +53,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(script-fu-util-image-resize-from-layer img logo-layer)
(script-fu-util-image-add-layers img bump-layer bg-layer)
......
......@@ -110,6 +110,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-undo-disable img)
......
......@@ -21,6 +21,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(script-fu-util-image-resize-from-layer img logo-layer)
(script-fu-util-image-add-layers img layer1 layer2 layer3 shadow background)
......
......@@ -51,6 +51,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-undo-group-start image)
......
......@@ -26,8 +26,7 @@
)
(gimp-context-push)
(gimp-context-set-antialias TRUE)
(gimp-context-set-feather FALSE)
(gimp-context-set-defaults)
(gimp-image-undo-group-start theImage)
......
......@@ -176,6 +176,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-context-set-foreground text-color)
(gimp-context-set-background bg-color)
......
......@@ -32,6 +32,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-context-set-feather FALSE)
(gimp-context-set-interpolation INTERPOLATION-NONE)
(gimp-context-set-transform-resize TRANSFORM-RESIZE-ADJUST)
......
......@@ -112,6 +112,7 @@
(disp-map 0)
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-delete back-img)
(gimp-image-undo-disable img)
......
......@@ -37,59 +37,63 @@
(theMode (car (gimp-image-base-type inImage)))
)
(gimp-image-undo-group-start theImage)
(if (= theMode GRAY)
(set! theMode GRAYA-IMAGE)
(set! theMode RGBA-IMAGE)
)
(set! theLayer (car (gimp-layer-new theImage
theWidth
theHeight
theMode
"Distress Scratch Layer"
100
NORMAL-MODE)))
(gimp-image-insert-layer theImage theLayer 0 0)
(if (= FALSE (car (gimp-selection-is-empty theImage)))
(gimp-edit-fill theLayer BACKGROUND-FILL)
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-undo-group-start theImage)
(gimp-selection-invert theImage)
(if (= theMode GRAY)
(set! theMode GRAYA-IMAGE)
(set! theMode RGBA-IMAGE)
)
(set! theLayer (car (gimp-layer-new theImage
theWidth
theHeight
theMode
"Distress Scratch Layer"
100
NORMAL-MODE)))
(gimp-image-insert-layer theImage theLayer 0 0)
(if (= FALSE (car (gimp-selection-is-empty theImage)))
(gimp-edit-fill theLayer BACKGROUND-FILL)
)
(if (= FALSE (car (gimp-selection-is-empty theImage)))
(gimp-edit-clear theLayer)
)
(gimp-selection-invert theImage)
(gimp-selection-invert theImage)
(gimp-selection-none inImage)
(gimp-layer-scale theLayer
(/ theWidth inGranu)
(/ theHeight inGranu)
TRUE)
(plug-in-spread RUN-NONINTERACTIVE
theImage
theLayer
inSpread
inSpread)
(plug-in-gauss-iir RUN-NONINTERACTIVE
theImage theLayer inSmooth inSmoothH inSmoothV)
(gimp-layer-scale theLayer theWidth theHeight TRUE)
(plug-in-threshold-alpha RUN-NONINTERACTIVE theImage theLayer inThreshold)
(plug-in-gauss-iir RUN-NONINTERACTIVE theImage theLayer 1 TRUE TRUE)
(gimp-image-select-item inImage CHANNEL-OP-REPLACE theLayer)
(gimp-image-remove-layer theImage theLayer)
(if (and (= (car (gimp-item-is-channel inDrawable)) TRUE)
(= (car (gimp-item-is-layer-mask inDrawable)) FALSE))
(gimp-image-set-active-channel theImage inDrawable)
(if (= FALSE (car (gimp-selection-is-empty theImage)))
(gimp-edit-clear theLayer)
)
(gimp-image-undo-group-end theImage)
(gimp-displays-flush)
(gimp-selection-invert theImage)
(gimp-selection-none inImage)
(gimp-layer-scale theLayer
(/ theWidth inGranu)
(/ theHeight inGranu)
TRUE)
(plug-in-spread RUN-NONINTERACTIVE
theImage
theLayer
inSpread
inSpread)
(plug-in-gauss-iir RUN-NONINTERACTIVE
theImage theLayer inSmooth inSmoothH inSmoothV)
(gimp-layer-scale theLayer theWidth theHeight TRUE)
(plug-in-threshold-alpha RUN-NONINTERACTIVE theImage theLayer inThreshold)
(plug-in-gauss-iir RUN-NONINTERACTIVE theImage theLayer 1 TRUE TRUE)
(gimp-image-select-item inImage CHANNEL-OP-REPLACE theLayer)
(gimp-image-remove-layer theImage theLayer)
(if (and (= (car (gimp-item-is-channel inDrawable)) TRUE)
(= (car (gimp-item-is-layer-mask inDrawable)) FALSE))
(gimp-image-set-active-channel theImage inDrawable)
)
(gimp-image-undo-group-end theImage)
(gimp-displays-flush)
(gimp-context-pop)
)
)
......
......@@ -56,6 +56,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-set-active-layer image drawable)
......
......@@ -34,6 +34,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(if ( = isnew 1) (script-fu-util-image-resize-from-layer img shadow-layer))
......
......@@ -50,6 +50,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(script-fu-util-image-resize-from-layer img logo-layer)
(script-fu-util-image-add-layers img grow-me bg-layer)
......@@ -121,9 +122,9 @@
(gimp-selection-none img)
(plug-in-bump-map (if (= noninteractive TRUE)
RUN-NONINTERACTIVE
RUN-INTERACTIVE)
img grow-me logo-layer
RUN-NONINTERACTIVE
RUN-INTERACTIVE)
img grow-me logo-layer
110.0 45.0 3 0 0 0 0 TRUE FALSE 0)
(gimp-layer-set-mode logo-layer SCREEN-MODE)
......
......@@ -19,6 +19,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(script-fu-util-image-resize-from-layer img logo-layer)
(script-fu-util-image-add-layers img glow-layer bg-layer)
......
......@@ -34,6 +34,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(script-fu-util-image-resize-from-layer img logo-layer)
(script-fu-util-image-add-layers img blur-layer bg-layer)
......
......@@ -32,6 +32,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-undo-disable img)
(gimp-image-undo-disable distortion-img)
......
......@@ -36,34 +36,36 @@
RGB-IMAGE "Bottom" 100 NORMAL-MODE)))
(layer-two 0)
)
(gimp-context-set-gradient gradient)
(gimp-image-undo-disable img)
(gimp-image-insert-layer img layer-one 0 0)
(plug-in-solid-noise RUN-NONINTERACTIVE img layer-one TRUE FALSE seed detail xscale yscale)
(plug-in-c-astretch RUN-NONINTERACTIVE img layer-one)
(set! layer-two (car (gimp-layer-copy layer-one TRUE)))
(gimp-image-insert-layer img layer-two 0 -1)
(gimp-image-set-active-layer img layer-two)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-context-set-gradient gradient)
(gimp-image-undo-disable img)
(gimp-image-insert-layer img layer-one 0 0)
(plug-in-gradmap RUN-NONINTERACTIVE img layer-two)
(plug-in-solid-noise RUN-NONINTERACTIVE img layer-one TRUE FALSE seed detail xscale yscale)
(plug-in-c-astretch RUN-NONINTERACTIVE img layer-one)
(set! layer-two (car (gimp-layer-copy layer-one TRUE)))
(gimp-image-insert-layer img layer-two 0 -1)
(gimp-image-set-active-layer img layer-two)
(plug-in-gradmap RUN-NONINTERACTIVE img layer-two)
(gimp-image-select-color img CHANNEL-OP-REPLACE layer-one '(190 190 190))
(plug-in-bump-map RUN-NONINTERACTIVE img layer-two layer-one 135.0 35 landheight 0 0 0 0 TRUE FALSE 0)
(gimp-image-select-color img CHANNEL-OP-REPLACE layer-one '(190 190 190))
(plug-in-bump-map RUN-NONINTERACTIVE img layer-two layer-one 135.0 35 landheight 0 0 0 0 TRUE FALSE 0)
;(plug-in-c-astretch RUN-NONINTERACTIVE img layer-two)
(gimp-selection-invert img)
(plug-in-bump-map RUN-NONINTERACTIVE img layer-two layer-one 135.0 35 seadepth 0 0 0 0 TRUE FALSE 0)
;(plug-in-c-astretch RUN-NONINTERACTIVE img layer-two)
(gimp-selection-invert img)
(plug-in-bump-map RUN-NONINTERACTIVE img layer-two layer-one 135.0 35 seadepth 0 0 0 0 TRUE FALSE 0)
;(plug-in-c-astretch RUN-NONINTERACTIVE img layer-two)
;(plug-in-c-astretch RUN-NONINTERACTIVE img layer-two)
; uncomment the next line if you want to keep a selection of the "land"
(gimp-selection-none img)
; uncomment the next line if you want to keep a selection of the "land"
(gimp-selection-none img)
(gimp-display-new img)
(gimp-image-undo-enable img)
(gimp-display-new img)
(gimp-image-undo-enable img)
(gimp-context-pop)
)
)
......
......@@ -46,6 +46,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-undo-group-start image)
(if (= (car (gimp-drawable-has-alpha drawable)) FALSE)
......
......@@ -25,8 +25,7 @@
(dir-deg/line (/ 360 num-of-lines))
)
(gimp-context-push)
(gimp-context-set-antialias TRUE)
(gimp-context-set-feather FALSE)
(gimp-context-set-defaults)
(define (draw-vector beg-x beg-y direction)
......
......@@ -36,7 +36,7 @@
)
(gimp-context-push)
(gimp-context-set-feather FALSE)
(gimp-context-set-defaults)
(gimp-image-undo-disable img)
(gimp-image-insert-layer img drawable 0 0)
......
......@@ -116,6 +116,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
; ensure that we don't shrink selection so much
; that we create an empty selection.
......
......@@ -32,6 +32,7 @@
)
(gimp-context-push)
(gimp-context-set-defaults)
(gimp-image-undo-disable img)
(gimp-image-insert-layer img bg-layer 0 1)
......
......@@ -48,148 +48,149 @@
(shadow-layer 0)
)
(gimp-context-push)
(if (> rel-distance 24) (set! rel-distance 999999))
(if (= rel-distance rel-length) (set! rel-distance (+ rel-distance 0.01)))
(gimp-image-undo-group-start image)
(gimp-layer-add-alpha drawable)
(if (= (car (gimp-selection-is-empty image)) TRUE)
(begin
(gimp-image-select-item image CHANNEL-OP-REPLACE drawable)
(set! from-selection FALSE))
(begin
(set! from-selection TRUE)
(set! active-selection (car (gimp-selection-save image)))))
(let* ((selection-bounds (gimp-selection-bounds image))
(select-offset-x (cadr selection-bounds))
(select-offset-y (caddr selection-bounds))
(select-width (- (cadr (cddr selection-bounds)) select-offset-x))
(select-height (- (caddr (cddr selection-bounds)) select-offset-y))
(abs-length (* rel-length select-height))
(abs-distance (* rel-distance select-height))
(half-bottom-width (/ select-width 2))
(half-top-width (* half-bottom-width
(/ (- rel-distance rel-length) rel-distance)))
(x0 (+ select-offset-x (+ (- half-bottom-width half-top-width)
(* (cos alpha) abs-length))))
(y0 (+ select-offset-y (- select-height
(* (sin alpha) abs-length))))
(x1 (+ x0 (* 2 half-top-width)))
(y1 y0)
(x2 select-offset-x)
(y2 (+ select-offset-y select-height))
(x3 (+ x2 select-width))
(y3 y2)
(shadow-width (+ (- (max x1 x3) (min x0 x2)) (* 2 shadow-blur)))
(shadow-height (+ (- (max y1 y3) (min y0 y2)) (* 2 shadow-blur)))
(shadow-offset-x (- (min x0 x2) shadow-blur))
(shadow-offset-y (- (min y0 y2) shadow-blur)))
(set! shadow-layer (car (gimp-layer-new image
select-width
select-height
type
"Perspective Shadow"
shadow-opacity
NORMAL-MODE)))
(gimp-image-insert-layer image shadow-layer 0 -1)
(gimp-layer-set-offsets shadow-layer select-offset-x select-offset-y)
(gimp-drawable-fill shadow-layer TRANSPARENT-FILL)
(gimp-context-set-background shadow-color)
(gimp-edit-fill shadow-layer BACKGROUND-FILL)
(gimp-selection-none image)
(if (= allow-resize TRUE)
(let* ((new-image-width image-width)
(new-image-height image-height)
(image-offset-x 0)
(image-offset-y 0))
(if (< shadow-offset-x 0)
(begin
(set! image-offset-x (abs shadow-offset-x))
(set! new-image-width (+ new-image-width image-offset-x))
; adjust to new coordinate system
(set! x0 (+ x0 image-offset-x))
(set! x1 (+ x1 image-offset-x))
(set! x2 (+ x2 image-offset-x))
(set! x3 (+ x3 image-offset-x))
))
(if (< shadow-offset-y 0)
(begin
(set! image-offset-y (abs shadow-offset-y))
(set! new-image-height (+ new-image-height image-offset-y))
; adjust to new coordinate system
(set! y0 (+ y0 image-offset-y))
(set! y1 (+ y1 image-offset-y))
(set! y2 (+ y2 image-offset-y))
(set! y3 (+ y3 image-offset-y))
))
(if (> (+ shadow-width shadow-offset-x) new-image-width)
(set! new-image-width (+ shadow-width shadow-offset-x)))
(if (> (+ shadow-height shadow-offset-y) new-image-height)
(set! new-image-height (+ shadow-height shadow-offset-y)))
(gimp-image-resize image
new-image-width
new-image-height
image-offset-x
image-offset-y)))
(gimp-context-set-transform-direction TRANSFORM-FORWARD)
(gimp-context-set-interpolation interpolation)
(gimp-context-set-transform-recursion 3)
(gimp-context-set-transform-resize TRANSFORM-RESIZE-ADJUST)
(gimp-item-transform-perspective shadow-layer
x0 y0
x1 y1
x2 y2
x3 y3)
(if (>= shadow-blur 1.0)
(gimp-context-push)
(gimp-context-set-defaults)
(if (> rel-distance 24) (set! rel-distance 999999))
(if (= rel-distance rel-length) (set! rel-distance (+ rel-distance 0.01)))
(gimp-image-undo-group-start image)
(gimp-layer-add-alpha drawable)
(if (= (car (gimp-selection-is-empty image)) TRUE)
(begin
(gimp-image-select-item image CHANNEL-OP-REPLACE drawable)
(set! from-selection FALSE))
(begin
(gimp-layer-set-lock-alpha shadow-layer FALSE)
(gimp-layer-resize shadow-layer
shadow-width
shadow-height
shadow-blur
shadow-blur)
(plug-in-gauss-rle RUN-NONINTERACTIVE
image
shadow-layer
shadow-blur
TRUE
TRUE))))
(if (= from-selection TRUE)
(begin
(gimp-image-select-item image CHANNEL-OP-REPLACE active-selection)
(gimp-edit-clear shadow-layer)
(gimp-image-remove-channel image active-selection)))
(if (and
(= (car (gimp-layer-is-floating-sel drawable)) 0)
(= from-selection FALSE))
(gimp-image-raise-item image drawable))
(gimp-image-set-active-layer image drawable)
(gimp-image-undo-group-end image)
(gimp-displays-flush)
(gimp-context-pop)
(set! from-selection TRUE)
(set! active-selection (car (gimp-selection-save image)))))
(let* ((selection-bounds (gimp-selection-bounds image))
(select-offset-x (cadr selection-bounds))
(select-offset-y (caddr selection-bounds))
(select-width (- (cadr (cddr selection-bounds)) select-offset-x))
(select-height (- (caddr (cddr selection-bounds)) select-offset-y))
(abs-length (* rel-length select-height))
(abs-distance (* rel-distance select-height))
(half-bottom-width (/ select-width 2))
(half-top-width (* half-bottom-width
(/ (- rel-distance rel-length) rel-distance)))
(x0 (+ select-offset-x (+ (- half-bottom-width half-top-width)
(* (cos alpha) abs-length))))
(y0 (+ select-offset-y (- select-height
(* (sin alpha) abs-length))))
(x1 (+ x0 (* 2 half-top-width)))
(y1 y0)
(x2 select-offset-x)
(y2 (+ select-offset-y select-height))
(x3 (+ x2 select-width))
(y3 y2)
(shadow-width (+ (- (max x1 x3) (min x0 x2)) (* 2 shadow-blur)))
(shadow-height (+ (- (max y1 y3) (min y0 y2)) (* 2 shadow-blur)))
(shadow-offset-x (- (min x0 x2) shadow-blur))
(shadow-offset-y (- (min y0 y2) shadow-blur)))
(set! shadow-layer (car (gimp-layer-new image
select-width
select-height
type
"Perspective Shadow"
shadow-opacity
NORMAL-MODE)))
(gimp-image-insert-layer image shadow-layer 0 -1)
(gimp-layer-set-offsets shadow-layer select-offset-x select-offset-y)
(gimp-drawable-fill shadow-layer TRANSPARENT-FILL)