mirror of https://github.com/GNOME/gimp.git
see plug-ins/perl/Changes
This commit is contained in:
parent
b4b5181e10
commit
18c8b0668c
|
@ -0,0 +1,158 @@
|
|||
NAME
|
||||
|
||||
Gimp - Perl extension for writing Gimp Extensions/Plug-ins/Load &
|
||||
Save-Handlers
|
||||
|
||||
SYNOPSIS
|
||||
|
||||
my $img = new Image (600, 300, RGB);
|
||||
my $bg = $img->layer_new(600,300,RGB_IMAGE,"Background",100,NORMAL_MODE);
|
||||
$img->add_layer($bg, 1);
|
||||
$img->edit_fill($bg);
|
||||
$img->display_new;
|
||||
|
||||
DOCUMENTATION
|
||||
|
||||
The Manpages in html format, the newest version, links and more
|
||||
information can be found on the gimp-perl homepage, where you
|
||||
should get an overview over the gimp-perl extension:
|
||||
|
||||
http://gimp.pages.de/
|
||||
-or-
|
||||
http://www.goof.com/pcg/marc/gimp.html
|
||||
|
||||
PREREQUISITES
|
||||
|
||||
To install/use this perl extension, you need to have the following
|
||||
software packages installed (the given order is best):
|
||||
|
||||
Perl5.004 (or higher):
|
||||
|
||||
While this extension should run fine with older versions (it has
|
||||
been tested with 5.004_04), I work with Perl5.005 or higher,
|
||||
which has much more bugs fixed than the old 5.004.
|
||||
|
||||
When in doubt, upgrade.
|
||||
|
||||
GTK+, the X11 toolkit:
|
||||
http://www.gtk.org/
|
||||
ftp://ftp.gimp.org/pub/gtk/
|
||||
|
||||
gtk+-1.2 or higher is recommended, but older versions mostly
|
||||
work (some features not implemented in gtk+-1.0 do not work
|
||||
properly, of course).
|
||||
|
||||
Gtk, the perl extension for the above:
|
||||
ftp://ftp.gimp.org/pub/gtk/perl/
|
||||
|
||||
Gtk-0.5120 (or higher) is recommended. You might encounter some
|
||||
problems compiling it for Perl5.004 (or any version), in that
|
||||
case you might want to try the updated gnome-perl version on the
|
||||
gnome-cvs-server. See the the gimp-perl pages for more info.
|
||||
|
||||
The GNU Image Manipulation Program, i.e. The GIMP:
|
||||
http://www.gimp.org/
|
||||
ftp://ftp.gimp.org/pub/gimp/
|
||||
|
||||
gimp-1.1 (or newer, e.g. CVS or CVS snapshots) is recommended
|
||||
for full functionality, but any version since 1.0.2 should do,
|
||||
some features not implemented in 1.0 don't work, though.
|
||||
|
||||
PDL, the Perl Data Language
|
||||
http://www.cpan.org/
|
||||
|
||||
Optionally, you can install the PDL module to be able to
|
||||
manipulate pixel data (or to be able to run the example plug-ins
|
||||
that do pixel manipulation). PDL is available at any CPAN
|
||||
mirror, version 1.9906 or higher is recommended. Without PDL,
|
||||
some plug-ins do not work, and accessing raw image data is
|
||||
impossible.
|
||||
|
||||
INSTALLATION
|
||||
|
||||
On unix, you should be able to run "perl Makefile.PL" make, make
|
||||
test && make install. To get a listing of configuration options,
|
||||
enter
|
||||
|
||||
perl ./Makefile.PL --help
|
||||
|
||||
a straight "perl Makefile.PL" should do the job on most systems,
|
||||
but watch out for warnings. If everything went fine, enter "make",
|
||||
"make test", "make install".
|
||||
|
||||
After installation, these perl plug-ins should be visible from
|
||||
within the Gimp (and many, many more):
|
||||
|
||||
<Toolbox>/Xtns/Perl Control Center
|
||||
<Toolbox>/Xtns/Perl-Server
|
||||
<Image>/Filters/Artistic/Windify
|
||||
<Image>/Filters/Misc/Prepare for GIF
|
||||
<Image>/Filters/Misc/Webify
|
||||
|
||||
If you don't have unix, you can install linux instead
|
||||
(http://www.linux.org/)
|
||||
|
||||
OVERWRITING INSTALL LOCATIONS (PREFIX)
|
||||
|
||||
In the rare case that you want to install the Gimp-Perl modules
|
||||
somewhere else than in the standard location then there is a
|
||||
standard way to accomplish this.
|
||||
|
||||
Usually, you can just use the PREFIX=/path option to the
|
||||
Makefile.PL, or the other common solution of adding the INST* path
|
||||
definitions onto the "make install" commandline.
|
||||
|
||||
These options are described in the "perldoc ExtUtils::MakeMaker"
|
||||
manpage.
|
||||
|
||||
If you are configuring the gimp-pelr module that comes with the
|
||||
Gimp sourcetree this won't work. In that case you can set the
|
||||
environment variable:
|
||||
|
||||
PERL_MM_OPT='whatever options you want to pass to MakeMaker'
|
||||
|
||||
before running configure. The arguments that you put into that
|
||||
variable will be passed to the Makefile.PL as if given on the
|
||||
commandline.
|
||||
|
||||
SUPPORT/MAILING LISTS/MORE INFO
|
||||
|
||||
There is a mailinglist for general discussion about Gimp-Perl. To
|
||||
subscribe, send a mail with the single line
|
||||
|
||||
subscribe
|
||||
|
||||
to gimp-perl-request@lists.netcentral.net.
|
||||
|
||||
If you want to get notified of new versions automatically, send a
|
||||
mail with the single line:
|
||||
|
||||
subscribe notify-gimp
|
||||
|
||||
to majordomo@gcc.ml.org.
|
||||
|
||||
You can also upload your scripts to the gimp registry at
|
||||
http://registry.gimp.org/, part of it is dedicated to gimp-perl.
|
||||
|
||||
BLURB
|
||||
|
||||
Scheme is the crappiest language ever. Have a look at Haskell
|
||||
(http://www.haskell.org) to see how functional is done right.
|
||||
|
||||
LICENSE
|
||||
|
||||
The gimp-perl module is currently available under the GNU Public
|
||||
License (see COPYING.GPL for details) and the Artistic License (see
|
||||
COPYING.Artistic for details). Many of the scripts in the example
|
||||
section follow these rules, but some of them have a different
|
||||
licensing approach, please consult their source for more info.
|
||||
|
||||
THREATS
|
||||
|
||||
Future versions of this package might be distributed under the
|
||||
terms of the GPL only, to be consistent with the rest of the
|
||||
Gimp. Andreas keeps me from doing this, though.
|
||||
|
||||
|
||||
(c)1998,1999 Marc Lehmann <pcg@goof.com>
|
||||
|
|
@ -1,6 +1,11 @@
|
|||
Revision history for Gimp-Perl extension.
|
||||
|
||||
- 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
|
||||
available.
|
||||
- implemented PF_FILE, for selecting filesystem objects.
|
||||
- improved and fixed parasite support.
|
||||
- Gimp::Data now uses parasites when available.
|
||||
|
||||
1.07 Mon Mar 15 01:27:05 CET 1999
|
||||
- added examples/yinyang, examples/image_tile, examples/stamps.
|
||||
|
|
|
@ -43,7 +43,8 @@ $VERSION = 1.071;
|
|||
SHARPEN SQUARE STATUS_CALLING_ERROR STATUS_EXECUTION_ERROR
|
||||
STATUS_PASS_THROUGH STATUS_SUCCESS SUBTRACT_MODE TRANS_IMAGE_FILL
|
||||
VALUE_MODE DIVIDE_MODE PARASITE_PERSISTANT WHITE_IMAGE_FILL
|
||||
SPIRAL_CLOCKWISE SPIRAL_ANTICLOCKWISE
|
||||
SPIRAL_CLOCKWISE SPIRAL_ANTICLOCKWISE PARASITE_ATTACH_PARENT
|
||||
PARASITE_PARENT_PERSISTENT PARASITE_GRANDPARENT_PERSISTENT PARASITE_ATTACH_GRANDPARENT
|
||||
|
||||
TRACE_NONE TRACE_CALL TRACE_TYPE TRACE_NAME TRACE_DESC
|
||||
TRACE_ALL
|
||||
|
@ -528,9 +529,16 @@ package Gimp::Parasite;
|
|||
|
||||
sub is_type($$) { $_[0]->[0] eq $_[1] }
|
||||
sub is_persistant($) { $_[0]->[1] & PARASITE_PERSISTANT }
|
||||
sub is_error($) { $_[0]->is_type("error") }
|
||||
sub error($) { ["error", 0, ""] }
|
||||
sub is_error($) { !defined $_[0] }
|
||||
sub has_flag($$) { $_[0]->[1] & $_[1] }
|
||||
sub error($) { undef }
|
||||
sub copy($) { [@{$_[0]}] }
|
||||
sub name($) { $_[0]->[0] }
|
||||
sub flags($) { $_[0]->[1] }
|
||||
sub data($) { $_[0]->[2] }
|
||||
sub compare($$) { $_[0]->[0] eq $_[1]->[0] and
|
||||
$_[0]->[1] eq $_[1]->[1] and
|
||||
$_[0]->[2] eq $_[1]->[2] }
|
||||
|
||||
package Gimp; # for __DATA__
|
||||
|
||||
|
|
|
@ -140,6 +140,10 @@ BOOT:
|
|||
#if GIMP_PARASITE
|
||||
newCONSTSUB(stash,"PARAM_PARASITE",newSViv(PARAM_PARASITE));
|
||||
newCONSTSUB(stash,"PARASITE_PERSISTENT",newSViv(PARASITE_PERSISTENT));
|
||||
newCONSTSUB(stash,"PARASITE_PARENT_PERSISTENT",newSViv(PARASITE_PARENT_PERSISTENT));
|
||||
newCONSTSUB(stash,"PARASITE_GRANDPARENT_PERSISTENT",newSViv(PARASITE_GRANDPARENT_PERSISTENT));
|
||||
newCONSTSUB(stash,"PARASITE_ATTACH_PARENT",newSViv(PARASITE_ATTACH_PARENT));
|
||||
newCONSTSUB(stash,"PARASITE_ATTACH_GRANDPARENT",newSViv(PARASITE_ATTACH_PARENT));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -2,20 +2,27 @@ package Gimp::Data;
|
|||
|
||||
use strict;
|
||||
use Carp;
|
||||
use Tie::Hash;
|
||||
use Gimp qw();
|
||||
use Exporter ();
|
||||
use vars qw(@EXPORT @ISA);
|
||||
use base qw(Tie::StdHash Exporter);
|
||||
|
||||
@EXPORT = qw();
|
||||
sub TIEHASH {
|
||||
my $pkg = shift;
|
||||
my $self;
|
||||
|
||||
bless \$self, $pkg;
|
||||
}
|
||||
|
||||
sub FETCH {
|
||||
Gimp->gimp_get_data ($_[1]);
|
||||
eval { Gimp->find_parasite ($_[1])->data }
|
||||
|| $@ ? Gimp->get_data ($_[1]) : ();
|
||||
}
|
||||
|
||||
sub STORE {
|
||||
Gimp->gimp_set_data ($_[1], $_[2]);
|
||||
eval { Gimp->attach_parasite ([$_[1], Gimp::PARASITE_PERSISTENT, $_[2]]) };
|
||||
Gimp->set_data ($_[1], $_[2]) if $@;
|
||||
}
|
||||
|
||||
sub EXISTS {
|
||||
$_[0]->FETCH ? 1 : ();
|
||||
}
|
||||
|
||||
tie (%Gimp::Data, 'Gimp::Data');
|
||||
|
@ -47,14 +54,19 @@ values again (L<Gimp::Fu> does this already).
|
|||
=head1 %Gimp::Data
|
||||
|
||||
You can store and retrieve anything you like in this hash. It's contents
|
||||
will automatically be stored in Gimp, and can be accessed in later invocations
|
||||
of your plug-in. Be aware that other plug-ins store data in the same "hash", so
|
||||
better prefix your key with something unique, like your plug-in's name.
|
||||
will automatically be stored in Gimp, and can be accessed in later
|
||||
invocations of your plug-in. Be aware that other plug-ins store data
|
||||
in the same "hash", so better prefix your key with something unique,
|
||||
like your plug-in's name. As an example, the Gimp::Fu module uses
|
||||
"function_name/_fu_data" to store its data.
|
||||
|
||||
This module might use a persistant implementation, i.e. your data might
|
||||
survive a restart of the Gimp application, but you cannot count on this.
|
||||
|
||||
=head1 LIMITATIONS
|
||||
|
||||
You cannot store references, and you cannot iterate through
|
||||
the keys (with C<keys>, C<values> or C<each>).
|
||||
You cannot store references, and you cannot (yet) iterate through the keys
|
||||
(with C<keys>, C<values> or C<each>).
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ my($gtk,$gtk_10,$gtk_11);
|
|||
sub _check_gtk {
|
||||
return if defined $gtk;
|
||||
|
||||
eval { require Gtk }; $gtk = $@ eq "";
|
||||
eval { require Gtk }; $gtk = $@ eq "" && $Gtk::VERSION>=0.3;
|
||||
|
||||
if ($gtk) {
|
||||
$gtk_10 = (Gtk->major_version==1 && Gtk->minor_version==0);
|
||||
|
|
|
@ -4,9 +4,8 @@ use strict 'vars';
|
|||
use Carp;
|
||||
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK @EXPORT_FAIL %EXPORT_TAGS
|
||||
@scripts @_params $run_mode %pf_type2string @image_params);
|
||||
use Gimp qw(:param);
|
||||
use Gimp qw();
|
||||
use Gimp::Data;
|
||||
use File::Basename;
|
||||
use base qw(Exporter);
|
||||
|
||||
require Exporter;
|
||||
|
@ -70,28 +69,29 @@ module after the C<Gimp> module.
|
|||
|
||||
=cut
|
||||
|
||||
sub PF_INT8 () { PARAM_INT8 };
|
||||
sub PF_INT16 () { PARAM_INT16 };
|
||||
sub PF_INT32 () { PARAM_INT32 };
|
||||
sub PF_FLOAT () { PARAM_FLOAT };
|
||||
sub PF_STRING () { PARAM_STRING };
|
||||
sub PF_COLOR () { PARAM_COLOR };
|
||||
sub PF_COLOUR () { PARAM_COLOR };
|
||||
sub PF_IMAGE () { PARAM_IMAGE };
|
||||
sub PF_LAYER () { PARAM_LAYER };
|
||||
sub PF_CHANNEL () { PARAM_CHANNEL };
|
||||
sub PF_DRAWABLE () { PARAM_DRAWABLE };
|
||||
sub PF_INT8 () { Gimp::PARAM_INT8 };
|
||||
sub PF_INT16 () { Gimp::PARAM_INT16 };
|
||||
sub PF_INT32 () { Gimp::PARAM_INT32 };
|
||||
sub PF_FLOAT () { Gimp::PARAM_FLOAT };
|
||||
sub PF_STRING () { Gimp::PARAM_STRING };
|
||||
sub PF_COLOR () { Gimp::PARAM_COLOR };
|
||||
sub PF_COLOUR () { Gimp::PARAM_COLOR };
|
||||
sub PF_IMAGE () { Gimp::PARAM_IMAGE };
|
||||
sub PF_LAYER () { Gimp::PARAM_LAYER };
|
||||
sub PF_CHANNEL () { Gimp::PARAM_CHANNEL};
|
||||
sub PF_DRAWABLE () { Gimp::PARAM_DRAWABLE};
|
||||
|
||||
sub PF_TOGGLE () { PARAM_END+1 };
|
||||
sub PF_SLIDER () { PARAM_END+2 };
|
||||
sub PF_FONT () { PARAM_END+3 };
|
||||
sub PF_SPINNER () { PARAM_END+4 };
|
||||
sub PF_ADJUSTMENT(){ PARAM_END+5 }; # compatibility fix for script-fu _ONLY_
|
||||
sub PF_BRUSH () { PARAM_END+6 };
|
||||
sub PF_PATTERN () { PARAM_END+7 };
|
||||
sub PF_GRADIENT () { PARAM_END+8 };
|
||||
sub PF_RADIO () { PARAM_END+9 };
|
||||
sub PF_CUSTOM () { PARAM_END+10 };
|
||||
sub PF_TOGGLE () { Gimp::PARAM_END+1 };
|
||||
sub PF_SLIDER () { Gimp::PARAM_END+2 };
|
||||
sub PF_FONT () { Gimp::PARAM_END+3 };
|
||||
sub PF_SPINNER () { Gimp::PARAM_END+4 };
|
||||
sub PF_ADJUSTMENT(){ Gimp::PARAM_END+5 }; # compatibility fix for script-fu _ONLY_
|
||||
sub PF_BRUSH () { Gimp::PARAM_END+6 };
|
||||
sub PF_PATTERN () { Gimp::PARAM_END+7 };
|
||||
sub PF_GRADIENT () { Gimp::PARAM_END+8 };
|
||||
sub PF_RADIO () { Gimp::PARAM_END+9 };
|
||||
sub PF_CUSTOM () { Gimp::PARAM_END+10 };
|
||||
sub PF_FILE () { Gimp::PARAM_END+11 };
|
||||
|
||||
sub PF_BOOL () { PF_TOGGLE };
|
||||
sub PF_INT () { PF_INT32 };
|
||||
|
@ -116,17 +116,17 @@ sub Gimp::RUN_FULLINTERACTIVE (){ Gimp::RUN_INTERACTIVE+100 }; # you don't want
|
|||
&PF_ADJUSTMENT => 'integer',
|
||||
&PF_RADIO => 'string',
|
||||
&PF_CUSTOM => 'string',
|
||||
&PF_FILE => 'string',
|
||||
&PF_IMAGE => 'NYI',
|
||||
&PF_LAYER => 'NYI',
|
||||
&PF_CHANNEL => 'NYI',
|
||||
&PF_DRAWABLE => 'NYI',
|
||||
);
|
||||
|
||||
@_params=qw(PF_INT8 PF_INT16 PF_INT32 PF_FLOAT PF_VALUE
|
||||
PF_STRING PF_COLOR PF_COLOUR PF_TOGGLE PF_IMAGE
|
||||
PF_DRAWABLE PF_FONT PF_LAYER PF_CHANNEL PF_BOOL
|
||||
PF_SLIDER PF_INT PF_SPINNER PF_ADJUSTMENT
|
||||
PF_BRUSH PF_PATTERN PF_GRADIENT PF_RADIO PF_CUSTOM);
|
||||
@_params=qw(PF_INT8 PF_INT16 PF_INT32 PF_FLOAT PF_VALUE PF_STRING PF_COLOR
|
||||
PF_COLOUR PF_TOGGLE PF_IMAGE PF_DRAWABLE PF_FONT PF_LAYER
|
||||
PF_CHANNEL PF_BOOL PF_SLIDER PF_INT PF_SPINNER PF_ADJUSTMENT
|
||||
PF_BRUSH PF_PATTERN PF_GRADIENT PF_RADIO PF_CUSTOM PF_FILE);
|
||||
|
||||
@EXPORT = (qw(register main),@_params);
|
||||
@EXPORT_OK = qw(interact $run_mode save_image);
|
||||
|
@ -196,7 +196,7 @@ sub help_window(\$$$) {
|
|||
$$helpwin->show_all();
|
||||
}
|
||||
|
||||
sub interact($$$@) {
|
||||
sub interact($$$$@) {
|
||||
local $^W=0;
|
||||
my($function)=shift;
|
||||
my($blurb)=shift;
|
||||
|
@ -213,9 +213,15 @@ sub interact($$$@) {
|
|||
require Gtk; import Gtk;
|
||||
init Gtk; # gross hack...
|
||||
};
|
||||
|
||||
if ($@) {
|
||||
Gimp::logger(message => 'the gtk perl module is required to run in interactive mode', function => $function);
|
||||
die "The Gtk perl module is required to run this function ($function) in interactive mode!\n";
|
||||
my @res = map {
|
||||
die "the gtk perl module is required to run\nthis plug-in in interactive mode\n" unless defined $_->[3];
|
||||
$_->[3];
|
||||
} @types;
|
||||
Gimp::logger(message => "the gtk perl module is required to open a dialog\nwindow, running with default values",
|
||||
fatal => 1, function => $function);
|
||||
return (1,@res);
|
||||
}
|
||||
|
||||
parse Gtk::Rc Gimp->gtkrc;
|
||||
|
@ -247,11 +253,12 @@ sub interact($$$@) {
|
|||
my($value)=shift;
|
||||
|
||||
local *new_PF_STRING = sub {
|
||||
$a=new Gtk::Entry;
|
||||
set_usize $a 0,25;
|
||||
push(@setvals,sub{set_text $a defined $_[0] ? $_[0] : ""});
|
||||
#select_region $a 0,1;
|
||||
push(@getvals,sub{get_text $a});
|
||||
my $e = new Gtk::Entry;
|
||||
set_usize $e 0,25;
|
||||
push(@setvals,sub{set_text $e defined $_[0] ? $_[0] : ""});
|
||||
#select_region $e 0,1;
|
||||
push(@getvals,sub{get_text $e});
|
||||
$a=$e;
|
||||
};
|
||||
|
||||
if($type == PF_ADJUSTMENT) { # support for scm2perl
|
||||
|
@ -437,6 +444,18 @@ sub interact($$$@) {
|
|||
push(@setvals,$widget[1]);
|
||||
push(@getvals,$widget[2]);
|
||||
|
||||
} elsif($type == PF_FILE) {
|
||||
&new_PF_STRING;
|
||||
my $s = $a;
|
||||
$a = new Gtk::HBox 0,5;
|
||||
$a->add ($s);
|
||||
my $b = new Gtk::Button "Browse";
|
||||
$a->add ($b);
|
||||
my $f = new Gtk::FileSelection $desc;
|
||||
$b->signal_connect (clicked => sub { $f->set_filename ($s->get_text); $f->show_all });
|
||||
$f->ok_button ->signal_connect (clicked => sub { $f->hide; $s->set_text ($f->get_filename) });
|
||||
$f->cancel_button->signal_connect (clicked => sub { $f->hide });
|
||||
|
||||
} else {
|
||||
$label="Unsupported argumenttype $type";
|
||||
push(@setvals,sub{});
|
||||
|
@ -538,6 +557,7 @@ sub string2pf($$) {
|
|||
|| $type==PF_PATTERN
|
||||
|| $type==PF_BRUSH
|
||||
|| $type==PF_CUSTOM
|
||||
|| $type==PF_FILE
|
||||
|| $type==PF_RADIO # for now! #d#
|
||||
|| $type==PF_GRADIENT) {
|
||||
$s;
|
||||
|
@ -654,16 +674,17 @@ sub query {
|
|||
Gimp->gimp_install_procedure($function,$blurb,$help,$author,$copyright,$date,
|
||||
$menupath,$imagetypes,$type,
|
||||
[map {
|
||||
$_->[0]=PARAM_INT32 if $_->[0] == PF_TOGGLE;
|
||||
$_->[0]=PARAM_INT32 if $_->[0] == PF_SLIDER;
|
||||
$_->[0]=PARAM_INT32 if $_->[0] == PF_SPINNER;
|
||||
$_->[0]=PARAM_INT32 if $_->[0] == PF_ADJUSTMENT;
|
||||
$_->[0]=PARAM_INT32 if $_->[0] == PF_RADIO;
|
||||
$_->[0]=PARAM_STRING if $_->[0] == PF_FONT;
|
||||
$_->[0]=PARAM_STRING if $_->[0] == PF_BRUSH;
|
||||
$_->[0]=PARAM_STRING if $_->[0] == PF_PATTERN;
|
||||
$_->[0]=PARAM_STRING if $_->[0] == PF_GRADIENT;
|
||||
$_->[0]=PARAM_STRING if $_->[0] == PF_CUSTOM;
|
||||
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_TOGGLE;
|
||||
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_SLIDER;
|
||||
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_SPINNER;
|
||||
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_ADJUSTMENT;
|
||||
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_RADIO;
|
||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_FONT;
|
||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_BRUSH;
|
||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_PATTERN;
|
||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_GRADIENT;
|
||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_CUSTOM;
|
||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_FILE;
|
||||
$_;
|
||||
} @$params],
|
||||
$results);
|
||||
|
@ -865,6 +886,11 @@ While the values can be of any type (as long as it fits into a scalar),
|
|||
you should be prepared to get a string when the script is started from the
|
||||
commandline or via the PDB.
|
||||
|
||||
=item PF_FILE
|
||||
|
||||
This represents a file system object. It usually is a file, but can be
|
||||
anything (directory, link). It might not even exist at all.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
@ -896,7 +922,7 @@ sub register($$$$$$$$$;@) {
|
|||
if $function =~ y/-//;
|
||||
|
||||
if ($menupath=~/^<Image>\//) {
|
||||
@_ >= 2 or die "<Image> plug-in called without an image and drawable!\n";
|
||||
@_ >= 2 or die "<Image> plug-in called without both image and drawable arguments!\n";
|
||||
@pre = (shift,shift);
|
||||
} elsif ($menupath=~/^<Toolbox>\//) {
|
||||
# valid ;)
|
||||
|
@ -926,7 +952,7 @@ sub register($$$$$$$$$;@) {
|
|||
}
|
||||
} elsif ($run_mode == &Gimp::RUN_FULLINTERACTIVE) {
|
||||
my($res);
|
||||
($res,@_)=interact($function,$blurb,$help,[@image_params,@{$params}],[@pre,@_]);
|
||||
($res,@_)=interact($function,$blurb,$help,[@image_params,@$params],[@pre,@_]);
|
||||
undef @pre;
|
||||
return unless $res;
|
||||
} elsif ($run_mode == &Gimp::RUN_NONINTERACTIVE) {
|
||||
|
@ -970,6 +996,7 @@ sub register($$$$$$$$$;@) {
|
|||
}
|
||||
Gimp->displays_flush;
|
||||
|
||||
Gimp::set_trace ($old_trace);
|
||||
wantarray ? @imgs : $imgs[0];
|
||||
};
|
||||
push(@scripts,[$function,$blurb,$help,$author,$copyright,$date,
|
||||
|
|
|
@ -39,7 +39,6 @@ bootstrap Gimp::Lib $VERSION;
|
|||
|
||||
sub gimp_progress_init {
|
||||
push @_,-1 if @_<2;
|
||||
print "proggress_init yeah @_\n";
|
||||
eval { gimp_call_procedure "gimp_progress_init",@_ };
|
||||
gimp_call_procedure "gimp_progress_init",shift if $@;
|
||||
}
|
||||
|
|
|
@ -342,22 +342,27 @@ dump_params (int nparams, GParam *args, GParamDef *params)
|
|||
case PARAM_PARASITE:
|
||||
{
|
||||
gint32 found = 0;
|
||||
|
||||
trace_printf ("[%s, ", args[i].data.d_parasite.name);
|
||||
if (args[i].data.d_parasite.flags & PARASITE_PERSISTENT)
|
||||
{
|
||||
trace_printf ("PARASITE_PERSISTENT");
|
||||
found |= PARASITE_PERSISTENT;
|
||||
}
|
||||
|
||||
if (args[i].data.d_parasite.flags & ~found)
|
||||
{
|
||||
if (found)
|
||||
trace_printf ("|");
|
||||
trace_printf ("%d", args[i].data.d_parasite.flags & ~found);
|
||||
}
|
||||
|
||||
trace_printf (", %d bytes data]", args[i].data.d_parasite.size);
|
||||
|
||||
if (args[i].data.d_parasite.name)
|
||||
{
|
||||
trace_printf ("[%s, ", args[i].data.d_parasite.name);
|
||||
if (args[i].data.d_parasite.flags & PARASITE_PERSISTENT)
|
||||
{
|
||||
trace_printf ("PARASITE_PERSISTENT");
|
||||
found |= PARASITE_PERSISTENT;
|
||||
}
|
||||
|
||||
if (args[i].data.d_parasite.flags & ~found)
|
||||
{
|
||||
if (found)
|
||||
trace_printf ("|");
|
||||
trace_printf ("%d", args[i].data.d_parasite.flags & ~found);
|
||||
}
|
||||
|
||||
trace_printf (", %d bytes data]", args[i].data.d_parasite.size);
|
||||
}
|
||||
else
|
||||
trace_printf ("[undefined]");
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
@ -622,13 +627,17 @@ push_gimp_sv (GParam *arg, int array_as_ref)
|
|||
|
||||
#if GIMP_PARASITE
|
||||
case PARAM_PARASITE:
|
||||
{
|
||||
AV *av = newAV ();
|
||||
av_push (av, neuSVpv (arg->data.d_parasite.name));
|
||||
av_push (av, newSViv (arg->data.d_parasite.flags));
|
||||
av_push (av, newSVpv (arg->data.d_parasite.data, arg->data.d_parasite.size));
|
||||
sv = (SV *)av; /* no newRV_inc, since we're getting autoblessed! */
|
||||
}
|
||||
if (arg->data.d_parasite.name)
|
||||
{
|
||||
AV *av = newAV ();
|
||||
av_push (av, neuSVpv (arg->data.d_parasite.name ? arg->data.d_parasite.name : ""));
|
||||
av_push (av, newSViv (arg->data.d_parasite.flags));
|
||||
av_push (av, newSVpv (arg->data.d_parasite.data, arg->data.d_parasite.size));
|
||||
sv = (SV *)av; /* no newRV_inc, since we're getting autoblessed! */
|
||||
}
|
||||
else
|
||||
sv = newSVsv (&PL_sv_undef);
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package Gimp::UI;
|
||||
|
||||
use Carp;
|
||||
use Gimp;
|
||||
use Gimp qw();
|
||||
use Gtk;
|
||||
|
||||
$gtk_10 = Gtk->major_version==1 && Gtk->minor_version==0;
|
||||
|
|
|
@ -92,6 +92,29 @@ INSTALLATION
|
|||
If you don't have unix, you can install linux instead
|
||||
(http://www.linux.org/)
|
||||
|
||||
OVERWRITING INSTALL LOCATIONS (PREFIX)
|
||||
|
||||
In the rare case that you want to install the Gimp-Perl modules
|
||||
somewhere else than in the standard location then there is a
|
||||
standard way to accomplish this.
|
||||
|
||||
Usually, you can just use the PREFIX=/path option to the
|
||||
Makefile.PL, or the other common solution of adding the INST* path
|
||||
definitions onto the "make install" commandline.
|
||||
|
||||
These options are described in the "perldoc ExtUtils::MakeMaker"
|
||||
manpage.
|
||||
|
||||
If you are configuring the gimp-pelr module that comes with the
|
||||
Gimp sourcetree this won't work. In that case you can set the
|
||||
environment variable:
|
||||
|
||||
PERL_MM_OPT='whatever options you want to pass to MakeMaker'
|
||||
|
||||
before running configure. The arguments that you put into that
|
||||
variable will be passed to the Makefile.PL as if given on the
|
||||
commandline.
|
||||
|
||||
SUPPORT/MAILING LISTS/MORE INFO
|
||||
|
||||
There is a mailinglist for general discussion about Gimp-Perl. To
|
||||
|
|
|
@ -19,6 +19,8 @@ bugs
|
|||
|
||||
important issues
|
||||
|
||||
[PF_FILE] * PF_FILE
|
||||
* --use-interp=perl|script-fu
|
||||
* change set_usize to something else..
|
||||
* Gimp::IO (?)
|
||||
* Gimp::Fu import after Gimp? use Gimp::main for Gimp::Fu??
|
||||
|
|
|
@ -33,8 +33,8 @@ sub perl_fu_animate_cells {
|
|||
my $back = shift @ids;
|
||||
|
||||
if (@ids < 2) {
|
||||
gimp_message("animate_cells: Too few cells (layers) in image.");
|
||||
gimp_image_delete($image) if $makecopy;
|
||||
die "animate_cells: too few cells (layers) in image\n";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ register
|
|||
"Perform cell animation from a single, layered image",
|
||||
"Use this plugin to animate a series of layers in the same way that\
|
||||
a physical animation process would use cells.",
|
||||
"Aaron Sherman", "Aaron Sherman (c)", "1999-03-12",
|
||||
"Aaron Sherman", "Aaron Sherman (c)", "1999-03-15",
|
||||
"<Image>/Filters/Animation/Animate Cells",
|
||||
"*",
|
||||
[
|
||||
|
|
|
@ -29,7 +29,7 @@ sub blowinout {
|
|||
|
||||
# Create a grayscale workspace image for displacement map
|
||||
my $dm = gimp_image_new($xsize, $ysize, 1);
|
||||
eval { $dm->undo_push_group_start($dm) };
|
||||
eval { $dm->undo_push_group_start };
|
||||
# It needs to have 2 layers
|
||||
my $dmlayer = gimp_layer_new($dm, $xsize, $ysize, GRAY_IMAGE, "newlayer",
|
||||
100, NORMAL_MODE);
|
||||
|
|
|
@ -3,17 +3,18 @@
|
|||
use Gimp;
|
||||
use Gimp::Fu;
|
||||
|
||||
register "my_first_gimp_fu", # fill in a function name
|
||||
"My very first Gimp::Fu script", # and a short description,
|
||||
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!",
|
||||
"My name", # don't forget your name (author)
|
||||
"My name (my copyright)", # and your copyright!
|
||||
"19981006", # the date this script was written
|
||||
"<Toolbox>/Xtns/My Very First", # the menu path
|
||||
"*", # which image types do I accept (all)
|
||||
"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"],
|
||||
|
@ -35,21 +36,35 @@ register "my_first_gimp_fu", # fill in a function name
|
|||
# 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(-1);
|
||||
$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");
|
||||
|
||||
$img; # return the image, or undef
|
||||
# close the undo push group
|
||||
eval { $img->undo_push_group_end };
|
||||
|
||||
$img; # return the image, or an empty list, i.e. ()
|
||||
};
|
||||
|
||||
exit main;
|
||||
|
|
|
@ -435,7 +435,7 @@ register
|
|||
construct a single, existing image, sort of like the
|
||||
Filters/Artistic/Mosaic plugin, but with images as the
|
||||
tiles.",
|
||||
"Aaron Sherman", "Aaron Sherman (c)", "1999-03-13",
|
||||
"Aaron Sherman", "Aaron Sherman (c)", "1999-03-15",
|
||||
"<Image>/Filters/Map/Image Tile",
|
||||
"*",
|
||||
[
|
||||
|
@ -447,7 +447,7 @@ register
|
|||
[PF_INT32, "Number of sample cells per tile (X)", "X cells", 4],
|
||||
[PF_INT32, "Number of sample cells per tile (Y)", "Y cells", 4],
|
||||
[PF_INT32, "Duplicates (0[lots] - 100[none])", "Duplicates", 5],
|
||||
[PF_STRING, "Sub-image directories (space speparated)", "Directories","."],
|
||||
[PF_STRING, "Sub-image directories (space speparated)", "Directories"],
|
||||
[PF_TOGGLE, "Delete cached image samples?", "", 0]
|
||||
],
|
||||
\&perl_fu_image_tile;
|
||||
|
|
|
@ -162,12 +162,12 @@ sub tex_string_to_float {
|
|||
# register the script
|
||||
register "tex_string_to_float", "Turn a TeX-string into floating layer", "Takes a TeX string as input and creates a floating layer of the rendered string in the current layer in the foreground color.",
|
||||
"Dov Grobgeld <dov\@imagic.weizmann.ac.il>", "Dov Grobgeld",
|
||||
"1999-02-26",
|
||||
"1999-03-16",
|
||||
"<Image>/Filters/Render/TeX String",
|
||||
"*",
|
||||
[
|
||||
[PF_STRING, "Input file", "TeX macro file to input", ""],
|
||||
[PF_STRING, "TeX String", "Enter TeX String", ""],
|
||||
[PF_STRING, "Input file", "TeX macro file to input"],
|
||||
[PF_STRING, "TeX String", "Enter TeX String"],
|
||||
[PF_VALUE, "DPI", "Resolution to render the text in", "72"],
|
||||
[PF_VALUE, "Magstep", "TeX magstep", "2"],
|
||||
[PF_VALUE, "Anti-aliasing", "Anti-aliasing factor", "4"],
|
||||
|
|
Loading…
Reference in New Issue