Last active
August 29, 2015 14:08
-
-
Save Intey/690ef5148932b4029927 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (guide-middle-box image drawable bwidth bheight) | |
(let* ( | |
(width (car (gimp-image-width image))) | |
(height (car (gimp-image-height image))) | |
(vmargin (/ (- width bwidth) 2)) | |
(hmargin (/ (- height bheight) 2))) | |
(if (and | |
(<= bwidth width) | |
(<= bheight height)) | |
(begin | |
(gimp-image-add-vguide image vmargin) | |
(gimp-image-add-vguide image (+ vmargin bwidth)) | |
(gimp-image-add-hguide image hmargin) | |
(gimp-image-add-hguide image (+ hmargin bheight)) | |
(gimp-displays-flush)))) | |
) | |
(script-fu-register | |
"guide-middle-box" | |
"Guide Box" | |
"Create guides on box edges, that positioned in middle of image.\ | |
User input width, and height(optional; else - height of image), then\ | |
the box fit in middle, and guides creates on it's edges." | |
"Churin Dmitry" | |
"As is" | |
"October 26 2014" | |
"*" | |
SF-IMAGE "Image" 0 | |
SF-DRAWABLE "Drawable" 0 | |
SF-ADJUSTMENT _"Bwidth" (list 0 0 MAX-IMAGE-SIZE 1 10 0 1) | |
SF-ADJUSTMENT _"Bheight" (list 0 0 MAX-IMAGE-SIZE 1 10 0 1) | |
) | |
(script-fu-menu-register "guide-middle-box" "<Image>/Image/Guides") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment