RSS/Atom feed Twitter
Site is read-only, email is disabled

script-fu beginner question

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

script-fu beginner question Andrew Pimlott 06 May 01:03
  script-fu beginner question Simon Budig 06 May 01:35
   script-fu beginner question Andrew Pimlott 06 May 03:00
Andrew Pimlott
2002-05-06 01:03:25 UTC (almost 22 years ago)

script-fu beginner question

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" "/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")

Simon Budig
2002-05-06 01:35:04 UTC (almost 22 years ago)

script-fu beginner question

Andrew Pimlott (ota-26@andrew.pimlott.net) wrote:

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 .

[...]

(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))))))

If you create layers from a script they are usually not really initialized. You have to clear them yourself. If you create the layers via the UI they get cleared.

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?

Try calling (gimp-displays-flush) at the end of the script.

Bye, Simon

Andrew Pimlott
2002-05-06 03:00:58 UTC (almost 22 years ago)

script-fu beginner question

On Mon, May 06, 2002 at 01:35:04AM +0200, Simon Budig wrote:

If you create layers from a script they are usually not really initialized. You have to clear them yourself. If you create the layers via the UI they get cleared.

Yes, I guess that should have been obvious from the new layer dialog. Calling gimp-drawable-fill did it.

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?

Try calling (gimp-displays-flush) at the end of the script.

Great, thanks!

Andrew