Re: [Gimp-developer] Script-Fu server parser bug?!...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	Greetings

	I'm sorry, my mistake! I couldn't reproduce my problem with any of
the standard Gimp distribution scripts...

	...But something very strange happened: I've changed the interface to
use the SF-FILENAME, SF-FONT and SF-ADJUSTMENT and now it runs without any
problem except one: The parser changes my last argument '(255 255 255) to be
equal to the one before '(39 36 95)...

(script-fu-fctense 1 0 "/tmp" "nach" "-adobe-courier-bold-r-normal-*-*-140-*-*-m-*-iso8859-1" "90" '(39 36 95) '(255 255 255))

	I've tested it on the "Script-Fu Console" and on the "Script-Fu
Server". I'm using Gimp 1.2.1. The server (log) receives well the command I
sent but the result is wrong with the problem I stated above.

	Can you help me with this new(?) problem?

	Thanks for your time and patience when helping a rookie like me.

-- 
     o__		Bem haja,
    _.>/ _			NunoACHenriques
   (_) \(_)			~~~~~~~~~~~~~~~
				http://students.fct.unl.pt/users/nuno/

On 25 Sep 2001, Sven Neumann wrote:

>Hi,
>
>NunoACHenriques <nach@xxxxxxxxxx> writes:
>
>>         Greetings!
>>
>>         When the run-mode of a script-fu is turned to non-interactive
>> (=TRUE or =1) I get a very strange error message:
>> ...
>> /usr/bin/gimp: Script-Fu Error while executing
>>  (script_fu_text_nach FALSE /tmp/ /tmp/ /tmp/ /tmp/ FALSE '(39 36 95) '(39 36 95))
>> ERROR: unbound variable (errobj /tmp/)
>
>it would help a lot if you could provide a complete test case for this problem.
>How are we supposed to reproduce your problem without the script you are trying
>to run? Could you please check if you can reproduce the problem with one of the
>scripts from the standard gimp distribution and report back.
>
>
>Salut, Sven
>
>
>

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;                                fctense.scm
;
;                               www@xxxxxxxxxx
;                                 2000/2001
;
;                                gimp 1.2.1
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;                                   Core
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This is needed because of a strange bug in the batch mode parser:
; changed '-' to '_'
(define (script_fu_fctense
         interactive
         in_file_path
         in_text 
         in_font 
         in_font_size
         in_text_color 
         in_background_color)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;                          Defines and variables
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Background and text colors (saves the original colors and set new ones)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (set! original_text_color (car (gimp-palette-get-foreground)))
  (set! original_background_color (car (gimp-palette-get-background)))
  (gimp-palette-set-foreground in_text_color)
  (gimp-palette-set-background in_background_color)
  (let* (
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Creates a new image with predefined dimensions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
         (image_width 100)
         (image_height 20)
         (image (car (gimp-image-new image_width image_height RGB)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Creates and writes text in text layer
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
         (text (car (gimp-text-fontname image -1 0 0 in_text 0 TRUE in_font_size PIXELS in_font)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Creates background layer with new image dimensions (from text)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
         (image_width (car (gimp-drawable-width text)))
         (image_height (car (gimp-drawable-height text)))
         (background (car (gimp-layer-new image image_width image_height RGB_IMAGE "Background" 100 NORMAL))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;                                 Actions
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Disables undo (not needed)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (gimp-image-undo-disable image)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Resizes the image
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (gimp-image-resize image image_width image_height 0 0)
    
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Apply background layer
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (gimp-drawable-fill background BG-IMAGE-FILL)
    (gimp-image-add-layer image background 0)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Drop shadow and s/fx preserving the old bgcolor
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (gimp-brightness-contrast text 100 100)
    (script-fu-drop-shadow image text 2 2 4 '(0 0 0) 50 TRUE)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Resizes the text layer with the new image dimensions (after drop-shadow)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (set! image_width (car (gimp-image-width image)))
    (set! image_height (car (gimp-image-height image)))
    (gimp-layer-resize text image_width image_height 0 0)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Resizes the background layer (and maintains the bg color)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (gimp-layer-resize background image_width image_height 0 0)
    (gimp-drawable-fill background BG-IMAGE-FILL)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Prepare, convert to GIF and save "image"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (if (= interactive FALSE)
        (begin
          (set! final_layer (car (gimp-image-flatten image)))
          (gimp-convert-indexed image 0 0 256 0 0 "")
          (set! file_name (string-append in_file_path "/" in_text ".gif"))
          (file-gif-save 1 image final_layer file_name in_text TRUE 0 0 0)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Display image (cleaning the dirty flag; do not confirm the close).
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (if (= interactive TRUE)
        (begin
          (gimp-image-clean-all image)
	  (gimp-display-new image)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Background and text colors (reverse to the original colors), enables undo.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (gimp-palette-set-background original_background_color)
    (gimp-palette-set-foreground original_text_color)
    (gimp-image-undo-enable image)
  ) ; let*
) ; define

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;                                Register
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This is needed because of a strange bug in the batch mode parser:
; changed '-' to '_'
(script-fu-register "script_fu_fctense"
		    "<Toolbox>/Xtns/Script-Fu/Logos/FCTense"
		    "Creates text with color over a background and drops a black shadow by 50%. Saves the file '[Path]/[Text].gif'"
		    "www@xxxxxxxxxx"
		    "WWW FCTUNL 2000/2001"
		    "2000/2001"
		    ""
		    SF-TOGGLE      "Interactive" FALSE
		    SF-FILENAME    "Path" "/tmp"
		    SF-STRING      "Text" "text"
		    SF-FONT        "Font" "-adobe-courier-bold-r-normal-*-*-140-*-*-m-*-iso8859-1"
		    SF-ADJUSTMENT  "Font size (pixels)" '(90 2 1000 1 10 0 1)
		    SF-COLOR       "Text color" '(39 36 95)
		    SF-COLOR       "Background color" '(255 255 255)
) ; script-fu-register

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux