Re: file_gih_save

2000-11-11 Thread Marc Lehmann

On Sat, Nov 11, 2000 at 11:20:15PM +0200, Tor Lillqvist <[EMAIL PROTECTED]> wrote:
> file_gih_save. Dunno how it should be called from Perl, but in

About the same, except that you do not need to hardcode values for
constants.

> Obviously, this is not quite what you have in mind. Passing in all the

Yes, it is.

> has been loaded from a .tub file and thus has the
> gimp-brush-pipe-parameters parasite set up already, containing the

Hmm.. in my experience .tub files get loaded as flat images anyway
(saving the files interactively created only very large flat brushes, not
"animations" and I had to edit all the parameters myself), so I wasn't
really aware of the possibility of sensible defaults.

> necessary information. Should the args be ignored in such a case? Or
> should there be a separate PDB function,

good question. gimp really needs a way to specify default arguments. Some
magic value for each argument (e.g. -1 for numbers) would make it possible
to selectively override some arguments.

> file_gih_save_using_parameters_from_parasite or something? I assume
> PDB args can't be optional?

Quite a long time ago I hacked the pdb implementation to allow for
variable number of arguments, so if one left out the checks inside gimp
it should be possible to leave out agruments at the end. Obviously,
most plug-ins would break, though (although perl won't and other
generic-language-interfaces might not, either).

However, this won't help much, as often one wants to leave out something
in the middle, in which case marker values are most useful (NULL for
strings for example, or often -1 for ints).

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



Re: file_gih_save

2000-11-11 Thread Tor Lillqvist

Tor Lillqvist writes:

 > [...] you are saving an image that has been loaded from a .tub file
 > and thus has the gimp-brush-pipe-parameters parasite set up
 > already, containing the necessary information.

Hmm, but note that many of the .tub files out there *don't* have the
necessary information in them from which the
gimp-brush-pipe-parameters parasite would be set up up by the psp
plug-in. Apparently PSP used to have its brush tube parameters in
separate files in early versions, and only later did they add the
parameter block to their file format.

--tml




Re: file_gih_save

2000-11-11 Thread Tor Lillqvist

Marc Lehmann writes:
 > no, but I have this (this is what I originally used on tehe fair), it
 > comverts all *tub-files given as arguments to .gih-files.
 > 
 > perl -MGimp -e 'Gimp::init; Gimp::set_trace(-1); for(@ARGV) { \
 > my $img = Gimp->file_load(($_)x2); s/.tub$/.gih/; \
 >     $img->get_active_layer->file_gih_save(($_)x2, 100, $_); \
 > $img->delete }' *.tub

I just committed an implementation for the non-interactive
file_gih_save. Dunno how it should be called from Perl, but in
script-fu it goes like this, for example:

  (let ((ranks (cons-array 1 'byte)))
(aset ranks 0 12)
(file-gih-save 1
   img
   drawable
   "foo.gih"
   "foo.gih"
   100
   "test brush"
   125
   125
   3
   4
   1
   ranks
   1
   '("random")))

Obviously, this is not quite what you have in mind. Passing in all the
parameters is not what you want to do, as you are saving an image that
has been loaded from a .tub file and thus has the
gimp-brush-pipe-parameters parasite set up already, containing the
necessary information. Should the args be ignored in such a case? Or
should there be a separate PDB function,
file_gih_save_using_parameters_from_parasite or something? I assume
PDB args can't be optional?

--tml




Re: file_gih_save

2000-11-11 Thread Marc Lehmann

On Sat, Nov 11, 2000 at 08:45:09PM +0200, Tor Lillqvist <[EMAIL PROTECTED]> wrote:
> Umm, yes ;-) There is a FIXME comment about that... I guess I will

sorry, I somehow totally misinterpreted that comment... hm... ;(

> have to fix it. (You wouldn't happen to have some script-fu around to
> test it with... nah, guess not?)

no, but I have this (this is what I originally used on tehe fair), it
comverts all *tub-files given as arguments to .gih-files.

perl -MGimp -e 'Gimp::init; Gimp::set_trace(-1); for(@ARGV) { \
my $img = Gimp->file_load(($_)x2); s/.tub$/.gih/; \
$img->get_active_layer->file_gih_save(($_)x2, 100, $_); \
$img->delete }' *.tub


-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



Re: file_gih_save

2000-11-11 Thread Tor Lillqvist

Marc Lehmann writes:
 > On Sat, Nov 11, 2000 at 08:19:55PM +0200, Tor Lillqvist <[EMAIL PROTECTED]> wrote:
 > > I see two calls to gimp_pixpipe_params_init(&gihparms)?
 > 
 > None of whose are called with GIMP_RUN_NONINTERACTIVE.

Umm, yes ;-) There is a FIXME comment about that... I guess I will
have to fix it. (You wouldn't happen to have some script-fu around to
test it with... nah, guess not?)

--tml




Re: file_gih_save

2000-11-11 Thread Marc Lehmann

On Sat, Nov 11, 2000 at 08:19:55PM +0200, Tor Lillqvist <[EMAIL PROTECTED]> wrote:
> I see two calls to gimp_pixpipe_params_init(&gihparms)?

None of whose are called with GIMP_RUN_NONINTERACTIVE.

> Umm, first I tested by loading a PSP .tub file and saving it as a .gih
> file. I was able to set the brush parameters with the dialog, it

Yes, it always works *using the gui*. It does not work when the function
is called directly (as I wanted to do when converting 25+ psp tubes).

> between the parameters, for instance depending on the dimension the
> "extra" rank and selection fields should be made insensitive.

Unfortunately, there is no way to pass these parameters to file_gih_save,
as the only parameter that can be specified is the brush spacing.

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



Re: file_gih_save

2000-11-10 Thread Tor Lillqvist

Marc Lehmann writes:
 > file_gih_save in current cvs saves ALL images with the following header
 > (or similar):

 > H Bare Bush.gih:0 ncells:0 cellwidth:0 cellheight:0 step:0 dim:0 cols:0
 > rows:0 placement:(null)
 > 
 > and no image information at all. (file_gih_save does not allow you to
 > specify any parameters except spacing, btw).

Umm, I cannot reproduce this. To me, .gih saving looks like it always
has. (I checked it on Windows, with GTK+ 1.3.0.)

--tml




file_gih_save

2000-11-09 Thread Marc Lehmann

file_gih_save in current cvs saves ALL images with the following header
(or similar):

H Bare Bush.gih:0 ncells:0 cellwidth:0 cellheight:0 step:0 dim:0 cols:0
rows:0 placement:(null)

and no image information at all. (file_gih_save does not allow you to
specify any parameters except spacing, btw).

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED] |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |