3
(define (script-fu-guides-from-selection image
5
(let* ((boundries (gimp-selection-bounds image))
6
;; non-empty INT32 TRUE if there is a selection
7
(selection (car boundries))
10
(x2 (cadr (cddr boundries)))
11
(y2 (caddr (cddr boundries))))
13
;; need to check for a selection or we get guides right at edges of the image
14
(if (= selection TRUE)
16
(gimp-image-undo-group-start image)
18
(gimp-image-add-vguide image x1)
19
(gimp-image-add-hguide image y1)
20
(gimp-image-add-vguide image x2)
21
(gimp-image-add-hguide image y2)
23
(gimp-image-undo-group-end image)
24
(gimp-displays-flush)))))
26
(script-fu-register "script-fu-guides-from-selection"
27
_"New Guides from _Selection"
28
_"Creates four Guides around the bounding box of the current selection."
30
"Alan Horkan, 2004. Public Domain."
34
SF-DRAWABLE "Drawable" 0)
36
(script-fu-menu-register "script-fu-guides-from-selection"
37
"<Image>/Image/Guides")
3
(define (script-fu-guides-from-selection image drawable)
5
(boundries (gimp-selection-bounds image))
6
;; non-empty INT32 TRUE if there is a selection
7
(selection (car boundries))
10
(x2 (cadr (cddr boundries)))
11
(y2 (caddr (cddr boundries)))
14
;; need to check for a selection or we get guides right at edges of the image
15
(if (= selection TRUE)
17
(gimp-image-undo-group-start image)
19
(gimp-image-add-vguide image x1)
20
(gimp-image-add-hguide image y1)
21
(gimp-image-add-vguide image x2)
22
(gimp-image-add-hguide image y2)
24
(gimp-image-undo-group-end image)
31
(script-fu-register "script-fu-guides-from-selection"
32
_"New Guides from _Selection"
33
_"Draw a grid as specified by the lists of X and Y locations using the current brush"
35
"Alan Horkan, 2004. Public Domain."
39
SF-DRAWABLE "Drawable" 0
42
(script-fu-menu-register "script-fu-guides-from-selection"
43
"<Image>/Image/Guides")