Re: [Gimp-user] Script-Fu: documentation of SF-ADJUSTMENT and others?

2005-02-25 Thread Andreas Waechter
have a look at test-sphere.scm as found in the source tree. It has
comments that explain all the Script-Fu parameters.
Thanks, Alan suggested that too, so I searched for that 
script, downloaded it and looked at it.

Andreas
___
Gimp-user mailing list
Gimp-user@lists.xcf.berkeley.edu
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-Fu: documentation of SF-ADJUSTMENT and others?

2005-02-24 Thread Alan Horkan

On Thu, 24 Feb 2005, Andreas Waechter wrote:

 Date: Thu, 24 Feb 2005 14:58:37 +0100
 From: Andreas Waechter [EMAIL PROTECTED]
 To: gimp-user@lists.xcf.berkeley.edu
 Subject: [Gimp-user] Script-Fu: documentation of SF-ADJUSTMENT and others?

 Hi,

 I am trying to write a script-fu script.
 No, I am (nearly) done with the script itself - if I
 hardcode the parameters ...

 Now it needs some parameters given by the user (hardcoding
 them is not good once the script is out of testing phase).

If your copy of the gimp includes the sphere test (test-sphere.scm) You
should read through it first.  To the user the script may be ugly but to
the programmer it provides invaluable comments and clear examples that
help you get started with Script-Fu.

 SF-ADJUSTMENT _Value '(10 1 100 1 10 0 1)

 By trial and error I found out:
 1st value (10)  is the value displayed at startup.
 2nd value (1)   is the lowest possible value.
 3rd value (100) is the highest possible value.
 4th value (1)   is the increment/decrement when the little
 arrows are used

 But what is the meaning of the other 3 (10, 0, 1)?


; Usage:
; SF-ADJUSTMENT label '(value, lower, upper, step_inc, page_inc, digits,
type)

page inc is a larger step value (best to go with 10 usualy) when page up
or page down are used rather than the arrows.

digits ... I dont think I need to explain

type allows you to show a slider in addition to the adjustement box (aka
Spinner)

 Also I look for a way to initialize such an
 SF-ADJUSTMENT with the image-width or image height, i.e. set
 the first value not to a fixed number but to the image
 dimension (either width or height).

I'm fairly sure it is possible but difficult.  Some of scripts included
with the gimp will give you ideas on how to do this but I decided not to
spend too much time trying to figure it out.  (When you have all the rest
of your script figured out I try and point you in the right direction on
this if you are still interested.)

It is far easier to structure your script in a different way, I would use
perecentages of Image size or something else.  Describe what the script is
supposed to be doing and I might be able to make a more helpful suggestion
or even help you with your script (or recommened a similar script someone
else has written already).

 Once I got that into operation, I'd like to couple the
 boxes for width and height together, in the same way the
 width/height boxes are coupled together in
 image/Image/Scale Image

Short answer: Script Fu does not offer this functionality.

 In scripts on my machine I found these:
 SF-STRING
 SF-FILENAME
 SF-DIRNAME
 SF-FONT
 SF-PATTERN
 SF-BRUSH
 SF-GRADIENT
 SF-LAYER
 SF-CHANNEL

Read test-sphere.scm and try out a few things and then read it again but
after you have read it feel free to ask more questions.

 Ok, these are pretty obvious, also the
 SF-OPTION   (taking a list of Strings giving the selected
 string)

 Are there more?

It is easier for me to just point out some of the limitations of Script-Fu
There is currently no way to have a Radio list in Script-Fu.  Script-Fu
does not support UTF but it planned that Tiny-Fu (also scheme) will and
then it will replace Script-Fu.

I cannot stress enough how much it helps to know what it is exactly you
are trying to do and it is especially helpful if you show us the code so
that we can help.

Hope that helps

Please do take a look at my GNU Image Manipulation Program Scripts
http://matrix.netsoc.tcd.ie/~horkana/dev/gnome/gimp/script-fu/script-fu.html
and if you think they could be improved or have any suggestions of
new scripts that might be interesting to write please let me know.

Sincerely

Alan Horkan
http://advogato.org/person/AlanHorkan/

Inkscape, Draw Freely  http://inkscape.org
Abiword is Awesome http://abisource.com

___
Gimp-user mailing list
Gimp-user@lists.xcf.berkeley.edu
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-Fu: documentation of SF-ADJUSTMENT and others?

