; The GIMP -- an image manipulation program ; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; ; 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. ; ; Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk ; ; Version 0.2 10.6.97 Changed to new script-fu interface in 0.99.10 ; ; March 20, 2002. ; Original add-border script modified to create a nice straight-edged ; beveled border. M. Scott Reynolds msr at MScottReynolds.com (define (gen_top_array xsize ysize iwidth iheight owidth oheight) (let* ((n_array (cons-array 10 'double))) (aset n_array 0 0 ) (aset n_array 1 0 ) (aset n_array 2 xsize) (aset n_array 3 ysize) (aset n_array 4 (+ xsize iwidth)) (aset n_array 5 ysize) (aset n_array 6 owidth) (aset n_array 7 0 ) (aset n_array 8 0 ) (aset n_array 9 0 ) n_array) ) (define (gen_left_array xsize ysize iwidth iheight owidth oheight) (let* ((n_array (cons-array 10 'double))) (aset n_array 0 0 ) (aset n_array 1 0 ) (aset n_array 2 xsize) (aset n_array 3 ysize) (aset n_array 4 xsize) (aset n_array 5 (+ ysize iheight)) (aset n_array 6 0 ) (aset n_array 7 oheight ) (aset n_array 8 0 ) (aset n_array 9 0 ) n_array) ) (define (gen_right_array xsize ysize iwidth iheight owidth oheight) (let* ((n_array (cons-array 10 'double))) (aset n_array 0 owidth ) (aset n_array 1 0 ) (aset n_array 2 (+ xsize iwidth)) (aset n_array 3 ysize) (aset n_array 4 (+ xsize iwidth)) (aset n_array 5 (+ ysize iheight)) (aset n_array 6 owidth) (aset n_array 7 oheight) (aset n_array 8 owidth ) (aset n_array 9 0 ) n_array) ) (define (gen_bottom_array xsize ysize iwidth iheight owidth oheight) (let* ((n_array (cons-array 10 'double))) (aset n_array 0 0 ) (aset n_array 1 oheight) (aset n_array 2 xsize) (aset n_array 3 (+ ysize iheight)) (aset n_array 4 (+ xsize iwidth)) (aset n_array 5 (+ ysize iheight)) (aset n_array 6 owidth) (aset n_array 7 oheight) (aset n_array 8 0 ) (aset n_array 9 oheight) n_array) ) (define (script-fu-add-beveled-border aimg adraw xsize ysize) (let* ((img (car (gimp-drawable-image adraw))) (owidth (car (gimp-image-width img))) ; outside width (oheight (car (gimp-image-height img))) ; outside height (old-fg (car (gimp-palette-get-foreground))) (old-bg (car (gimp-palette-get-background))) (iwidth (- owidth (* 2 xsize))) ; inside width (iheight (- oheight (* 2 ysize))) ; inside height ) (gimp-free-select img 10 (gen_top_array xsize ysize iwidth iheight owidth oheight) REPLACE 0 0 0.0) (gimp-brightness-contrast adraw 127 0) (gimp-free-select img 10 (gen_left_array xsize ysize iwidth iheight owidth oheight) REPLACE 0 0 0.0) (gimp-brightness-contrast adraw 63 0) (gimp-free-select img 10 (gen_right_array xsize ysize iwidth iheight owidth oheight) REPLACE 0 0 0.0) (gimp-brightness-contrast adraw -63 0) (gimp-free-select img 10 (gen_bottom_array xsize ysize iwidth iheight owidth oheight) REPLACE 0 0 0.0) (gimp-brightness-contrast adraw -127 0) (gimp-selection-none img) (gimp-displays-flush) ) ) (script-fu-register "script-fu-add-beveled-border" _"/Script-Fu/Decor/Add Beveled Border..." "Add a beveled border around an image. (Copied from the add-border script-fu)" "M. Scott Reynolds" "3/20/2002" "RGB*" SF-IMAGE "Input Image" 0 SF-DRAWABLE "Input Drawable" 0 SF-ADJUSTMENT _"Border X Size" '(12 1 250 1 10 0 1) SF-ADJUSTMENT _"Border Y Size" '(12 1 250 1 10 0 1) )