René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Script-fu example 12: Drawing a filled rectangle

This example is similar to example 08, but it uses gimp-edit-bucket-fill to fill the selected rectangle instead of gimp-edit-fill.html.
ex_12.scm
(define (ex_12)

  (let* (
          (my-image (car (gimp-image-new 250 250 RGB      )))
          (my-layer (car (gimp-layer-new my-image 250 250 RGB-IMAGE "my layer" 0 NORMAL)))
        )

        (gimp-image-add-layer my-image my-layer 0)

        (gimp-context-set-background '(255 255 000))
;       (gimp-context-set-foreground '(255 245 235))
        (gimp-drawable-fill my-layer BACKGROUND-FILL)


        (gimp-rect-select my-image 25 25 200 200 REPLACE 1 0 0)
        (gimp-context-set-background '(000 255 255))
        (gimp-edit-bucket-fill my-layer BG-BUCKET-FILL NORMAL-MODE 100 0 0 0 0)


        (gimp-file-save RUN-NONINTERACTIVE my-image my-layer "c:\\temp\\ex_12.jpg" "")
  )
)

c:\> start gimp-2.2.exe -d -i -b  "(ex_12)" "(gimp-quit 0)"
See also other examples