[gimp] Issue #175 - Allow the erase every other row plugin to skip a different number of rows



commit 0a5af889f9e0e0ce5c7733130d5a7b3af0eb5e5d
Author: Nikc M <nikcdc gmail com>
Date:   Thu Feb 13 01:08:08 2020 +0200

    Issue #175 - Allow the erase every other row plugin to skip a different number of rows
    
    Adds generalized erase Nth row function,
    and sets original erase row function to
    call generalized one with n = 2
    to reduce code duplication

 plug-ins/script-fu/scripts/erase-rows.scm | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/plug-ins/script-fu/scripts/erase-rows.scm b/plug-ins/script-fu/scripts/erase-rows.scm
index 32ae591d78..4ae4c770ab 100644
--- a/plug-ins/script-fu/scripts/erase-rows.scm
+++ b/plug-ins/script-fu/scripts/erase-rows.scm
@@ -1,4 +1,8 @@
 (define (script-fu-erase-rows img drawable orientation which type)
+  (script-fu-erase-nth-rows img drawable orientation which type 2)
+)
+
+(define (script-fu-erase-nth-rows img drawable orientation offset type nth)
   (let* (
         (width (car (gimp-drawable-width drawable)))
         (height (car (gimp-drawable-height drawable)))
@@ -10,7 +14,6 @@
     (gimp-context-set-paint-mode LAYER-MODE-NORMAL)
     (gimp-context-set-opacity 100.0)
     (gimp-context-set-feather FALSE)
-
     (gimp-image-undo-group-start img)
     (letrec ((loop (lambda (i max)
                      (if (< i max)
@@ -21,10 +24,8 @@
                            (if (= type 0)
                                (gimp-drawable-edit-clear drawable)
                                (gimp-drawable-edit-fill drawable FILL-BACKGROUND))
-                           (loop (+ i 2) max))))))
-      (loop (if (= which 0)
-                0
-                1)
+                           (loop (+ i nth) max))))))
+      (loop offset
             (if (= orientation 0)
                 height
                 width)
@@ -37,6 +38,21 @@
   )
 )
 
+(script-fu-register "script-fu-erase-nth-rows"
+  _"_Erase Every Nth Row..."
+  _"Erase every nth row or column"
+  "Federico Mena Quintero, Nikc M. (Altered)"
+  "Federico Mena Quintero"
+  "June 1997, February 2020"
+  "RGB* GRAY* INDEXED*"
+  SF-IMAGE       "Image"      0
+  SF-DRAWABLE    "Drawable"   0
+  SF-OPTION     _"Rows/cols"  '(_"Rows" _"Columns")
+  SF-ADJUSTMENT  "Offset"     '(0 0 1024 1 10 0 SF-SPINNER)
+  SF-OPTION     _"Erase/fill" '(_"Erase" _"Fill with BG")
+  SF-ADJUSTMENT  "Skip by"    '(1 1 1024 1 10 0 SF-SPINNER)
+)
+
 (script-fu-register "script-fu-erase-rows"
   _"_Erase Every Other Row..."
   _"Erase every other row or column"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]