see plug-ins/perl/Changes

This commit is contained in:
Marc Lehmann 1999-07-08 01:52:48 +00:00
parent 085eeb9f55
commit a444690442
7 changed files with 118 additions and 6 deletions

View File

@ -1,8 +1,9 @@
Revision history for Gimp-Perl extension.
1.096
- fix around PDL-2.002 exporting its own ppport.h.
- new script examples/frame_reshuffle.
- new scripts examples/frame_reshuffle and examples/frame_filter.
- added Gimp::Fu::PF_TEXT.
1.095 Tue Jun 29 01:22:01 CEST 1999
- finally cut support for gimp-1.0.2 and gtk-1.0,

View File

@ -78,6 +78,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_TEXT () { Gimp::PARAM_END+12 };
sub PF_BOOL () { PF_TOGGLE };
sub PF_INT () { PF_INT32 };
@ -103,6 +104,7 @@ sub Gimp::RUN_FULLINTERACTIVE (){ Gimp::RUN_INTERACTIVE+100 }; # you don't want
&PF_RADIO => 'string',
&PF_CUSTOM => 'string',
&PF_FILE => 'string',
&PF_TEXT => 'string',
&PF_IMAGE => 'NYI',
&PF_LAYER => 'NYI',
&PF_CHANNEL => 'NYI',
@ -112,7 +114,8 @@ sub Gimp::RUN_FULLINTERACTIVE (){ Gimp::RUN_INTERACTIVE+100 }; # you don't want
@_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);
PF_BRUSH PF_PATTERN PF_GRADIENT PF_RADIO PF_CUSTOM PF_FILE
PF_TEXT);
#@EXPORT_OK = qw(interact $run_mode save_image);
@ -462,6 +465,20 @@ sub interact($$$$@) {
$f->ok_button ->signal_connect (clicked => sub { $f->hide; $s->set_text ($f->get_filename) });
$f->cancel_button->signal_connect (clicked => sub { $f->hide });
} elsif($type == PF_TEXT) {
$a = new Gtk::HBox 0,5;
my $e = new Gtk::Text;
$a->add ($e);
$e->set_editable (1);
push @setvals, sub {
$e->delete_text(0,-1);
$e->insert_text($_[0],0);
};
push @getvals, sub {
$e->get_chars(0,-1);
};
} else {
$label="Unsupported argumenttype $type";
push(@setvals,sub{});
@ -566,6 +583,7 @@ sub string2pf($$) {
|| $type==PF_BRUSH
|| $type==PF_CUSTOM
|| $type==PF_FILE
|| $type==PF_TEXT
|| $type==PF_RADIO # for now! #d#
|| $type==PF_GRADIENT) {
$s;
@ -694,6 +712,7 @@ sub query {
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_GRADIENT;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_CUSTOM;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_FILE;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_TEXT;
$_;
} @$params],
$results);
@ -907,6 +926,11 @@ commandline or via the PDB.
This represents a file system object. It usually is a file, but can be
anything (directory, link). It might not even exist at all.
=item PF_TEXT
Similar to PF_STRING, but the entry widget is much larger and has Load and
Save buttons.
=back
=head2 EMBEDDED POD DOCUMENTATION

View File

@ -103,4 +103,5 @@ examples/pixelmap
embedxpm
logo.xpm
examples/frame_reshuffle
examples/frame_filter

View File

@ -11,7 +11,7 @@ $|=1;
sethspin.pl animate_cells image_tile yinyang stamps font_table
perlotine randomblends innerbevel fit-text guidegrid roundrectsel
repdup centerguide stampify goldenmean triangle billboard mirrorsplit
oneliners randomart1 pixelmap glowing_steel frame_reshuffle
oneliners randomart1 pixelmap glowing_steel frame_reshuffle frame_filter
);
@shebang = (map("examples/$_",@examples),
qw(Perl-Server examples/example-net.pl examples/homepage-logo.pl

View File

@ -10,6 +10,7 @@ make test TEST_VERBOSE=1
bugs
* PF_TEXT has no Load/Save buttons
* Christian Soeller told me its easy: apply the affine transformation from C
* podestions are not expanded in dialog help strings etc..
* Document spawn_options in Gimp::Net.

View File

@ -0,0 +1,85 @@
#!/usr/bin/perl
use Gimp qw(:auto);
use Gimp::Fu;
register "layer_apply",
"Apply a perl expression to every layer of the image",
"=pod",
"Marc Lehmann <pcg\@goof.com>",
"Marc Lehmann <pcg\@goof.com>",
"19990708",
"<Image>/Filters/Animation/Apply Expression",
"*",
[
[PF_TEXT, "expr", "the perl expression to run for each layer",
'$d->gauss_rle($P*100,1,1)'],
],
[],
['gimp-1.1'],
sub {
my($image,$_drawable,$function) = @_;
my($d,$i,$I,$n,$p,$P);
my @layers = $image->get_layers;
$n = @layers;
my $func = eval "sub{\n#line 0 \"expression\"\n$function\n}";
die "syntax error in expression '$function': $@\n" if $@;
# now apply the function
eval { $image->undo_push_group_start };
Gimp->progress_init("Applying Expression...");
for my $index (0..$n-1) {
$i = $index;
$I = $n-$i-1;
$p = $i/$#layers;
$P = $I/$#layers;
$d = $layers[$i];
eval { &$func };
die "evaluation error in frame $i: $@\n" if $@;
Gimp->progress_update(($i+1)/$n);
}
Gimp->displays_flush;
eval { $image->undo_push_group_end };
};
exit main;
=head1 DESCRIPTION
This function runs a perl expression for each layer of an image. The perl expression
can use the following variables:
=over 4
=item $image
The image.
=item $d ("drawable")
The current drawable (currently always a layer)
=item $i, $I ("index")
The index of the current layer. C<$i> counts from 0 to $n-1, i.e. from top
to the bottom of the stack with layer #0 being the top of the stack.
C<$I> counts "backwards", i.e. from $n-1 to 0, so layer 0 is at the
bottom.
=item $p, $P ("percent")
Similar to $i, but counts from 0 to 1 (inclusive). $p is equivalent to
C<$i/($n-1)> and $P is equivalent to C<$I/($n-1)>.
=item $n ("number of frames")
The number of layers in the image.
=back

View File

@ -8,7 +8,7 @@ register "layer_reorder",
"=pod",
"Marc Lehmann <pcg\@goof.com>",
"Marc Lehmann <pcg\@goof.com>",
"19990707",
"19990708",
"<Image>/Layers/Stack/Reorder Layers",
"*",
[
@ -32,7 +32,7 @@ register "layer_reorder",
$custom =~ s/\bn\b/scalar@layers/ge;
$custom =~ s/\bi\b/\$i/g;
$function = eval "sub { my \$i = shift;\n#line 0\n$custom\n}";
$function = eval "sub { my \$i = shift;\n#line 0 \"expression\"\n$custom\n}";
die "syntax error in expression '$custom': $@\n" if $@;
# calculcate new order