; Début du script ; ; Accès par Filtres > Rendu > Corrosion ; image de test : http://gug.criticalhit.dk/tutorials/ronq1/ ; utilisation : http://www.gimpfr.org/document/document_7/corrosion-fr.html ; ; ; The GIMP -- an image manipulation program ; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; A set of layer effects script for GIMP 1.2 ; Copyright (C) 2001 Laetitia Marin titix@gimpforce.org ; Copyright (C) 2001 Ostertag Raymond coordinateur@gimp-fr.org ; -------------------------------------------------------------------- ; version 0.1 2001-september-01 ; - Initial relase ; version novembre 2004 -aljacom- adaptation ou remplacement pour Gimp version 2 sur les fonctions ; gimp-layer-new gimp-bucket-fill gimp-fuzzy-select gimp-by-color-select gimp-color-picker ; version novembre 2010 -aljacom- pour Gimp 2.6 (script adapté d'une ancienne documentation) ; fonctions gimp-context-get-foreground gimp-image-undo-group-start gimp-layer-get-mask ; gimp-image-pick-color gimp-selection-none gimp-image-undo-group-end ; ajout (visible (car (gimp-layer-new-from-visible img img "Visible"))) pour pouvoir répéter Corrosion ; -------------------------------------------------------------------- ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; 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. ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; -------------------------------------------------------------------- ; This is the official English version you'll find a french version at http://www.gimp-fr.org/ ; Script-fu corrosion an attempt to realise the Scott-Effect ; Start : a selection in an image or a layer with a transparency area who will be transformed ; in selection ; See the manual at the tutorial section of the gug http://gug.sunsite.dk/ ; (define (script-fu-corrosion img calque0 picker_spacing picker_treshold picker_turbulence bumpmap_depth) (let* ( (sizeX (car (gimp-image-width img))) (sizeY (car (gimp-image-height img))) (calque1 (car (gimp-layer-new img sizeX sizeY 1 "plasma" 100 5))) (masque1 (car (gimp-layer-create-mask calque1 1))) (old-fg (car (gimp-context-get-foreground))) (old-bg (car (gimp-context-get-background))) (blanc '(255 255 255)) (seed 1) (activ_selection (car (gimp-selection-is-empty img))) (pick_color '(255 255 255)) (x 1) (y 1) ) ; undo initialisation (gimp-image-undo-group-start img) ; picker_spacing must be between 2 and 20 ( change that if you need more ) (while (< picker_spacing 2) (begin (set! picker_spacing (+ picker_spacing 1)) ) ) (while (> picker_spacing 20) (begin (set! picker_spacing (- picker_spacing 1)) ) ) ; layer 1 (gimp-image-add-layer img calque1 0) (gimp-image-add-layer-mask img calque1 masque1) ; plasma (set! seed (* picker_treshold picker_turbulence)) (plug-in-plasma TRUE img calque1 seed 2.5) (let* ( (calque2 (car (gimp-layer-copy calque1 TRUE))) (masque2 (car (gimp-layer-get-mask calque2))) ) ; layer 2 (gimp-image-add-layer img calque2 0) ; fill the layer-mask (gimp-context-set-foreground blanc) (set! activ_selection (car (gimp-selection-is-empty img))) (cond ( (= activ_selection 0) ; selection activ (gimp-edit-bucket-fill masque1 0 0 100 0 FALSE 0 0) (gimp-edit-bucket-fill masque2 0 0 100 0 FALSE 0 0) (gimp-selection-none img) ) ( (= activ_selection 1) ; no selection activ (gimp-selection-layer-alpha calque0) (gimp-edit-bucket-fill masque1 0 0 100 0 FALSE 0 0) (gimp-edit-bucket-fill masque2 0 0 100 0 FALSE 0 0) ) ) ; end of cond ; picking in the plasma (gimp-selection-none img) (let ( (y (/ sizeY picker_spacing)) ) (while (< y sizeY) (begin (let ( (x (/ sizeX picker_spacing)) ) (while (< x sizeX) (begin ; back to the initials colours and display the result (gimp-fuzzy-select calque1 x y picker_treshold 0 TRUE FALSE 0 FALSE) ; back to the initials colours and display the result (set! pick_color (car (gimp-image-pick-color img calque1 x y FALSE FALSE 10))) (gimp-by-color-select calque1 pick_color picker_turbulence 0 FALSE FALSE 15 FALSE) (set! x (+ x (/ sizeX picker_spacing))) ) ) ) (set! y (+ y (/ sizeY picker_spacing))) ) ) ) ; clean and fill the layers 1 and 2 (gimp-selection-invert img) (gimp-edit-clear calque1) (gimp-edit-clear calque2) (gimp-selection-none img) (gimp-desaturate calque1) (gimp-desaturate calque2) ; bumpmap on layer 2 (plug-in-bump-map TRUE img calque2 calque2 135 45 bumpmap_depth 0 0 0 0 TRUE FALSE LINEAR) (let ( (visible (car (gimp-layer-new-from-visible img img "Visible"))) ) ; ajout novembre 2009 pour pouvoir répéter Corrosion (gimp-image-add-layer img visible -1) ) ; back to the initials colours and display the result (gimp-context-set-foreground old-fg) (gimp-context-set-background old-bg) (gimp-image-undo-group-end img) (gimp-displays-flush) ) ) ) (script-fu-register "script-fu-corrosion" _"/Filters/Render/Corrosion" "Scott-effect : corrosion" "titix and raymond" "2001, titix and raymond" "NOVEMBRE 2004 & 2010" "" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-VALUE "Picker grid spacing [2-20]" "5" SF-VALUE "Picker Treshold" "30" SF-VALUE "Picker turbulence" "30" SF-VALUE "Bumpmap depth" "10") ; Fin du script