1998-05-12 15:21:08 -07:00
|
|
|
; Chris Gutteridge (cjg@ecs.soton.ac.uk)
|
|
|
|
|
; At ECS Dept, University of Southampton, England.
|
|
|
|
|
|
2009-01-17 14:28:01 -08:00
|
|
|
; This program is free software: you can redistribute it and/or modify
|
1998-05-12 15:21:08 -07:00
|
|
|
; it under the terms of the GNU General Public License as published by
|
2009-01-17 14:28:01 -08:00
|
|
|
; the Free Software Foundation; either version 3 of the License, or
|
1998-05-12 15:21:08 -07:00
|
|
|
; (at your option) any later version.
|
2006-10-15 18:08:54 -07:00
|
|
|
;
|
1998-05-12 15:21:08 -07:00
|
|
|
; This program is distributed in the hope that it will be useful,
|
|
|
|
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
; GNU General Public License for more details.
|
2006-10-15 18:08:54 -07:00
|
|
|
;
|
1998-05-12 15:21:08 -07:00
|
|
|
; You should have received a copy of the GNU General Public License
|
2009-01-17 14:28:01 -08:00
|
|
|
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1998-05-12 15:21:08 -07:00
|
|
|
|
|
|
|
|
|
2003-07-22 07:24:11 -07:00
|
|
|
(define (script-fu-render-map inSize
|
2006-10-15 18:08:54 -07:00
|
|
|
inGrain
|
|
|
|
|
inGrad
|
|
|
|
|
inWiden)
|
|
|
|
|
|
2004-10-03 15:50:50 -07:00
|
|
|
(let* (
|
|
|
|
|
(theWidth inSize)
|
|
|
|
|
(theHeight inSize)
|
2006-10-15 18:08:54 -07:00
|
|
|
(theImage (car(gimp-image-new theWidth theHeight RGB)))
|
2008-01-14 21:15:08 -08:00
|
|
|
(theLayer 0)
|
|
|
|
|
(thinLayer 0)
|
2004-10-03 15:50:50 -07:00
|
|
|
)
|
1998-05-12 15:21:08 -07:00
|
|
|
|
2004-09-22 18:44:56 -07:00
|
|
|
(gimp-context-push)
|
|
|
|
|
|
2003-07-22 07:24:11 -07:00
|
|
|
(gimp-selection-all theImage)
|
1998-05-12 15:21:08 -07:00
|
|
|
|
2003-07-22 07:24:11 -07:00
|
|
|
(set! theLayer (car (gimp-layer-new theImage theWidth theHeight
|
2006-10-15 18:08:54 -07:00
|
|
|
RGBA-IMAGE
|
|
|
|
|
"I've got more rubber ducks than you!"
|
|
|
|
|
100 NORMAL-MODE)))
|
2003-07-22 07:24:11 -07:00
|
|
|
(gimp-image-add-layer theImage theLayer 0)
|
2007-10-01 01:42:48 -07:00
|
|
|
(plug-in-solid-noise RUN-NONINTERACTIVE
|
|
|
|
|
theImage theLayer 1 0 (rand 65536)
|
2006-10-15 18:08:54 -07:00
|
|
|
inGrain inGrain inGrain)
|
1998-05-12 15:21:08 -07:00
|
|
|
|
2003-07-22 07:24:11 -07:00
|
|
|
(if (= inWiden 1)
|
|
|
|
|
(begin
|
2006-10-15 18:08:54 -07:00
|
|
|
(set! thinLayer (car (gimp-layer-new theImage theWidth theHeight
|
|
|
|
|
RGBA-IMAGE "Camo Thin Layer"
|
|
|
|
|
100 NORMAL-MODE)))
|
|
|
|
|
(gimp-image-add-layer theImage thinLayer 0)
|
|
|
|
|
|
|
|
|
|
(let ((theBigGrain (min 15 (* 2 inGrain))))
|
2007-10-01 01:42:48 -07:00
|
|
|
(plug-in-solid-noise RUN-NONINTERACTIVE
|
|
|
|
|
theImage thinLayer 1 0 (rand 65536)
|
2006-10-15 18:08:54 -07:00
|
|
|
theBigGrain theBigGrain theBigGrain))
|
2003-07-22 07:24:11 -07:00
|
|
|
|
2006-10-15 18:08:54 -07:00
|
|
|
(gimp-context-set-background '(255 255 255))
|
|
|
|
|
(gimp-context-set-foreground '(0 0 0))
|
1998-05-12 15:21:08 -07:00
|
|
|
|
2006-10-15 18:08:54 -07:00
|
|
|
(let ((theMask (car (gimp-layer-create-mask thinLayer 0))))
|
|
|
|
|
(gimp-layer-add-mask thinLayer theMask)
|
1998-05-12 15:21:08 -07:00
|
|
|
|
2006-10-15 18:08:54 -07:00
|
|
|
(gimp-edit-blend theMask FG-BG-RGB-MODE NORMAL-MODE
|
|
|
|
|
GRADIENT-LINEAR 100 0 REPEAT-TRIANGULAR FALSE
|
|
|
|
|
FALSE 0 0 TRUE
|
|
|
|
|
0 0 0 (/ theHeight 2)))
|
1998-05-12 15:21:08 -07:00
|
|
|
|
2006-10-15 18:08:54 -07:00
|
|
|
(set! theLayer (car(gimp-image-flatten theImage)))))
|
1998-05-12 15:21:08 -07:00
|
|
|
|
2003-07-22 07:24:11 -07:00
|
|
|
(gimp-selection-none theImage)
|
2004-09-23 04:44:32 -07:00
|
|
|
(gimp-context-set-gradient inGrad)
|
2007-10-01 01:42:48 -07:00
|
|
|
(plug-in-gradmap RUN-NONINTERACTIVE theImage theLayer)
|
2006-10-20 10:55:14 -07:00
|
|
|
|
2004-09-22 18:44:56 -07:00
|
|
|
(gimp-display-new theImage)
|
|
|
|
|
|
2006-10-15 18:08:54 -07:00
|
|
|
(gimp-context-pop)
|
|
|
|
|
)
|
|
|
|
|
)
|
1998-05-12 15:21:08 -07:00
|
|
|
|
2003-07-22 07:24:11 -07:00
|
|
|
(script-fu-register "script-fu-render-map"
|
2006-10-15 18:08:54 -07:00
|
|
|
_"Render _Map..."
|
|
|
|
|
_"Create an image filled with an Earth-like map pattern"
|
|
|
|
|
"Chris Gutteridge: cjg@ecs.soton.ac.uk"
|
|
|
|
|
"28th April 1998"
|
|
|
|
|
"Chris Gutteridge / ECS @ University of Southampton, England"
|
|
|
|
|
""
|
|
|
|
|
SF-ADJUSTMENT _"Image size" '(256 0 2048 1 10 0 0)
|
|
|
|
|
SF-ADJUSTMENT _"Granularity" '(4 0 15 1 1 0 0)
|
|
|
|
|
SF-GRADIENT _"Gradient" "Land and Sea"
|
|
|
|
|
SF-TOGGLE _"Gradient reverse" FALSE
|
|
|
|
|
SF-OPTION _"Behavior" '(_"Tile" _"Detail in Middle")
|
|
|
|
|
)
|
2004-11-18 14:44:28 -08:00
|
|
|
|
|
|
|
|
(script-fu-menu-register "script-fu-render-map"
|
2008-09-19 05:01:12 -07:00
|
|
|
"<Image>/File/Create/Patterns")
|