Applied modified version of first patch for bug #642939.

Original patch supplied by Nelson A. de Oliveira. Modified to not use the
-1 "insanity" for invalid/none layer ID's in scripts per IRC discussion.
This commit is contained in:
Kevin Cozens 2011-03-02 02:21:50 -05:00
parent 8438bc5bb7
commit 403630fd57
4 changed files with 16 additions and 23 deletions

View File

@ -32,13 +32,13 @@
(gimp-context-push)
(gimp-image-insert-layer theImage baseLayer 0)
(gimp-image-insert-layer theImage baseLayer 0 0)
(set! thickLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Camo Thick Layer" 100 NORMAL-MODE)))
(gimp-image-insert-layer theImage thickLayer 0)
(gimp-image-insert-layer theImage thickLayer 0 0)
(set! thinLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Camo Thin Layer" 100 NORMAL-MODE)))
(gimp-image-insert-layer theImage thinLayer 0)
(gimp-image-insert-layer theImage thinLayer 0 0)
(gimp-selection-all theImage)
(gimp-context-set-background inColor1)
@ -54,8 +54,7 @@
(set! theBlur (- 16 inGrain))
(gimp-context-set-background inColor2)
(gimp-by-color-select thickLayer
'(0 0 0) 127 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE)
(gimp-image-select-color theImage CHANNEL-OP-REPLACE thickLayer '(0 0 0))
(gimp-edit-clear thickLayer)
(gimp-selection-invert theImage)
(gimp-edit-fill thickLayer BACKGROUND-FILL)
@ -66,7 +65,7 @@
(gimp-context-set-background inColor3)
(gimp-by-color-select thinLayer '(0 0 0) 127 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE)
(gimp-image-select-color theImage CHANNEL-OP-REPLACE thinLayer '(0 0 0))
(gimp-edit-clear thinLayer)
(gimp-selection-invert theImage)
(gimp-edit-fill thinLayer BACKGROUND-FILL)

View File

@ -112,15 +112,7 @@
(= remove-bg TRUE)
(= separate-layer TRUE))
(begin
(gimp-by-color-select
active-layer
'(0 0 0)
15
2
TRUE
FALSE
10
FALSE)
(gimp-image-select-color image CHANNEL-OP-REPLACE active-layer '(0 0 0))
(gimp-edit-clear active-layer)))
(if (= keep-selection FALSE)

View File

@ -38,19 +38,19 @@
)
(gimp-context-set-gradient gradient)
(gimp-image-undo-disable img)
(gimp-image-add-layer img layer-one 0)
(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-add-layer img layer-two -1)
(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-by-color-select layer-one '(190 190 190) 55 CHANNEL-OP-REPLACE FALSE FALSE 0 FALSE)
(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)

View File

@ -34,7 +34,9 @@
(gimp-image-undo-group-start theImage)
(gimp-layer-resize theLayer (* 3 theWidth) (* 3 theHeight) 0 0)
(gimp-rect-select theImage 0 0 theWidth theHeight CHANNEL-OP-REPLACE 0 0)
(gimp-context-set-feather 0)
(gimp-context-set-feather-radius 0 0)
(gimp-image-select-rectangle theImage CHANNEL-OP-REPLACE 0 0 theWidth theHeight)
(gimp-edit-cut theLayer)
(gimp-selection-none theImage)