always return channel->x1,y1,x2,y2, *not* tx1,ty1,tx2,ty2 since the latter

2003-06-05  Michael Natterer  <mitch@gimp.org>

	* 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.
This commit is contained in:
Michael Natterer 2003-06-05 13:27:27 +00:00 committed by Michael Natterer
parent 378a6d3d6a
commit f8081a8629
4 changed files with 35 additions and 28 deletions

View File

@ -1,3 +1,12 @@
2003-06-05 Michael Natterer <mitch@gimp.org>
* 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 <mitch@gimp.org>
* plug-ins/script-fu/scripts/predator.scm (script-fu-predator):

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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"
_"<Image>/Script-Fu/Alchemy/Unsharp Mask..."
"Make a sharp image of IMAGE's DRAWABLE by applying unsharp mask method"
"Shuji Narazaki <narazaki@gimp.org>"
"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"
_"<Image>/Script-Fu/Alchemy/Unsharp Mask..."
"Make a sharp image of IMAGE's DRAWABLE by applying unsharp mask method"
"Shuji Narazaki <narazaki@gimp.org>"
"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))