2005-02-24 Thread Andreas Waechter
If your copy of the gimp includes the sphere test (test-sphere.scm) You
should read through it first.  To the user the script may be ugly but to
the programmer it provides invaluable comments and clear examples that
help you get started with Script-Fu.
I did not find that script on my machine. I googled for it 
and found a version dated 2004-02-03 at
http://anoncvs.gnome.gr.jp/viewcvs.cgi/gimp/plug-ins/script-fu/scripts/test-sphere.scm?rev=1.30view=markup 


SF-ADJUSTMENT _Value '(10 1 100 1 10 0 1)
By trial and error I found out:
1st value (10)  is the value displayed at startup.
2nd value (1)   is the lowest possible value.
3rd value (100) is the highest possible value.
4th value (1)   is the increment/decrement when the little
arrows are used
But what is the meaning of the other 3 (10, 0, 1)?
; Usage:
; SF-ADJUSTMENT label '(value, lower, upper, step_inc, page_inc, digits,
type)
Thanks for that.
 page inc is a larger step value (best to go with 10 
usualy) when page up
 or page down are used rather than the arrows.
 digits ... I dont think I need to explain

Experimenting with it showed it seems to be the number of 
digits after the decimal point.

 type allows you to show a slider in addition to the 
adjustement box (aka
 Spinner)

Also I look for a way to initialize such an
SF-ADJUSTMENT with the image-width or image height, i.e. set
the first value not to a fixed number but to the image
dimension (either width or height).

I'm fairly sure it is possible but difficult.  Some of scripts included
with the gimp will give you ideas on how to do this but I decided not to
spend too much time trying to figure it out.  (When you have all the rest
of your script figured out I try and point you in the right direction on
this if you are still interested.)
I looked through all the .scm files on my machine and only 
found explicit values ...

It is far easier to structure your script in a different way, I would use
perecentages of Image size or something else.  Describe what the script is
supposed to be doing and I might be able to make a more helpful suggestion
or even help you with your script (or recommened a similar script someone
else has written already).
Once I got that into operation, I'd like to couple the
boxes for width and height together, in the same way the
width/height boxes are coupled together in
image/Image/Scale Image
 Short answer: Script Fu does not offer this functionality.
I want to get values that are initialized by the image 
width/height and can be changed with the same behaviour as 
width/height in the Scale image dialog, i.e. by default 
are changed synchronous according to the image's aspect 
ratio - but if the user wants, he can change them independently.

One workaround for Script-Fu not offering the coupled values:
I could just use the two independent boxes for width and 
height, and an additional SF-OPTION with three options:
Use width/height as given
Use width, calc. height from aspect ratio
Use height, calc. width from aspect ratio
That doesn't show the second value, but at least gives the 
behaviour of it.

Read test-sphere.scm and try out a few things and then read it again but
after you have read it feel free to ask more questions.
As soon as I find it ...
It is easier for me to just point out some of the limitations of Script-Fu
There is currently no way to have a Radio list in Script-Fu.
SF-OPTION is a screen-space-saving workaround ...
Script-Fu does not support UTF but it planned that Tiny-Fu (also scheme) 
 will and then it will replace Script-Fu.
Ok, so far I don't need Unicode ...
I cannot stress enough how much it helps to know what it is exactly you
are trying to do and it is especially helpful if you show us the code so
that we can help.
I would show the code if I were allowed to. But company 
policy doesn't allow it.

Hope that helps
Yes - even if it didn't give the solution I wanted, knowing 
that coupling values is not possible saves me from searching 
for it ...

Please do take a look at my GNU Image Manipulation Program Scripts
http://matrix.netsoc.tcd.ie/~horkana/dev/gnome/gimp/script-fu/script-fu.html
and if you think they could be improved or have any suggestions of
new scripts that might be interesting to write please let me know.
Tomorrow (which is in fact later today, it's after midnight, 
time to go to bed ...)

Thanks for your help!
Andreas
___
Gimp-user mailing list
Gimp-user@lists.xcf.berkeley.edu
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-user


Re: [Gimp-user] Script-Fu: documentation of SF-ADJUSTMENT and others?

2005-02-24 Thread Sven Neumann
Hi,

have a look at test-sphere.scm as found in the source tree. It has
comments that explain all the Script-Fu parameters.


Sven
___
Gimp-user mailing list
Gimp-user@lists.xcf.berkeley.edu
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-user