User Tools

Site Tools


scode:gimp:guides

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
scode:gimp:guides [2019/04/13 06:22]
terrill [Guides]
scode:gimp:guides [2019/07/07 06:20] (current)
terrill [Quarter Guides]
Line 128: Line 128:
                          "<​Image>/​Image"​)                          "<​Image>/​Image"​)
  
 +</​code>​
 +
 +===== Two-Thirds Guide =====
 +<code lisp>
 +;; -*-scheme-*-
 +
 +;; Terrill Bennett 2019.  No copyright. ​ Public Domain.
 +
 +(define (script-fu-guide-thirds-guide image drawable)
 +  (let* ((guide-id 0))
 +    (gimp-image-undo-group-start image)
 +
 +    (set! guide-id (car (gimp-image-find-next-guide image 0)))
 +    (while (> guide-id 0)
 +      (gimp-image-delete-guide image guide-id)
 +      (set! guide-id (car (gimp-image-find-next-guide image 0)))
 +    )
 +
 +    (gimp-image-undo-group-end image)
 +  )
 +
 +  (let* (
 +        (hposition 0)
 +        (vposition 0)
 +        (width (car (gimp-image-width image)))
 +      (height (car (gimp-image-height image)))
 +        )
 +
 + ;; 66%
 + (set! hposition (/ (* height 66) 100))
 + (set! vposition (/ (* width 66) 100))
 +
 + ;; convert positions to pixelis
 + (if (<= hposition height) (gimp-image-add-hguide image hposition))
 + (if (<= vposition width) (gimp-image-add-vguide image vposition))
 +
 + ;; 33%
 + (set! hposition (/ (* height 33) 100))
 + (set! vposition (/ (* width 33) 100))
 +
 + ;; convert positions to pixelis
 + (if (<= hposition height) (gimp-image-add-hguide image hposition))
 + (if (<= vposition width) (gimp-image-add-vguide image vposition))
 +
 + (gimp-displays-flush)
 +  )
 +)
 +
 +(script-fu-register "​script-fu-guide-thirds-guide"​
 +  "​TwoThirds Guide..."​
 +  _"Add a guide at the position specified as a percentage of the image size"
 +  "​Terrill Bennett"​
 +  "​Terrill Bennett, 2019"
 +  "July 2019"
 +  "​*"​
 +  SF-IMAGE ​     "Input Image" ​     0
 +  SF-DRAWABLE ​  "​Input Drawable" ​  0
 +)
 +
 +(script-fu-menu-register "​script-fu-guide-thirds-guide"​
 +                         "<​Image>/​Image"​)
 </​code>​ </​code>​
scode/gimp/guides.txt ยท Last modified: 2019/07/07 06:20 by terrill