see plug-ins/perl/Changes

This commit is contained in:
Marc Lehmann 1999-03-24 10:32:32 +00:00
parent 16e6b8bd1d
commit 4ea6e0aefb
5 changed files with 262 additions and 27 deletions

View File

@ -10,6 +10,9 @@ SYNOPSIS
$img->add_layer($bg, 1); $img->add_layer($bg, 1);
$img->edit_fill($bg); $img->edit_fill($bg);
$img->display_new; $img->display_new;
A complete & documented example script can be found at the end of
this document (search for EXAMPLE).
DOCUMENTATION DOCUMENTATION
@ -115,6 +118,29 @@ OVERWRITING INSTALL LOCATIONS (PREFIX)
variable will be passed to the Makefile.PL as if given on the variable will be passed to the Makefile.PL as if given on the
commandline. commandline.
If you are building a slp/deb/rpm/whatever package you usually want
to use the normal prefix, while overwriting the prefix at "make
install" time. In that case, just build gimp-perl (or the whole
gimp) as usual, but instead of just calling "make install", use
something like the following command (this example is for debian):
make prefix=`pwd`/debian/tmp/usr PREFIX=`pwd`/debian/tmp/usr \
install
The lowercase prefix is used by the Gimp, the uppercase PREFIX is
used by perl. Rarely you also want to specifiy manpage directories
etc.. you can also overwrite these (see "man ExtUtils::MakeMaker")
as well, e.g. for debian:
make prefix=`pwd`/debian/tmp/usr PREFIX=`pwd`/debian/tmp/usr \
INSTALLMAN1DIR=`pwd`/debian/tmp/usr/man/man1 \
INSTALLMAN3DIR=`pwd`/debian/tmp/usr/man/man3 \
install
PS: I'm not a debian developer/fan. If at all, I'd recommend
www.stampede.org (since they are using my compiler ;), but the
_best_ thing is DIY.
SUPPORT/MAILING LISTS/MORE INFO SUPPORT/MAILING LISTS/MORE INFO
There is a mailinglist for general discussion about Gimp-Perl. To There is a mailinglist for general discussion about Gimp-Perl. To
@ -137,7 +163,9 @@ SUPPORT/MAILING LISTS/MORE INFO
BLURB BLURB
Scheme is the crappiest language ever. Have a look at Haskell Scheme is the crappiest language ever. Have a look at Haskell
(http://www.haskell.org) to see how functional is done right. (http://www.haskell.org) to see how functional is done right. I am
happy to receive opinions on both languages, don't hesitate to tell
me.
LICENSE LICENSE
@ -156,3 +184,79 @@ THREATS
(c)1998,1999 Marc Lehmann <pcg@goof.com> (c)1998,1999 Marc Lehmann <pcg@goof.com>
EXAMPLE PERL PLUG-IN
To get even more look & feel, here is a complete plug-in source,
its the examples/example-fu.pl script from the distribution.
#!/usr/bin/perl
use Gimp;
use Gimp::Fu;
register "gimp_fu_example_script", # fill in a function name
"A non-working example of Gimp::Fu usage", # and a short description,
"Just a starting point to derive new ". # a (possibly multiline) help text
"scripts. Always remember to put a long".
"help message here!",
"Marc Lehmann", # don't forget your name (author)
"(c) 1998, 1999 Marc Lehmann", # and your copyright!
"19990316", # the date this script was written
"<Toolbox>/Xtns/Gimp::Fu Example", # the menu path
"RGB*, GRAYA", # image types to accept (RGB, RGAB amnd GRAYA)
[
# argument type, switch name , a short description , default value, extra arguments
[PF_SLIDER , "width" , "The image width" , 360, [300, 500]],
[PF_SPINNER , "height" , "The image height" , 100, [100, 200]],
[PF_STRING , "text" , "The Message" , "example text"],
[PF_INT , "bordersize" , "The bordersize" , 10],
[PF_FLOAT , "borderwidth" , "The borderwidth" , 1/5],
[PF_FONT , "font" , "The Font Family" ],
[PF_COLOUR , "text_colour" , "The (foreground) text colour", [10,10,10]],
[PF_COLOUR , "bg_colour" , "The background colour" , "#ff8000"],
[PF_TOGGLE , "ignore_cols" , "Ignore colours" , 0],
[PF_IMAGE , "extra_image" , "An additonal picture to ignore"],
[PF_DRAWABLE , "extra_draw" , "Somehting to ignroe as well" ],
[PF_RADIO , "type" , "The effect type" , 0, [small => 0, large => 1]],
[PF_BRUSH , "a_brush" , "An unused brush" ],
[PF_PATTERN , "a_pattern" , "An unused pattern" ],
[PF_GRADIENT , "a_gradients" , "An unused gradients" ],
],
sub {
# now do sth. useful with the garbage we got ;)
my($width,$height,$text,$font,$fg,$bg,$ignore,$brush,$pattern,$gradient)=@_;
# set tracing
Gimp::set_trace(TRACE_ALL);
my $img=new Image($width,$height,RGB);
# put an undo group around any modifications, so that
# they can be undone in one step. The eval shields against
# gimp-1.0, which does not have this function.
eval { $img->undo_push_group_start };
my $l=new Layer($img,$width,$height,RGB,"Background",100,NORMAL_MODE);
$l->add_layer(0);
# now a few syntax examples
Palette->set_foreground($fg) unless $ignore;
Palette->set_background($bg) unless $ignore;
fill $l BG_IMAGE_FILL;
# the next function only works in gimp-1.1
$text_layer=$img->text_fontname(-1,10,10,$text,5,1,xlfd_size($font),$font);
gimp_palette_set_foreground("green");
# close the undo push group
eval { $img->undo_push_group_end };
$img; # return the image, or an empty list, i.e. ()
};
exit main;

View File

@ -1,5 +1,7 @@
Revision history for Gimp-Perl extension. Revision history for Gimp-Perl extension.
- scripts will now be correctly installed when IN_GIMP.
1.071 Tue Mar 23 13:47:10 CET 1999 1.071 Tue Mar 23 13:47:10 CET 1999
- changed the definition of PF_RADIO, simplifying it (it ain't no C). - changed the definition of PF_RADIO, simplifying it (it ain't no C).
- Gimp::Fu scripts try to run with default arguments if Gtk is not - Gimp::Fu scripts try to run with default arguments if Gtk is not

View File

@ -54,7 +54,7 @@ Do you want me to run these tests [y]? ";
$ENV{IN_GIMP}=0; $ENV{IN_GIMP}=0;
exit system("./etc/configure",@ARGV)>>8; exit system("./etc/configure",@ARGV)>>8;
} else { } else {
do './config.pl'; do './config.pl'; die $@ if $@;
} }
require ExtUtils::MakeMaker; require ExtUtils::MakeMaker;
@ -203,7 +203,8 @@ install ::
} }
sub MY::postamble { sub MY::postamble {
my $GT = $IN_GIMP ? "../$GIMPTOOL" : $GIMPTOOL; my $GT = $IN_GIMP ? '$(INSTALL_PROGRAM)' : "$GIMPTOOL --install-admin-bin";
my $GT2 = $IN_GIMP ? '$(gimpplugindir)/plug-ins/' : '';
my $postamble=" my $postamble="
objclean :: clean objclean :: clean
@ -226,7 +227,7 @@ install-plugins ::
\$(CHMOD) 755 * ; \\ \$(CHMOD) 755 * ; \\
\$(MY_FIXIN) * ; \\ \$(MY_FIXIN) * ; \\
for plugin in * ; do \\ for plugin in * ; do \\
$GT --install-admin-bin \"\$\$plugin\" ; \\ $GT \"\$\$plugin\" $GT2 ; \\
done done
\$(RM_RF) inst-temp \$(RM_RF) inst-temp
"; ";
@ -259,9 +260,10 @@ WriteMakefile(
'Gimp/Feature.pm' => '$(INST_LIBDIR)/Gimp/Feature.pm', 'Gimp/Feature.pm' => '$(INST_LIBDIR)/Gimp/Feature.pm',
}, },
'LIBS' => [''], 'LIBS' => [''],
'INC' => "$CPPFLAGS $CFLAGS $GIMP_INC_NOUI $DEFS", 'INC' => "$CPPFLAGS $CFLAGS $GIMP_INC_NOUI",
'DEFINE' => ($IN_GIMP ? " -DIN_GIMP " : ""), 'DEFINE' => ($IN_GIMP ? " -DIN_GIMP " : "")." $DEFS",
'EXE_FILES' => ['scm2perl','scm2scm'], 'EXE_FILES' => ['scm2perl','scm2scm'],
'macro' => \%cfg,
'realclean' => { FILES => "config.status config.cache config.log config.pl config.h" }, 'realclean' => { FILES => "config.status config.cache config.log config.pl config.h" },
'clean' => { FILES => "Makefile.old stamp-h" }, 'clean' => { FILES => "Makefile.old stamp-h" },
); );

