[Gimp-developer] erase-rows.scm patch

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

 



Hi,

(My apologies if this is the wrong forum for this message.)

I've edited the "Erase every other row" script-fu so that the size of the rows can be changed. I can't find a contact address for the original author, so I've attached a patch.

Thanks for your time,

-- Rory Hunter
"Yes, but most people don't attack their boxes with the same
 cavalier abandon you do."
                         -- Said when modding my box [fenriz.org]
--- erase-rows.scm	Mon Apr  8 15:10:31 2002
+++ erase-n-rows.scm	Mon Apr  8 15:09:41 2002
@@ -1,19 +1,33 @@
-(define (script-fu-erase-rows img drawable orientation which type)
+;; roryh@xxxxxxxxxx Mon Apr  8 14:35:49 BST 2002 
+;; Added size parameter to control size of rows / colums
+(define (script-fu-erase-rows img drawable orientation which type size_raw)
   (let* ((width (car (gimp-drawable-width drawable)))
-	 (height (car (gimp-drawable-height drawable))))
+	 (height (car (gimp-drawable-height drawable)))
+	 (size (if (= orientation 0)
+		   (if (> size_raw height) height size_raw)
+		   (if (> size_raw width)  width  size_raw))))
     (gimp-undo-push-group-start img)
     (letrec ((loop (lambda (i max)
 		     (if (< i max)
 			 (begin
 			   (if (= orientation 0)
-			       (gimp-rect-select img 0 i width 1 REPLACE FALSE 0)
-			       (gimp-rect-select img i 0 1 height REPLACE FALSE 0))
+			       ;; roryh@xxxxxxxxxx Mon Apr  8 14:33:47 BST 2002 
+			       ;; Changed the code here to use a variable size
+			       ;; for row / column width / height.
+			       (gimp-rect-select img 0 i width size REPLACE FALSE 0)
+			       (gimp-rect-select img i 0 size height REPLACE FALSE 0))
+			   ;; roryh@xxxxxxxxxx Mon Apr  8 14:55:24 BST 2002 
+			   ;; Handle extra operation
 			   (if (= type 0)
 			       (gimp-edit-clear drawable)
-			       (gimp-edit-fill drawable BG-IMAGE-FILL))
-			   (loop (+ i 2) max))))))
+			       (if (= type 1)
+				   (gimp-edit-fill drawable FG-IMAGE-FILL)
+				   (gimp-edit-fill drawable BG-IMAGE-FILL)))
+			   ;; roryh@xxxxxxxxxx Mon Apr  8 14:35:24 BST 2002 
+			   ;; Changed loop increment to variable
+			   (loop (+ i (* 2 size)) max))))))
       (loop (if (= which 0)
 		0
 		1)
 	    (if (= orientation 0)
 		height
@@ -21,17 +35,21 @@
     (gimp-selection-none img)
     (gimp-undo-push-group-end img)
     (gimp-displays-flush)))
 
 (script-fu-register "script-fu-erase-rows"
-		    _"<Image>/Script-Fu/Alchemy/Erase every other Row..."
-		    "Erase every other row/column with the background color"
-		    "Federico Mena Quintero"
-		    "Federico Mena Quintero"
-		    "June 1997"
+		    _"<Image>/Script-Fu/Alchemy/Erase Rows..."
+		    "Erase every n rows/columns with the background color"
+		    "Federico Mena Quintero / Rory Hunter"
+		    "Federico Mena Quintero / Rory Hunter"
+		    "June 1997 / April 2002"
 		    "RGB* GRAY* INDEXED*"
 		    SF-IMAGE "Image" 0
 		    SF-DRAWABLE "Drawable" 0
 		    SF-OPTION _"Rows/Cols" '(_"Rows" _"Columns")
 		    SF-OPTION _"Even/Odd"  '(_"Even" _"Odd")
-		    SF-OPTION _"Erase/Fill"  '(_"Erase" _"Fill with BG"))
+		    ;; roryh@xxxxxxxxxx Mon Apr  8 14:55:54 BST 2002 
+		    ;; Extra opertion - fill with FG colour.
+		    SF-OPTION _"Erase/Fill"  '(_"Erase" _"Fill with FG" _"Fill with BG")
+		    ;; Added option for size.
+		    SF-ADJUSTMENT _"Row Size" '(1 1 100 1 1 0 1))
 

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux