File gimp-descreen-1.0-despeckle+foreground.patch of Package gimp-descreen

Index: descreen.scm
===================================================================
--- descreen.scm.orig
+++ descreen.scm
@@ -1,7 +1,7 @@
 ; Descreen v1.0
 ; Tested on Gimp v2.6.8
 (define (script-fu-descreen image drawable sensitivity selectiongrowth despeckle middle-ratio)
-  ; This script requires the FFT plug-in which provides FFT forward and FFT inverse filter
+  ; This script requires the FFT plug-in which provides FFT forward and FFT inverse filter
   (if (not (defined? 'plug-in-fft-dir))
     (begin
       ; Display an error message
@@ -23,7 +23,7 @@
 
   ; Apply the FFT forward filter
   (plug-in-fft-dir RUN-NONINTERACTIVE image drawable)
-
+
   (let* (
           ; Duplicate the layer containing the image FFTed
           (detection (car (gimp-layer-copy drawable FALSE)))
@@ -44,7 +44,7 @@
 
           ; gimp-ellipse-select needs the upper left coordinates of the ellipse
           (middle-x (- middle-x (/ middle-width  2)))
-          (middle-y (- middle-y (/ middle-height 2))))
+          (middle-y (- middle-y (/ middle-height 2))))
 
     ; Keep only strong frequencies
     (gimp-threshold detection low-threshold 255)
@@ -60,6 +60,7 @@
 
     ; Fill the picture according to the selection.
     ; Foreground color has been set by the FFT plugin to #808080
+    (gimp-context-set-foreground '(128 128 128)) ; midgray 0x0808080
     (gimp-edit-fill drawable 0)
 
     ; Delete the detection layer
@@ -67,13 +68,13 @@
 
     ; Unselect
     (gimp-selection-none image)
-  )
+  )
 
   ; Do an FFT inverse on the picture
   (plug-in-fft-inv RUN-NONINTERACTIVE image drawable)
 
   ; Check if despeckle has been selected
-  (if despeckle
+  (if (= despeckle TRUE)
     ; Do a last despeckle to remove small points
     (plug-in-despeckle RUN-NONINTERACTIVE image drawable 1 0 -1 256)
   )
@@ -82,22 +83,22 @@
   (gimp-context-pop)
 
   ; End the undo group
-  (gimp-image-undo-group-end image)
-)
-
-(script-fu-register "script-fu-descreen"
-  "<Image>/Filters/Enhance/Descreen"
-  "Descreen filter"
-  "Frédéric BISSON"
-  "Frédéric BISSON"
-  "01/05/2010"
-  "RGB*"
-  SF-IMAGE "Image"  0
-  SF-DRAWABLE "Drawable" 0
+  (gimp-image-undo-group-end image)
+)
+
+(script-fu-register "script-fu-descreen"
+  "<Image>/Filters/Enhance/Descreen"
+  "Descreen filter"
+  "Frédéric BISSON"
+  "Frédéric BISSON"
+  "01/05/2010"
+  "RGB*"
+  SF-IMAGE "Image"  0
+  SF-DRAWABLE "Drawable" 0
 
   ; Sensitivity to frequency level :
   ; 1=nearly insensitive, 128=sensitive to any frequency level
-  SF-ADJUSTMENT "Sensitivity" '(72 1 128 1 16 0 SF-ROLLBOX)
+  SF-ADJUSTMENT "Sensitivity" '(72 1 128 1 16 0 SF-ROLLBOX)
 
   ; After the frequency level detection, the filter will affect
   ; everything within the range of the growth
@@ -107,6 +108,6 @@
   SF-TOGGLE "Despeckle" TRUE
 
   ; Consider the middle of the picture to be a ratio of the
-  ; image dimensions.
+  ; image dimensions.
   SF-VALUE  "Ratio for middle preservation" "5"
 )
openSUSE Build Service is sponsored by