; 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.
; pre-2.8 COMPATIBILITY
(when (not (defined? 'gimp-image-insert-layer))
(define (gimp-image-insert-layer image layer IGNORED pos)
(gimp-image-add-layer image layer pos)) )
(define (sg-copyright-symbol image)
(let* ((bounds (gimp-selection-bounds image))
(x (cadr bounds))
(y (caddr bounds))
(width (- (car (cdddr bounds)) x))
(height (- (cadr (cdddr bounds)) y))
(thickness (round (/ (min width height) 9)))
(layer 0)
(orig-sel 0)
(type (+ (* (car (gimp-image-base-type image)) 2) 1)) )
(unless (or (= (car bounds) FALSE) (< (min width height) 6))
(gimp-image-undo-group-start image)
(set! orig-sel (car (gimp-selection-save image)))
(set! layer (car (gimp-layer-new image width height type "Copyright" 100 NORMAL-MODE)))
(gimp-image-insert-layer image layer 0 -1)
(gimp-drawable-fill layer TRANSPARENT-FILL)
(gimp-ellipse-select image 0 0 width height CHANNEL-OP-REPLACE TRUE FALSE 0)
(gimp-ellipse-select image thickness thickness (- width (* 2 thickness)) (- height (* 2 thickness)) CHANNEL-OP-SUBTRACT TRUE FALSE 0)
(gimp-edit-fill layer FOREGROUND-FILL)
(gimp-ellipse-select image (* 2 thickness) (* 2 thickness) (- width (* 4 thickness)) (- height (* 4 thickness)) CHANNEL-OP-REPLACE TRUE FALSE 0)
(gimp-ellipse-select image (* 3 thickness) (* 3 thickness) (- width (* 6 thickness)) (- height (* 6 thickness)) CHANNEL-OP-SUBTRACT TRUE FALSE 0)
(gimp-rect-select image (/ width 2) (- (/ height 2) (/ thickness 2)) width thickness CHANNEL-OP-SUBTRACT FALSE 0)
(gimp-edit-fill layer FOREGROUND-FILL)
(gimp-layer-set-offsets layer x y)
(gimp-selection-load orig-sel)
(gimp-image-remove-channel image orig-sel)
(gimp-displays-flush)
(gimp-image-undo-group-end image)
)
)
)
(script-fu-register "sg-copyright-symbol"
"Copyright Symbol"
"Create a copyright symbol on a new layer using selection"
"Saul Goode"
"Saul Goode"
"12/27/2009"
"*"
SF-IMAGE "Image" 0
)
(script-fu-menu-register "sg-copyright-symbol"
"<Image>/Filters/Render"
)