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

2001-09-27 Thread NunoACHenriques

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 <[EMAIL PROTECTED]> 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
;
;   [EMAIL PROTECTED]
; 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 i

Re: [Gimp-developer] Film grain: "Grey" addition and subtraction modes

2001-09-27 Thread Sven Neumann

Hi,

Eric Kidd <[EMAIL PROTECTED]> writes:

> The attached patch implementes "Grey" addition and subtraction, both as a
> layer mode and a brush mode.  I've tested it with GIMP 1.2.2, but I'd like
> to hear any comments before porting it to 1.3.x.

I have some comments on the implementation that you'll find further down.

it would be nice if you could illustrate the effect with some images so
we can see if it is worth to add new LayerModeEffects for the result.

> The names of the transfer modes are highly provisional!

well, yes, I think we need better names.
 
> diff -ur gimp-1.2.2-old/app/apptypes.h gimp-1.2.2/app/apptypes.h
> --- gimp-1.2.2-old/app/apptypes.h Sat Dec 16 15:33:41 2000
> +++ gimp-1.2.2/app/apptypes.h Wed Sep 26 19:18:40 2001
> @@ -78,8 +78,15 @@
>DIVIDE_MODE,
>ERASE_MODE, /*< skip >*/
>REPLACE_MODE,   /*< skip >*/
> -  ANTI_ERASE_MODE /*< skip >*/
> +  ANTI_ERASE_MODE,/*< skip >*/
> +  GREY_ADDITION_MODE,
> +  GREY_SUBTRACTION_MODE
>  } LayerModeEffects;

you should probably move the new modes up before the special modes.
That said, we should probably let the special modes start with a value
large enough to give room for future additions. For 1.2 hwoever you 
don't have much choice if you don't want to break scripts and plug-ins.

> diff -ur gimp-1.2.2-old/app/brush_select_cmds.c gimp-1.2.2/app/brush_select_cmds.c
> diff -ur gimp-1.2.2-old/app/brushes_cmds.c gimp-1.2.2/app/brushes_cmds.c
> diff -ur gimp-1.2.2-old/app/layer_cmds.c gimp-1.2.2/app/layer_cmds.c
> diff -ur gimp-1.2.2-old/app/tools_cmds.c gimp-1.2.2/app/tools_cmds.c

all these files are autogenerated PDB wrappers. If someone applies your
patch and runs make in the toplevel dir, the changes will get overwritten. 
Most of the changes (the addition of new enums) will however automatically 
propagate to the C files. Other changes have to be made in the 
tools/pdbgen/pdb/ directory.