View File

@ -10,6 +10,9 @@ SYNOPSIS
$img->add_layer($bg, 1); $img->add_layer($bg, 1);
$img->edit_fill($bg); $img->edit_fill($bg);
$img->display_new; $img->display_new;
A complete & documented example script can be found at the end of
this document (search for EXAMPLE).
DOCUMENTATION DOCUMENTATION
@ -115,6 +118,29 @@ OVERWRITING INSTALL LOCATIONS (PREFIX)
variable will be passed to the Makefile.PL as if given on the variable will be passed to the Makefile.PL as if given on the
commandline. commandline.
If you are building a slp/deb/rpm/whatever package you usually want
to use the normal prefix, while overwriting the prefix at "make
install" time. In that case, just build gimp-perl (or the whole
gimp) as usual, but instead of just calling "make install", use
something like the following command (this example is for debian):
make prefix=`pwd`/debian/tmp/usr PREFIX=`pwd`/debian/tmp/usr \
install
The lowercase prefix is used by the Gimp, the uppercase PREFIX is
used by perl. Rarely you also want to specifiy manpage directories
etc.. you can also overwrite these (see "man ExtUtils::MakeMaker")
as well, e.g. for debian:
make prefix=`pwd`/debian/tmp/usr PREFIX=`pwd`/debian/tmp/usr \
INSTALLMAN1DIR=`pwd`/debian/tmp/usr/man/man1 \
INSTALLMAN3DIR=`pwd`/debian/tmp/usr/man/man3 \
install
PS: I'm not a debian developer/fan. If at all, I'd recommend
www.stampede.org (since they are using my compiler ;), but the
_best_ thing is DIY.
SUPPORT/MAILING LISTS/MORE INFO SUPPORT/MAILING LISTS/MORE INFO
There is a mailinglist for general discussion about Gimp-Perl. To There is a mailinglist for general discussion about Gimp-Perl. To
@ -137,7 +163,9 @@ SUPPORT/MAILING LISTS/MORE INFO
BLURB BLURB
Scheme is the crappiest language ever. Have a look at Haskell Scheme is the crappiest language ever. Have a look at Haskell
(http://www.haskell.org) to see how functional is done right. (http://www.haskell.org) to see how functional is done right. I am
happy to receive opinions on both languages, don't hesitate to tell
me.
LICENSE LICENSE
@ -156,3 +184,79 @@ THREATS
(c)1998,1999 Marc Lehmann <pcg@goof.com> (c)1998,1999 Marc Lehmann <pcg@goof.com>
EXAMPLE PERL PLUG-IN
To get even more look & feel, here is a complete plug-in source,
its the examples/example-fu.pl script from the distribution.
#!/usr/bin/perl
use Gimp;
use Gimp::Fu;
register "gimp_fu_example_script", # fill in a function name
"A non-working example of Gimp::Fu usage", # and a short description,
"Just a starting point to derive new ". # a (possibly multiline) help text
"scripts. Always remember to put a long".
"help message here!",
"Marc Lehmann", # don't forget your name (author)
"(c) 1998, 1999 Marc Lehmann", # and your copyright!
"19990316", # the date this script was written
"<Toolbox>/Xtns/Gimp::Fu Example", # the menu path
"RGB*, GRAYA", # image types to accept (RGB, RGAB amnd GRAYA)
[
# argument type, switch name , a short description , default value, extra arguments
[PF_SLIDER , "width" , "The image width" , 360, [300, 500]],
[PF_SPINNER , "height" , "The image height" , 100, [100, 200]],
[PF_STRING , "text" , "The Message" , "example text"],
[PF_INT , "bordersize" , "The bordersize" , 10],
[PF_FLOAT , "borderwidth" , "The borderwidth" , 1/5],
[PF_FONT , "font" , "The Font Family" ],
[PF_COLOUR , "text_colour" , "The (foreground) text colour", [10,10,10]],
[PF_COLOUR , "bg_colour" , "The background colour" , "#ff8000"],
[PF_TOGGLE , "ignore_cols" , "Ignore colours" , 0],
[PF_IMAGE , "extra_image" , "An additonal picture to ignore"],
[PF_DRAWABLE , "extra_draw" , "Somehting to ignroe as well" ],
[PF_RADIO , "type" , "The effect type" , 0, [small => 0, large => 1]],
[PF_BRUSH , "a_brush" , "An unused brush" ],
[PF_PATTERN , "a_pattern" , "An unused pattern" ],
[PF_GRADIENT , "a_gradients" , "An unused gradients" ],
],
sub {
# now do sth. useful with the garbage we got ;)
my($width,$height,$text,$font,$fg,$bg,$ignore,$brush,$pattern,$gradient)=@_;
# set tracing
Gimp::set_trace(TRACE_ALL);
my $img=new Image($width,$height,RGB);
# put an undo group around any modifications, so that
# they can be undone in one step. The eval shields against
# gimp-1.0, which does not have this function.
eval { $img->undo_push_group_start };
my $l=new Layer($img,$width,$height,RGB,"Background",100,NORMAL_MODE);
$l->add_layer(0);
# now a few syntax examples
Palette->set_foreground($fg) unless $ignore;
Palette->set_background($bg) unless $ignore;
fill $l BG_IMAGE_FILL;
# the next function only works in gimp-1.1
$text_layer=$img->text_fontname(-1,10,10,$text,5,1,xlfd_size($font),$font);
gimp_palette_set_foreground("green");
# close the undo push group
eval { $img->undo_push_group_end };
$img; # return the image, or an empty list, i.e. ()
};
exit main;

View File

@ -1,30 +1,52 @@
# this is ugly, but it makes Gimp installable from within CPAN # this is ugly, but it makes Gimp installable from within CPAN
$CPPFLAGS = q[@CPPFLAGS@]; %cfg = (
$CFLAGS = q[@CFLAGS@]; _CPPFLAGS => q[@CPPFLAGS@],
$LDFLAGS = q[@LDFLAGS@]; _CFLAGS => q[@CFLAGS@],
_LDFLAGS => q[@LDFLAGS@],
$prefix = q[@prefix@]; prefix => q[@prefix@],
$exec_prefix = q[@exec_prefix@]; exec_prefix => q[@exec_prefix@],
$libdir = q[@libdir@]; libdir => q[@libdir@],
$bindir = q[@bindir@]; bindir => q[@bindir@],
$exec_prefix=~s/\${?prefix}?/$prefix/g; IN_GIMP => q[@IN_GIMP@],
$libdir=~s/\${?exec_prefix}?/$exec_prefix/g;
$bindir=~s/\${?exec_prefix}?/$exec_prefix/g;
$IN_GIMP = q[@IN_GIMP@]; _PERL => q[@PERL@],
GIMP => q[@GIMP@],
$PERL = q[@PERL@]; GIMPTOOL => q[@GIMPTOOL@],
$GIMP = $IN_GIMP ? q[@GIMP@] : "$bindir/gimp"; _GIMP_INC => q[@GIMP_CFLAGS@],
_GIMP_INC_NOUI => q[@GIMP_CFLAGS_NOUI@],
_GIMP_LIBS => q[@GIMP_LIBS@],
_GIMP_LIBS_NOUI => q[@GIMP_LIBS_NOUI@],
$GIMPTOOL = q[@GIMPTOOL@]; INSTALL => q[@INSTALL@],
$GIMP_INC = q[@GIMP_CFLAGS@]; INSTALL_PROGRAM => q[@INSTALL_PROGRAM@],
$GIMP_INC_NOUI = q[@GIMP_CFLAGS_NOUI@]; gimpplugindir => q[@gimpplugindir@],
$GIMP_LIBS = q[@GIMP_LIBS@];
$GIMP_LIBS_NOUI = q[@GIMP_LIBS_NOUI@];
$EXTENSIVE_TESTS= q[@EXTENSIVE_TESTS@]; _EXTENSIVE_TESTS => q[@EXTENSIVE_TESTS@],
);
sub expand {
my $cfg = shift;
while($cfg=~/\$\{/) {
while(($k,$v)=each %cfg) {
$cfg=~s/\$\{$k\}/$v/g;
}
}
$cfg;
}
while (($k,$v)=each(%cfg)) {
$k=~s/^_//;
$$k=$v;
}
$GIMP = $bindir."/gimp" if $IN_GIMP;
$GIMP = expand($GIMP);
$GIMPTOOL = expand($GIMPTOOL);
if (defined $topdir) { if (defined $topdir) {
$GIMP_INC =~ s/\$topdir/$topdir/g; $GIMP_INC =~ s/\$topdir/$topdir/g;
@ -34,10 +56,11 @@ if (defined $topdir) {
} }
if ($IN_GIMP) { if ($IN_GIMP) {
$GIMP_PREFIX=$prefix; $GIMP_PREFIX=expand($prefix);
} else { } else {
$GIMP_PREFIX = `$GIMPTOOL --prefix`; $GIMP_PREFIX = `$GIMPTOOL --prefix`;
chomp $GIMP_PREFIX; chomp $GIMP_PREFIX;
} }
$DEFS = ' -DGIMP_PREFIX=\"'.$GIMP_PREFIX.'\" -DGIMP_PATH=\"'.$GIMP.'\"'; $DEFS = ' -DGIMP_PREFIX=\"'.$GIMP_PREFIX.'\" -DGIMP_PATH=\"'.$GIMP.'\"';