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->edit_fill($bg);
$img->display_new;
A complete & documented example script can be found at the end of
this document (search for EXAMPLE).
DOCUMENTATION
@ -115,6 +118,29 @@ OVERWRITING INSTALL LOCATIONS (PREFIX)
variable will be passed to the Makefile.PL as if given on the
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
There is a mailinglist for general discussion about Gimp-Perl. To
@ -137,7 +163,9 @@ SUPPORT/MAILING LISTS/MORE INFO
BLURB
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
@ -156,3 +184,79 @@ THREATS
(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.
- scripts will now be correctly installed when IN_GIMP.
1.071 Tue Mar 23 13:47:10 CET 1999
- 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

View File

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

View File

@ -10,6 +10,9 @@ SYNOPSIS
$img->add_layer($bg, 1);
$img->edit_fill($bg);
$img->display_new;
A complete & documented example script can be found at the end of
this document (search for EXAMPLE).
DOCUMENTATION
@ -115,6 +118,29 @@ OVERWRITING INSTALL LOCATIONS (PREFIX)
variable will be passed to the Makefile.PL as if given on the
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
There is a mailinglist for general discussion about Gimp-Perl. To
@ -137,7 +163,9 @@ SUPPORT/MAILING LISTS/MORE INFO
BLURB
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
@ -156,3 +184,79 @@ THREATS
(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
$CPPFLAGS = q[@CPPFLAGS@];
$CFLAGS = q[@CFLAGS@];
$LDFLAGS = q[@LDFLAGS@];
%cfg = (
_CPPFLAGS => q[@CPPFLAGS@],
_CFLAGS => q[@CFLAGS@],
_LDFLAGS => q[@LDFLAGS@],
$prefix = q[@prefix@];
$exec_prefix = q[@exec_prefix@];
$libdir = q[@libdir@];
$bindir = q[@bindir@];
prefix => q[@prefix@],
exec_prefix => q[@exec_prefix@],
libdir => q[@libdir@],
bindir => q[@bindir@],
$exec_prefix=~s/\${?prefix}?/$prefix/g;
$libdir=~s/\${?exec_prefix}?/$exec_prefix/g;
$bindir=~s/\${?exec_prefix}?/$exec_prefix/g;
IN_GIMP => q[@IN_GIMP@],
$IN_GIMP = q[@IN_GIMP@];
_PERL => q[@PERL@],
GIMP => q[@GIMP@],
$PERL = q[@PERL@];
$GIMP = $IN_GIMP ? q[@GIMP@] : "$bindir/gimp";
GIMPTOOL => q[@GIMPTOOL@],
_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@];
$GIMP_INC = q[@GIMP_CFLAGS@];
$GIMP_INC_NOUI = q[@GIMP_CFLAGS_NOUI@];
$GIMP_LIBS = q[@GIMP_LIBS@];
$GIMP_LIBS_NOUI = q[@GIMP_LIBS_NOUI@];
INSTALL => q[@INSTALL@],
INSTALL_PROGRAM => q[@INSTALL_PROGRAM@],
gimpplugindir => q[@gimpplugindir@],
$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) {
$GIMP_INC =~ s/\$topdir/$topdir/g;
@ -34,10 +56,11 @@ if (defined $topdir) {
}
if ($IN_GIMP) {
$GIMP_PREFIX=$prefix;
$GIMP_PREFIX=expand($prefix);
} else {
$GIMP_PREFIX = `$GIMPTOOL --prefix`;
chomp $GIMP_PREFIX;
}
$DEFS = ' -DGIMP_PREFIX=\"'.$GIMP_PREFIX.'\" -DGIMP_PATH=\"'.$GIMP.'\"';