Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Crosshair guides for the v3 dialect of ScriptFu.
#1
Further to Rich's post here:
https://www.gimp-forum.net/Thread-How-to...3#pid43283

I was finding the Filters -> Repeat and Filters -> Recently Used sometimes greyed out for the old script. So here's crosshair guides written for the v3 dialect of ScriptFu. It puts crosshair guides on the selected drawables.

Code:
#!/usr/bin/env gimp-script-fu-interpreter-3.0

(define (add-guides image drawable)

  (let* ((drawable-width (gimp-drawable-get-width drawable))
         (drawable-height (gimp-drawable-get-height drawable))
         (offsets (gimp-drawable-get-offsets drawable))
         (offset-x (car offsets))
         (offset-y (cadr offsets))
         (position-x (+ (/ drawable-width 2) offset-x))
         (position-y (+ (/ drawable-height 2) offset-y)))

        (gimp-image-add-vguide image position-x)
        (gimp-image-add-hguide image position-y)))

(define (script-fu-crosshair-guides-v3 image drawables)
    (script-fu-use-v3)

    (gimp-image-undo-group-start image)

    (do ((len (vector-length drawables))
         (i 0 (+ i 1)))
        ((= i len))
      ; (gimp-message (string-append "i: " (number->string i)))
        (add-guides image (vector-ref drawables i))
    )

    (gimp-image-undo-group-end image))

(script-fu-register-filter "script-fu-crosshair-guides-v3"
    "Crosshair Guides v3"
    "Place crosshair guides on all selected drawables."
    "teapot"
    "teapot"
    "2025"
    "*"
    SF-ONE-OR-MORE-DRAWABLE
)

(script-fu-menu-register "script-fu-crosshair-guides-v3" "<Image>/Image/Guides")
Reply


Forum Jump: