; Add 3D-extrusion script for GIMP 2 ; Copyright (C) 2006 Eddy Verlinden ; ; -------------------------------------------------------------------- ; version 1.0 by Eddy Verlinden 2006/08/18 ; Initial release ; ; -------------------------------------------------------------------- ; (define (script-fu-3Dextrusion img drawable layercount direction grey greycolor ) (let* ( (target-layer (car (gimp-layer-copy drawable TRUE))) (width (car (gimp-drawable-width drawable))) (height (car (gimp-drawable-height drawable))) (old-selection (car (gimp-selection-save img))) (new-selection (car (gimp-selection-save img))) (selection-flag FALSE) (count 0) (x 0) (y 0) (fcolor (car(gimp-context-get-foreground))) ) ; end variable definition (gimp-undo-push-group-start img) (gimp-selection-none img) (if (or (or (= direction 0) (= direction 1)) (= direction 7)) (set! y -1)) (if (or (or (= direction 3) (= direction 4)) (= direction 5)) (set! y 1)) (if (or (or (= direction 5) (= direction 6)) (= direction 7)) (set! x -1)) (if (or (or (= direction 1) (= direction 2)) (= direction 3)) (set! x 1)) (gimp-image-add-layer img target-layer -1) (gimp-selection-layer-alpha target-layer) (set! new-selection (car (gimp-selection-save img))) (gimp-selection-none img) (if (= grey TRUE) (gimp-drawable-fill target-layer 3)) (gimp-selection-load new-selection) (if (= grey TRUE) (gimp-context-set-foreground greycolor)) (if (= grey TRUE) (gimp-edit-fill target-layer 0)) (if (= grey TRUE) (gimp-context-set-foreground fcolor)) (gimp-selection-none img) (gimp-layer-resize-to-image-size target-layer) (while (> layercount count) (set! target-layer (car (gimp-layer-copy target-layer TRUE))) (gimp-image-add-layer img target-layer -1) (gimp-drawable-offset target-layer 0 1 x y) (set! count (+ count 1)) ) ; end of while (set! count 0) (while (> layercount count) (set! target-layer (car (gimp-image-merge-down img target-layer 2))) (set! count (+ count 1)) ) ; end of while (gimp-drawable-offset target-layer 0 1 (* (- x) layercount) (* (- y) layercount)) (gimp-layer-resize-to-image-size target-layer) (gimp-layer-set-name target-layer "3D-extrusion") (gimp-image-lower-layer img target-layer) (gimp-selection-load old-selection) (gimp-image-remove-channel img old-selection) (gimp-undo-push-group-end img) (gimp-displays-flush) ) ) (script-fu-register "script-fu-3Dextrusion" "/Xtns/Script-Fu/3d-extrusion" "Creates a new layer on top of the current layer wich contains the same drawing but with added depth. This layer is built by making several copies that each are moved 1px. This makes sense when making drawings, icons, ... The subject has to lay on its own transparant layer." "Eddy Verlinden " "Eddy Verlinden" "2006, Aug" "RGB* GRAY* INDEXED*" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-ADJUSTMENT "Depth" '(25 1 255 1 10 0 0) SF-OPTION "Direction" '("down" "left+down" "left" "left+up" "up" "right+up" "right" "right+down") SF-TOGGLE "Change the color" FALSE SF-COLOR "Color" '(127 127 127) )