I'm writing my first script-fu.  It creates a bunch of layers, and
draws a gradient into each.  I have checked that my calls to
gimp-blend are correct by repeating them manually in the console,
and when I do that, they look fine.  But the result of running my
script is mixed: on some layers, the gradient looks as expected, on
some it looks slightly off, and on some, it looks very corrupted.

Am I missing something important, or falling afoul of a gimp bug?
My script is below.  I started the gimp, created a new image, and
ran my script-fu via the menus.  The resultant image is at
http://web.pimlott.net/~andrew/tmp/gradient_bug.xcf .

My gimp is 1.2.3, from the Debian gimp1.2 1.2.3-2 package, running
on the Debian "testing" distribution.

One other question: after my script-fu runs, the layers dialog box
is not updated, until I go and reselect the image from the
drop-down.  Is there a way to fix that?

Thanks for any help,
Andrew
(Email Cc: appreciated)

(define (script-fu-encroaching-shadow image shadow-width shadow-step)

  (define (make-layers shadow-left)
    (if (> (+ shadow-left shadow-width) 0)
      (let ((layer (car (gimp-layer-new
                          image
                          (car (gimp-image-width image))
                          (car (gimp-image-height image))
                          RGBA_IMAGE "new layer" 100 NORMAL))))
        (gimp-image-add-layer image layer -1)
        (gimp-blend
          layer
          FG-TRANS NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0
          (+ shadow-left shadow-width) 0
          shadow-left 0)
        (cons layer (make-layers (- shadow-left shadow-step))))))

  (make-layers (car (gimp-image-width image)))
)


(script-fu-register "script-fu-encroaching-shadow"
  "<Toolbox>/Xtns/Script-Fu/Pim/Encroaching Shadow"
  "Make a shadow cross the image"
  "Andrew Pimlott"
  "Andrew Pimlott"
  "May 5, 2002"
  ""
  SF-IMAGE "Image" 0
  SF-VALUE "Shadow width" "1000"
  SF-VALUE "Shadow step" "100")

_______________________________________________
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer

Reply via email to