From f8081a8629ff9ef7171e6ebbc656ec4b10bddeaa Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Thu, 5 Jun 2003 13:27:27 +0000 Subject: [PATCH] always return channel->x1,y1,x2,y2, *not* tx1,ty1,tx2,ty2 since the latter 2003-06-05 Michael Natterer * app/core/gimpchannel.c (gimp_channel_bounds): always return channel->x1,y1,x2,y2, *not* tx1,ty1,tx2,ty2 since the latter contain bogus values if the mask is empty. Fixes bug #114419. * plug-ins/script-fu/scripts/unsharp-mask.scm: cleaned up while searching the bug. --- ChangeLog | 9 +++++ app/core/gimpchannel-combine.c | 8 ++--- app/core/gimpchannel.c | 8 ++--- plug-ins/script-fu/scripts/unsharp-mask.scm | 38 ++++++++++----------- 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index b91587c7d3..8843055b5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-06-05 Michael Natterer + + * app/core/gimpchannel.c (gimp_channel_bounds): always return + channel->x1,y1,x2,y2, *not* tx1,ty1,tx2,ty2 since the latter + contain bogus values if the mask is empty. Fixes bug #114419. + + * plug-ins/script-fu/scripts/unsharp-mask.scm: cleaned up + while searching the bug. + 2003-06-05 Michael Natterer * plug-ins/script-fu/scripts/predator.scm (script-fu-predator): diff --git a/app/core/gimpchannel-combine.c b/app/core/gimpchannel-combine.c index f9ba88a2e2..776035277d 100644 --- a/app/core/gimpchannel-combine.c +++ b/app/core/gimpchannel-combine.c @@ -954,10 +954,10 @@ gimp_channel_bounds (GimpChannel *mask, mask->bounds_known = TRUE; - *x1 = tx1; - *x2 = tx2; - *y1 = ty1; - *y2 = ty2; + *x1 = mask->x1; + *x2 = mask->x2; + *y1 = mask->y1; + *y2 = mask->y2; return !mask->empty; } diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c index f9ba88a2e2..776035277d 100644 --- a/app/core/gimpchannel.c +++ b/app/core/gimpchannel.c @@ -954,10 +954,10 @@ gimp_channel_bounds (GimpChannel *mask, mask->bounds_known = TRUE; - *x1 = tx1; - *x2 = tx2; - *y1 = ty1; - *y2 = ty2; + *x1 = mask->x1; + *x2 = mask->x2; + *y1 = mask->y1; + *y2 = mask->y2; return !mask->empty; } diff --git a/plug-ins/script-fu/scripts/unsharp-mask.scm b/plug-ins/script-fu/scripts/unsharp-mask.scm index b929c0ee82..50b0f99d9c 100644 --- a/plug-ins/script-fu/scripts/unsharp-mask.scm +++ b/plug-ins/script-fu/scripts/unsharp-mask.scm @@ -16,9 +16,12 @@ (blured-layer-for-lighter #f) (darker-layer #f) (lighter-layer #f)) + (gimp-selection-all img) (gimp-edit-copy drw) + (gimp-image-undo-disable new-image) + (gimp-floating-sel-anchor (car (gimp-edit-paste original-layer FALSE))) (gimp-image-add-layer new-image original-layer 0) @@ -27,6 +30,7 @@ (set! blured-layer-for-darker (car (gimp-layer-copy original-layer TRUE))) (gimp-layer-set-visible original-layer FALSE) (gimp-display-new new-image) + ;; make darker mask (gimp-image-add-layer new-image blured-layer-for-darker -1) (plug-in-gauss-iir TRUE new-image blured-layer-for-darker mask-size @@ -39,6 +43,7 @@ (car (gimp-image-merge-visible-layers new-image CLIP-TO-IMAGE))) (gimp-layer-set-name darker-layer "darker mask") (gimp-layer-set-visible darker-layer FALSE) + ;; make lighter mask (gimp-image-add-layer new-image original-layer-for-lighter -1) (gimp-image-add-layer new-image blured-layer-for-lighter -1) @@ -46,6 +51,7 @@ (set! lighter-layer (car (gimp-image-merge-visible-layers new-image CLIP-TO-IMAGE))) (gimp-layer-set-name lighter-layer "lighter mask") + ;; combine them (gimp-layer-set-visible original-layer TRUE) (gimp-layer-set-mode darker-layer SUBTRACT) @@ -54,26 +60,18 @@ (gimp-layer-set-mode lighter-layer ADDITION) (gimp-layer-set-opacity lighter-layer mask-opacity) (gimp-layer-set-visible lighter-layer TRUE) + (gimp-image-undo-enable new-image) (gimp-displays-flush))) -(script-fu-register - "script-fu-unsharp-mask" - _"/Script-Fu/Alchemy/Unsharp Mask..." - "Make a sharp image of IMAGE's DRAWABLE by applying unsharp mask method" - "Shuji Narazaki " - "Shuji Narazaki" - "1997,1998" - "" - SF-IMAGE "Image" 0 - SF-DRAWABLE "Drawable to apply" 0 - SF-ADJUSTMENT _"Mask Size" '(5 1 100 1 1 0 1) - SF-ADJUSTMENT _"Mask Opacity" '(50 0 100 1 1 0 1) -) - -;;; unsharp-mask.scm ends here - - - - - +(script-fu-register "script-fu-unsharp-mask" + _"/Script-Fu/Alchemy/Unsharp Mask..." + "Make a sharp image of IMAGE's DRAWABLE by applying unsharp mask method" + "Shuji Narazaki " + "Shuji Narazaki" + "1997,1998" + "" + SF-IMAGE "Image" 0 + SF-DRAWABLE "Drawable to apply" 0 + SF-ADJUSTMENT _"Mask Size" '(5 1 100 1 1 0 1) + SF-ADJUSTMENT _"Mask Opacity" '(50 0 100 1 1 0 1))