> +void
> +grey_add_pixels (const unsigned char *src1,
> +  const unsigned char *src2,
> +  unsigned char *dest,
> +  intlength,
> +  intbytes1,
> +  intbytes2,
> +  inthas_alpha1,
> +  inthas_alpha2)
> +{
> +  int alpha, b;
> +  int sum;
> +
> +  alpha = (has_alpha1 || has_alpha2) ? MAX (bytes1, bytes2) - 1 : bytes1;
> +
> +  while (length --)
> +{
> +  for (b = 0; b < alpha; b++)
> + {
> +   /* Add, re-center and clip. */
> +   sum = src1[b] + src2[b] - 128;
> +   dest[b] = MAX(MIN(sum, 255), 0);

you should use CLAMP(sum, 0, 255) here instead of combining MAX and MIN.

> +void
> +grey_subtract_pixels (const unsigned char *src1,
> +   const unsigned char *src2,
> +   unsigned char *dest,
> +   intlength,
> +   intbytes1,
> +   intbytes2,
> +   inthas_alpha1,
> +   inthas_alpha2)
> +{
> +  int alpha, b;
> +  int diff;
> +
> +  alpha = (has_alpha1 || has_alpha2) ? MAX (bytes1, bytes2) - 1 : bytes1;
> +
> +  while (length --)
> +{
> +  for (b = 0; b < alpha; b++)
> + {
> +   diff = src1[b] - src2[b] + 128;
> +   dest[b] = MAX(MIN(diff, 255), 0);

again, use CLAMP().



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



Re: [Gimp-developer] Film grain: "Grey" addition and subtraction modes

2001-09-27 Thread Sven Neumann

Hi,

Daniel Egger <[EMAIL PROTECTED]> writes:

> Originally I was about to rewrite most of the paint-funcs
> though I have now 2 problems which makes it more likely
> that I'll revert my old work and start with something completely
> different:
> - Reiserfs crashed on my development partition and took all the
>   changes I had made to it which are not in CVS with it; this
>   are roughly 40h work (coding + analysis). :( Though the code
>   was certainly not ready for checkin it is really a big step
>   away from what we have now.

I have always encouraged you (and others) to check your work into CVS 
early and often. This is the second time something like this has 
happened to Gimp work and it is absolutely unnecessary.

> - I have a much better idea now which is probably easier to implement
>   and avoids codeduplication to a large degree and thus is less
> errorprone.
> 
> If it is okay with everyone I'll scratch the new files I created in CVS
> and start from the ground up. Sven, Mitch?

of course. How could we object? I'm cursious however how your new 
concept looks like and why it needs a different file structure.


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



Re: [Gimp-developer] Re: Film grain: "Grey" addition and subtraction modes

2001-09-27 Thread Eric Kidd

On Thu, Sep 27, 2001 at 08:33:48PM +0200, Guillermo S. Romero / Familia Romero wrote:
> > Step (3): To merge the pattern back into the image, create a channel of
> > solid noise, mask it as needed, and add it to the underlying channel.
> > Again, the addition is tricky.
> 
> Should s/channel/layer/g be applied there?

Yes.  I've written a better tutorial.  dobey or carol will put it online
somewhere.

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



[Gimp-developer] Re: Film grain: "Grey" addition and subtraction modes

2001-09-27 Thread Guillermo S. Romero / Familia Romero

[EMAIL PROTECTED] (2001-09-26 at 2241.03 -0400):
> Many thanks to all the regulars on #gimp who answered my questions, gave me
> advice, and bugged me to write this stuff up.

;]

> Step (3): To merge the pattern back into the image, create a channel of
> solid noise, mask it as needed, and add it to the underlying channel.
> Again, the addition is tricky.

Should s/channel/layer/g be applied there?

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



Re: [Gimp-developer] Film grain: "Grey" addition and subtractionmodes

2001-09-27 Thread Daniel Egger

On Don, 2001-09-27 at 04:41, Eric Kidd wrote:

> Feedback welcome.  Share and enjoy!

I like it. If nobody objects I'll check this in. 

Originally I was about to rewrite most of the paint-funcs
though I have now 2 problems which makes it more likely
that I'll revert my old work and start with something completely
different:
- Reiserfs crashed on my development partition and took all the
  changes I had made to it which are not in CVS with it; this
  are roughly 40h work (coding + analysis). :( Though the code
  was certainly not ready for checkin it is really a big step
  away from what we have now.
- I have a much better idea now which is probably easier to implement
  and avoids codeduplication to a large degree and thus is less
errorprone.

If it is okay with everyone I'll scratch the new files I created in CVS
and start from the ground up. Sven, Mitch?

--
Servus,
   Daniel


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



[Gimp-developer] Calling a script-fu from a plug-in from a script-fu

2001-09-27 Thread Tim Lambert

I have a script-fu that calls a plug-in that calls another script-fu.
When the plug-in returns gimp (1.2.2) crashes with a segmentation
fault.  If I invoke the script-fu from the script-fu console
everything works OK.  I'm guessing this is because the script-fu
console fires up another copy of the Scheme interpreter, whereas the
first method all hapens inside the one interpreter and it gets
confused.

Does this sound reasonable?  Do you think that this bug in gimp would
be difficult to fix?


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