hi folks,
these fu-script works fine with the ui but not in batch-mode. why?
<code>
(define (text-width extents)
(car extents))
(define (text-height extents)
(cadr extents))
(define (text-ascent extents)
(caddr extents))
(define (text-descent extents)
(cadr (cddr extents)))
(define (script_fu_button_hoehmi
text text-size font text-color pattern pressed width filename)
(let* ((old-bg-color (car (gimp-palette-get-background)))
(text-extents ( gimp-text-get-extents-fontname text text-size PIXELS
font))
(ascent (text-ascent text-extents))
(descent (text-descent text-extents))
; abstand text link bzw. rechts
(xpadding 8)
; abstand text oben bzw. unten
(ypadding 10)
; center text, could be nicer :-)
; diese berechnung macht nur bei einer fixen weiter sinn
(xtext
( /
( - width
( - (text-width text-extents)
(text-width (gimp-text-get-extents-fontname "A"
text-size PIXELS font))
)
)
2
)
)
; höhe = 2 * ypadding + descent + ascent
(height (+ ( * 2 ypadding)
( + ascent descent)
)
)
; bild anlegen
(img (car (gimp-image-new width height RGB)))
(background (car (gimp-layer-new img width height RGBA-IMAGE
Background" 100 NORMAL-MODE)))
(bumpmap (car (gimp-layer-new img width height RGBA-IMAGE "Bumpmap" 100
NORMAL-MODE)))
(textl (car
(gimp-text-fontname
img -1 0 0 text 0 TRUE text-size PIXELS font))))
(gimp-image-undo-disable img)
(gimp-image-add-layer img background 1)
(gimp-image-add-layer img bumpmap 1)
; Create pattern layer
(gimp-palette-set-background '(0 0 0))
(gimp-edit-fill background BACKGROUND-FILL)
(gimp-patterns-set-pattern pattern)
(gimp-edit-bucket-fill background PATTERN-BUCKET-FILL NORMAL-MODE 100 0
FALSE 0 0)
; Create bumpmap layer
(gimp-edit-fill bumpmap BACKGROUND-FILL)
(gimp-palette-set-background '(127 127 127))
(gimp-rect-select img 1 1 (- width 2) (- height 2) CHANNEL-OP-REPLACE
FALSE 0)
(gimp-edit-fill bumpmap BACKGROUND-FILL)
(gimp-palette-set-background '(255 255 255))
(gimp-rect-select img 2 2 (- width 4) (- height 4) CHANNEL-OP-REPLACE
FALSE 0)
(gimp-edit-fill bumpmap BACKGROUND-FILL)
(gimp-selection-none img)
; Bumpmap
(plug-in-bump-map 1 img background bumpmap 135 45 2 0 0 0 0 TRUE pressed 0)
; Color and position text
(gimp-palette-set-background text-color)
(gimp-layer-set-preserve-trans textl TRUE)
(gimp-edit-fill textl BACKGROUND-FILL)
(gimp-layer-set-offsets textl
xtext
(+ ypadding descent)
)
; Clean up
(gimp-image-set-active-layer img background)
(gimp-image-remove-layer img bumpmap)
(set! layer-to-save (car (gimp-image-merge-visible-layers img 0)))
(gimp-file-save 1 img layer-to-save filename filename)
(gimp-palette-set-background old-bg-color)
(gimp-image-undo-enable img)
; (gimp-display-new img)
))
(script-fu-register "script_fu_button_hoehmi"
_"<Toolbox>/Xtns/Script-Fu/ButtonHoehmi..."
"button hoehmi"
"hoehmi"
"hoehmi"
"Aug 2004"
""
SF-STRING _"Text" "Text"
SF-ADJUSTMENT _"Font Size (pixels)" '(17 2 1000 1 10 0 1)
SF-FONT _"Font" "Cezanne Light"
SF-COLOR _"Text Color" '(255 255 210)
SF-PATTERN _"Pattern" "Wood #1"
SF-TOGGLE _"Pressed" FALSE
SF-ADJUSTMENT _"Fixed Width" '(160 2 1000 1 10 0 1)
SF-STRING "Filename" "button.jpg")
</code>
gimp-2.1 -d -i -s --no-shm --no-cpu-accel -c -b '(script_fu_button_hoehmi 1
hello" (32 2 1000 1 10 0 1) "Cezanne Light" (0 0 0) Wood false (230 2 1000
1 10 0 1) "button.png")' '(gimp-quit 0)'
>>>>
This is a development version of The GIMP.
Debug messages may appear here.
gimp_composite: use=yes, verbose=no
batch command: experienced an execution error.
plug_in_close: plug-in aborted before sending its procedure return values
<<<<<
any ideas?
cu
andreas
_______________________________________________
Gimp-user mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-user