see plug-ins/perl/Changes
This commit is contained in:
@ -2,6 +2,13 @@ Revision history for Gimp-Perl extension.
|
|||||||
|
|
||||||
- more errornous argument types are detected now, without
|
- more errornous argument types are detected now, without
|
||||||
just calling abort().
|
just calling abort().
|
||||||
|
- fixed a MAJOR namespace-leak: for example, if one used
|
||||||
|
gimp_parasite_list once, Gimp::Image->parasite_list would call
|
||||||
|
gimp_parasite_list and NOT gimp_image_parasite_list, as would be
|
||||||
|
correct.
|
||||||
|
- Gimp::Net now works correctly with parasites.
|
||||||
|
- added examples/parasite_editor
|
||||||
|
- added gimp_ prefix to Parasite-class
|
||||||
|
|
||||||
1.052 Tue Feb 9 18:16:15 CET 1999
|
1.052 Tue Feb 9 18:16:15 CET 1999
|
||||||
- moved the xlfd_size function from Gimp::Fu into Gimp
|
- moved the xlfd_size function from Gimp::Fu into Gimp
|
||||||
@ -416,9 +423,10 @@ Revision history for Gimp-Perl extension.
|
|||||||
|
|
||||||
0.80 Fri Feb 13 17:15:48 CET 1998
|
0.80 Fri Feb 13 17:15:48 CET 1998
|
||||||
- version 1.0 is the first one generally usable.. we're getting
|
- version 1.0 is the first one generally usable.. we're getting
|
||||||
- close! Gimp::Net and Gimp::Lib are only internal modules, there
|
close!
|
||||||
is not much of a distinction between networked modules and modules
|
- Gimp::Net and Gimp::Lib are only internal modules, there is not
|
||||||
using libgimp!
|
much of a distinction between networked modules and modules
|
||||||
|
using libgimp!
|
||||||
- Gimp::OO usable over the network.
|
- Gimp::OO usable over the network.
|
||||||
|
|
||||||
0.07 Thu Feb 12 06:51:56 CET 1998
|
0.07 Thu Feb 12 06:51:56 CET 1998
|
||||||
|
@ -345,18 +345,19 @@ sub AUTOLOAD {
|
|||||||
goto &$AUTOLOAD;
|
goto &$AUTOLOAD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
# for performance reasons: supply a DESTROY method
|
||||||
|
if($name eq "DESTROY") {
|
||||||
|
*{$AUTOLOAD} = sub {};
|
||||||
|
return;
|
||||||
|
}
|
||||||
croak "function/macro \"$name\" not found in $class";
|
croak "function/macro \"$name\" not found in $class";
|
||||||
}
|
}
|
||||||
|
|
||||||
# FIXME: why is this necessary? try to understand, hard!
|
|
||||||
sub DESTROY {
|
|
||||||
}
|
|
||||||
|
|
||||||
sub _pseudoclass {
|
sub _pseudoclass {
|
||||||
my ($class, @prefixes)= @_;
|
my ($class, @prefixes)= @_;
|
||||||
unshift(@prefixes,"");
|
unshift(@prefixes,"");
|
||||||
|
*{"Gimp::${class}::AUTOLOAD"} = \&AUTOLOAD;
|
||||||
push(@{"${class}::ISA"} , "Gimp::${class}");
|
push(@{"${class}::ISA"} , "Gimp::${class}");
|
||||||
push(@{"Gimp::${class}::ISA"} , 'Gimp');
|
|
||||||
push(@{"Gimp::${class}::PREFIXES"} , @prefixes); @prefixes=@{"Gimp::${class}::PREFIXES"};
|
push(@{"Gimp::${class}::PREFIXES"} , @prefixes); @prefixes=@{"Gimp::${class}::PREFIXES"};
|
||||||
push(@{"${class}::PREFIXES"} , @prefixes); @prefixes=@{"${class}::PREFIXES"};
|
push(@{"${class}::PREFIXES"} , @prefixes); @prefixes=@{"${class}::PREFIXES"};
|
||||||
}
|
}
|
||||||
@ -372,7 +373,7 @@ _pseudoclass qw(Gradients gimp_gradients_);
|
|||||||
_pseudoclass qw(Edit gimp_edit_);
|
_pseudoclass qw(Edit gimp_edit_);
|
||||||
_pseudoclass qw(Progress gimp_progress_);
|
_pseudoclass qw(Progress gimp_progress_);
|
||||||
_pseudoclass qw(Region );
|
_pseudoclass qw(Region );
|
||||||
_pseudoclass qw(Parasite parasite_);
|
_pseudoclass qw(Parasite parasite_ gimp_);
|
||||||
|
|
||||||
# "C"-Classes
|
# "C"-Classes
|
||||||
_pseudoclass qw(GDrawable gimp_drawable_);
|
_pseudoclass qw(GDrawable gimp_drawable_);
|
||||||
@ -415,7 +416,7 @@ sub DESTROY {
|
|||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->{_drawable}->{_id}->update($self->{_x},$self->{_y},$self->{_w},$self->{_h})
|
$self->{_drawable}->{_id}->update($self->{_x},$self->{_y},$self->{_w},$self->{_h})
|
||||||
if $self->{_dirty};
|
if $self->{_dirty};
|
||||||
}
|
};
|
||||||
|
|
||||||
package Gimp::Parasite;
|
package Gimp::Parasite;
|
||||||
|
|
||||||
@ -425,8 +426,6 @@ sub is_error($) { $_[0]->is_type("error") }
|
|||||||
sub error($) { ["error", 0, ""] }
|
sub error($) { ["error", 0, ""] }
|
||||||
sub copy($) { [@{$_[0]}] }
|
sub copy($) { [@{$_[0]}] }
|
||||||
|
|
||||||
sub DESTROY {}
|
|
||||||
|
|
||||||
package Gimp; # for __DATA__
|
package Gimp; # for __DATA__
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -294,7 +294,7 @@ sub interact($$$@) {
|
|||||||
# signal_connect $c "clicked", sub {$res = 2; main_quit Gtk};
|
# signal_connect $c "clicked", sub {$res = 2; main_quit Gtk};
|
||||||
## $g->attach($c,1,2,$res,$res+1,{},{},4,2);
|
## $g->attach($c,1,2,$res,$res+1,{},{},4,2);
|
||||||
# $a->pack_start ($c,1,1,0);
|
# $a->pack_start ($c,1,1,0);
|
||||||
# set_tip $t $c,"Load an image into the Gimp (NYI)";
|
# set_tip $t $c,"Load an image into the Gimp";
|
||||||
|
|
||||||
} elsif($type == PF_LAYER) {
|
} elsif($type == PF_LAYER) {
|
||||||
my $res;
|
my $res;
|
||||||
@ -589,10 +589,10 @@ sub query {
|
|||||||
=item function name
|
=item function name
|
||||||
|
|
||||||
The pdb name of the function, i.e. the name under which is will be
|
The pdb name of the function, i.e. the name under which is will be
|
||||||
registered in the Gimp database. If it doesn't start with "perl_fu_" it will
|
registered in the Gimp database. If it doesn't start with "perl_fu_",
|
||||||
be prepended. If you don't want this, prefix your fucntion name with a
|
"plug_in_" or "extension_", it will be prepended. If you don't want this,
|
||||||
single "+". The idea here is that every Gimp::Fu plug-in will be found under
|
prefix your function name with a single "+". The idea here is that every
|
||||||
the common C<perl_fu_>-prefix.
|
Gimp::Fu plug-in will be found under the common C<perl_fu_>-prefix.
|
||||||
|
|
||||||
=item blurb
|
=item blurb
|
||||||
|
|
||||||
@ -740,7 +740,7 @@ sub register($$$$$$$$$;@) {
|
|||||||
int($p->[0]) eq $p->[0] or croak "Argument/return value '$p->[1]' has illegal type '$p->[0]'";
|
int($p->[0]) eq $p->[0] or croak "Argument/return value '$p->[1]' has illegal type '$p->[0]'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$function="perl_fu_".$function unless $function=~/^perl_fu/ || $function=~s/^\+//;
|
$function="perl_fu_".$function unless $function=~/^(?:perl_fu|extension|plug_in)/ || $function=~s/^\+//;
|
||||||
|
|
||||||
*$function = sub {
|
*$function = sub {
|
||||||
$run_mode=shift; # global!
|
$run_mode=shift; # global!
|
||||||
@ -931,7 +931,7 @@ sub print_switches {
|
|||||||
my $this=this_script;
|
my $this=this_script;
|
||||||
print <<EOF;
|
print <<EOF;
|
||||||
interface-arguments are
|
interface-arguments are
|
||||||
-o | --output <filespec> write image to disk, then delete (NYI)
|
-o | --output <filespec> write image to disk, then delete
|
||||||
-i | --interact let the user edit the values first
|
-i | --interact let the user edit the values first
|
||||||
script-arguments are
|
script-arguments are
|
||||||
EOF
|
EOF
|
||||||
|
@ -42,7 +42,7 @@ sub net2args($) {
|
|||||||
sub args2net {
|
sub args2net {
|
||||||
my($res,$v);
|
my($res,$v);
|
||||||
for $v (@_) {
|
for $v (@_) {
|
||||||
if(ref($v) eq "ARRAY" or ref($v) eq "Gimp::Color") {
|
if(ref($v) eq "ARRAY" or ref($v) eq "Gimp::Color" or ref($v) eq "Gimp::Parasite") {
|
||||||
$res.="[".join(",",map { "qq[".quotemeta($_)."]" } @$v)."],";
|
$res.="[".join(",",map { "qq[".quotemeta($_)."]" } @$v)."],";
|
||||||
} elsif(ref($v)) {
|
} elsif(ref($v)) {
|
||||||
$res.="b(".$$v.",".ref($v)."),";
|
$res.="b(".$$v.",".ref($v)."),";
|
||||||
|
@ -191,6 +191,7 @@ that are checked are shown as well (the null prefix "" is implicit).
|
|||||||
=item Parasite
|
=item Parasite
|
||||||
|
|
||||||
parasite_
|
parasite_
|
||||||
|
gimp_
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
@ -55,3 +55,4 @@ examples/view3d.pl
|
|||||||
examples/feedback.pl
|
examples/feedback.pl
|
||||||
examples/xachlego.pl
|
examples/xachlego.pl
|
||||||
examples/xachshadow.pl
|
examples/xachshadow.pl
|
||||||
|
examples/parasite-editor
|
||||||
|
@ -116,7 +116,7 @@ EOF
|
|||||||
|
|
||||||
@examples =
|
@examples =
|
||||||
qw(windy.pl prep4gif.pl webify.pl PDB alpha2color.pl tex-to-float ditherize.pl
|
qw(windy.pl prep4gif.pl webify.pl PDB alpha2color.pl tex-to-float ditherize.pl
|
||||||
border.pl view3d.pl feedback.pl xachlego.pl xachshadow.pl);
|
border.pl view3d.pl feedback.pl xachlego.pl xachshadow.pl parasite-editor);
|
||||||
@shebang = (map("examples/$_",@examples),
|
@shebang = (map("examples/$_",@examples),
|
||||||
qw(Perl-Server scm2perl scm2scm examples/example-net.pl));
|
qw(Perl-Server scm2perl scm2scm examples/example-net.pl));
|
||||||
|
|
||||||
|
198
plug-ins/perl/examples/parasite-editor
Executable file
198
plug-ins/perl/examples/parasite-editor
Executable file
@ -0,0 +1,198 @@
|
|||||||
|
#!/usr/app/bin/perl
|
||||||
|
|
||||||
|
#BEGIN {$^W=1};
|
||||||
|
|
||||||
|
require 5.005;
|
||||||
|
|
||||||
|
use Gimp ();
|
||||||
|
use Gimp::Fu;
|
||||||
|
use Gtk;
|
||||||
|
|
||||||
|
Gtk->init;
|
||||||
|
|
||||||
|
$gtk_10 = Gtk->major_version==1 && Gtk->minor_version==0;
|
||||||
|
|
||||||
|
#Gimp::set_trace(TRACE_ALL);
|
||||||
|
|
||||||
|
my $window; # the main window
|
||||||
|
my $current;
|
||||||
|
my $list_func, $find_func, $attach_func, $detach_func;
|
||||||
|
my $clist;
|
||||||
|
my $name, $flags, $data, $data2;
|
||||||
|
|
||||||
|
sub escape {
|
||||||
|
join ("", map {
|
||||||
|
(ord($_) & 127) > 31 ? $_ : sprintf "\\x%02x",ord($_);
|
||||||
|
} split //, shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub deserialize {
|
||||||
|
local $_ = shift;
|
||||||
|
my $res;
|
||||||
|
eval {
|
||||||
|
while (length ($_)) {
|
||||||
|
my $type = unpack ("C", substr $_,0,1,"");
|
||||||
|
if ($type == 0) {
|
||||||
|
$res.="END";
|
||||||
|
last;
|
||||||
|
} elsif ($type == 1) {
|
||||||
|
$res.="INT8 ".(unpack ("C", substr $_,0,1,""));
|
||||||
|
} elsif ($type == 2) {
|
||||||
|
$res.="INT16 ".(unpack ("n", substr $_,0,2,""));
|
||||||
|
} elsif ($type == 3) {
|
||||||
|
$res.="INT32 ".(unpack ("N", substr $_,0,4,""));
|
||||||
|
} elsif ($type == 101) {
|
||||||
|
$res.="INT32 ".(unpack ("N", substr $_,0,4,""));
|
||||||
|
} else {
|
||||||
|
die "unknown serialize type\n";
|
||||||
|
}
|
||||||
|
print "RES: $res\n";
|
||||||
|
print "Type = $type\n";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$@ ? $@ : $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub refresh_names {
|
||||||
|
$clist->clear_items(0,99999);
|
||||||
|
my @list = &$list_func($current);
|
||||||
|
for my $parasite (@list) {
|
||||||
|
my $item = new Gtk::ListItem $parasite;
|
||||||
|
$item->signal_connect ("select" => sub {
|
||||||
|
my ($par) = &$find_func($current,$parasite);
|
||||||
|
$name->set_text ($par->[0]);
|
||||||
|
$flags->set_text (sprintf "0x%08x", $par->[1]);
|
||||||
|
$data->set_text (escape $par->[2]);
|
||||||
|
$data2->set_text (deserialize $par->[2]);
|
||||||
|
});
|
||||||
|
$clist->add($item);
|
||||||
|
}
|
||||||
|
$clist->show_all;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub create_main {
|
||||||
|
my $b;
|
||||||
|
my $t;
|
||||||
|
|
||||||
|
parse Gtk::Rc Gimp->gtkrc;
|
||||||
|
|
||||||
|
$t = new Gtk::Tooltips;
|
||||||
|
my $w = new Gtk::Dialog;
|
||||||
|
$window = $w;
|
||||||
|
$w->set_usize (500,220);
|
||||||
|
|
||||||
|
$w->set_title('Parasite Editor');
|
||||||
|
$w->signal_connect("destroy",sub {main_quit Gtk});
|
||||||
|
|
||||||
|
$b = new Gtk::Button "Close";
|
||||||
|
$w->action_area->add($b);
|
||||||
|
$b->signal_connect("clicked",sub {main_quit Gtk});
|
||||||
|
|
||||||
|
my $v = new Gtk::VBox (0,5);
|
||||||
|
$w->vbox->add ($v);
|
||||||
|
|
||||||
|
my $top = new Gtk::HBox (0,5);
|
||||||
|
$v->add($top);
|
||||||
|
my $bot = new Gtk::HBox (0,5);
|
||||||
|
$v->add($bot);
|
||||||
|
|
||||||
|
$clist = new Gtk::List;
|
||||||
|
|
||||||
|
my $cs = new Gtk::ScrolledWindow undef,undef;
|
||||||
|
$cs->set_policy(-automatic,-automatic);
|
||||||
|
$gtk_10 ? $cs->add ($clist) : $cs->add_with_viewport ($clist);
|
||||||
|
$bot->add ($cs);
|
||||||
|
|
||||||
|
my $parbox = new Gtk::VBox (0,5);
|
||||||
|
$bot->add ($parbox);
|
||||||
|
$parbox->add ($name = new Gtk::Entry);
|
||||||
|
$parbox->add ($flags = new Gtk::Entry);
|
||||||
|
$parbox->add ($data = new Gtk::Entry);
|
||||||
|
$parbox->add ($data2 = new Gtk::Entry);
|
||||||
|
|
||||||
|
{
|
||||||
|
my $menu = new Gtk::Menu;
|
||||||
|
my $item;
|
||||||
|
my $subtype = new Gtk::OptionMenu;
|
||||||
|
|
||||||
|
my $set_submenu = sub {
|
||||||
|
my $submenu = new Gtk::Menu;
|
||||||
|
for(@_) {
|
||||||
|
my $cur = $_->[0];
|
||||||
|
my $item = new Gtk::MenuItem $_->[1];
|
||||||
|
$item->signal_connect ("activate" => sub { $current = $cur; refresh_names });
|
||||||
|
$submenu->append ($item);
|
||||||
|
}
|
||||||
|
$subtype->set_menu($submenu);
|
||||||
|
$submenu->show_all;
|
||||||
|
if(@_) {
|
||||||
|
$submenu->get_active->signal_emit("activate");
|
||||||
|
} else {
|
||||||
|
undef $current;
|
||||||
|
refresh_names;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$item = new Gtk::MenuItem "Global";
|
||||||
|
my $act_global = sub {
|
||||||
|
$list_func = sub { Gimp->parasite_list };
|
||||||
|
$find_func = sub { shift; Gimp->find_parasite (shift) };
|
||||||
|
$attach_func = sub { shift; Gimp->attach_parasite (shift) };
|
||||||
|
$detach_func = sub { shift; Gimp->detach_parasite (shift) };
|
||||||
|
&$set_submenu();
|
||||||
|
};
|
||||||
|
$item->signal_connect("activate", $act_global);
|
||||||
|
$menu->append($item);
|
||||||
|
|
||||||
|
$item = new Gtk::MenuItem "Image";
|
||||||
|
$item->signal_connect("activate", sub {
|
||||||
|
$list_func = sub { $_[0] ? shift->parasite_list : () };
|
||||||
|
$find_func = sub { shift->find_parasite (shift) };
|
||||||
|
$attach_func = sub { shift->attach_parasite (shift) };
|
||||||
|
$detach_func = sub { shift->detach_parasite (shift) };
|
||||||
|
&$set_submenu(map [$_,"$$_: ".$_->get_filename],Gimp->list_images);
|
||||||
|
});
|
||||||
|
$menu->append($item);
|
||||||
|
|
||||||
|
$item = new Gtk::MenuItem "Drawable";
|
||||||
|
$item->signal_connect("activate", sub {
|
||||||
|
$list_func = sub { $_[0] ? shift->parasite_list : () };
|
||||||
|
$find_func = sub { shift->find_parasite (shift) };
|
||||||
|
$attach_func = sub { shift->attach_parasite (shift) };
|
||||||
|
$detach_func = sub { shift->detach_parasite (shift) };
|
||||||
|
&$set_submenu(map [$_,$_->image->get_filename." / "
|
||||||
|
.($_->layer ? $_->layer_get_name : $_->channel_get_name)],
|
||||||
|
map (($_->get_layers,$_->get_channels),Gimp->list_images));
|
||||||
|
});
|
||||||
|
$menu->append($item);
|
||||||
|
|
||||||
|
my $type = new Gtk::OptionMenu;
|
||||||
|
$type->set_menu ($menu);
|
||||||
|
|
||||||
|
$top->add($type);
|
||||||
|
$top->add($subtype);
|
||||||
|
|
||||||
|
&$act_global;
|
||||||
|
}
|
||||||
|
|
||||||
|
show_all $w;
|
||||||
|
}
|
||||||
|
|
||||||
|
register "extension_parasite_editor",
|
||||||
|
"Parasite Editor",
|
||||||
|
"This plug-in can be used to view (and in a future version edit) existing parasites",
|
||||||
|
"Marc Lehmann",
|
||||||
|
"Marc Lehmann",
|
||||||
|
"0.1",
|
||||||
|
"<Toolbox>/Xtns/Parasite Editor",
|
||||||
|
"",
|
||||||
|
[],
|
||||||
|
sub {
|
||||||
|
|
||||||
|
create_main;
|
||||||
|
main Gtk;
|
||||||
|
|
||||||
|
();
|
||||||
|
};
|
||||||
|
|
||||||
|
exit main;
|
@ -24,13 +24,14 @@
|
|||||||
# gimp is cleaning up this memory on its own...
|
# gimp is cleaning up this memory on its own...
|
||||||
# 1.2: Fixed buggy selection handling - oops ;)
|
# 1.2: Fixed buggy selection handling - oops ;)
|
||||||
# 1.3: Added undo capability by Marc Lehman <pcg@goof.com>
|
# 1.3: Added undo capability by Marc Lehman <pcg@goof.com>
|
||||||
|
# 1.4: Marc Lehman <pcg@goof.com>, changed function name
|
||||||
|
|
||||||
# Here's the boring start of every script...
|
# Here's the boring start of every script...
|
||||||
|
|
||||||
use Gimp;
|
use Gimp;
|
||||||
use Gimp::Fu;
|
use Gimp::Fu;
|
||||||
|
|
||||||
register "Xach Blocks",
|
register "xach_blocks",
|
||||||
"Xach's Blocks o' Fun",
|
"Xach's Blocks o' Fun",
|
||||||
"Turn your picture into something that resembles a certain trademarked
|
"Turn your picture into something that resembles a certain trademarked
|
||||||
building block creation",
|
building block creation",
|
||||||
|
@ -14,18 +14,19 @@
|
|||||||
# and working from the bottom up..
|
# and working from the bottom up..
|
||||||
|
|
||||||
# Revision 1.1: Marc Lehman <pcg@goof.com> added undo capability
|
# Revision 1.1: Marc Lehman <pcg@goof.com> added undo capability
|
||||||
|
# Revision 1.2: Marc Lehman <pcg@goof.com>, changed function name
|
||||||
|
|
||||||
# Here's the boring start of every script...
|
# Here's the boring start of every script...
|
||||||
|
|
||||||
use Gimp;
|
use Gimp;
|
||||||
use Gimp::Fu;
|
use Gimp::Fu;
|
||||||
|
|
||||||
register "Xach Shadows",
|
register "xach_shadows",
|
||||||
"Xach's Shadows o' Fun",
|
"Xach's Shadows o' Fun",
|
||||||
"Screen of 50% of your drawing into a dropshadowed layer.",
|
"Screen of 50% of your drawing into a dropshadowed layer.",
|
||||||
"Seth Burgess",
|
"Seth Burgess",
|
||||||
"Seth Burgess",
|
"Seth Burgess",
|
||||||
"1.1",
|
"1.2",
|
||||||
"<Image>/Filters/Misc/Xach Shadows",
|
"<Image>/Filters/Misc/Xach Shadows",
|
||||||
"RGB*, GRAY*",
|
"RGB*, GRAY*",
|
||||||
[
|
[
|
||||||
|
Reference in New Issue
Block a user