2000-12-16 00:55:34 +08:00
|
|
|
(define (script-fu-erase-rows img drawable orientation which type)
|
2006-10-16 09:08:54 +08:00
|
|
|
(let* (
|
|
|
|
(width (car (gimp-drawable-width drawable)))
|
|
|
|
(height (car (gimp-drawable-height drawable)))
|
2006-10-21 01:55:14 +08:00
|
|
|
(position-x (car (gimp-drawable-offsets drawable)))
|
|
|
|
(position-y (cadr (gimp-drawable-offsets drawable)))
|
2006-10-16 09:08:54 +08:00
|
|
|
)
|
|
|
|
|
2003-12-05 22:18:47 +08:00
|
|
|
(gimp-image-undo-group-start img)
|
1997-11-25 06:05:25 +08:00
|
|
|
(letrec ((loop (lambda (i max)
|
2006-10-16 09:08:54 +08:00
|
|
|
(if (< i max)
|
|
|
|
(begin
|
|
|
|
(if (= orientation 0)
|
2006-10-21 01:55:14 +08:00
|
|
|
(gimp-rect-select img position-x (+ i position-y) width 1 CHANNEL-OP-REPLACE FALSE 0)
|
|
|
|
(gimp-rect-select img (+ i position-x) position-y 1 height CHANNEL-OP-REPLACE FALSE 0))
|
2006-10-16 09:08:54 +08:00
|
|
|
(if (= type 0)
|
|
|
|
(gimp-edit-clear drawable)
|
|
|
|
(gimp-edit-fill drawable BACKGROUND-FILL))
|
|
|
|
(loop (+ i 2) max))))))
|
2000-04-28 08:02:11 +08:00
|
|
|
(loop (if (= which 0)
|
2006-10-16 09:08:54 +08:00
|
|
|
0
|
|
|
|
1)
|
|
|
|
(if (= orientation 0)
|
|
|
|
height
|
|
|
|
width)
|
|
|
|
)
|
|
|
|
)
|
1997-11-25 06:05:25 +08:00
|
|
|
(gimp-selection-none img)
|
2003-12-05 22:18:47 +08:00
|
|
|
(gimp-image-undo-group-end img)
|
2006-10-16 09:08:54 +08:00
|
|
|
(gimp-displays-flush)
|
|
|
|
)
|
|
|
|
)
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
(script-fu-register "script-fu-erase-rows"
|
2006-10-21 01:55:14 +08:00
|
|
|
_"_Erase Every Other Row..."
|
2006-10-25 20:27:26 +08:00
|
|
|
_"Erase every other row or column"
|
2006-10-16 09:08:54 +08:00
|
|
|
"Federico Mena Quintero"
|
|
|
|
"Federico Mena Quintero"
|
|
|
|
"June 1997"
|
|
|
|
"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")
|
|
|
|
)
|
2000-04-28 08:02:11 +08:00
|
|
|
|
2004-11-19 06:44:28 +08:00
|
|
|
(script-fu-menu-register "script-fu-erase-rows"
|
2006-10-16 09:08:54 +08:00
|
|
|
"<Image>/Filters/Distorts")
|