Commit c5238c6d authored by Marc Lehmann's avatar Marc Lehmann
Browse files

see plug-ins/perl/Changes

parent dae4b4df
......@@ -6,6 +6,10 @@ Revision history for Gimp-Perl extension.
- half-hearted attempt to i18nize logulator.
- preliminary support for N_ (this function should
not be necessary in perl).
- used N_ to mark all the menu paths, since gimp now tries to
do the translation.
- patch by Frank Loemker <floemker@TechFak.Uni-Bielefeld.DE> to fix
many missing :auto tags.
1.16 Sun Nov 21 02:37:16 CET 1999
- removed sethspin.pl & billboard, they are no longer maintained :(
......
......@@ -187,7 +187,7 @@ sub xlfd_size($) {
: ($pt,&Gimp::POINTS);
}
# the identity function
# the monadic identity function
sub N_($) { shift }
my @init_functions;
......
......@@ -16,7 +16,7 @@ Gimp::Fu - "easy to use" framework for Gimp scripts
use Gimp;
use Gimp::Fu;
(this module uses Gtk, so make sure it's correctly installed)
=head1 DESCRIPTION
......@@ -35,14 +35,14 @@ C<http://imagic.weizmann.ac.il/~dov/gimp/perl-tut.html>.
In general, a Gimp::Fu script looks like this:
#!/path/to/your/perl
use Gimp;
use Gimp::Fu;
register <many arguments>, sub {
your code;
}
exit main;
(This distribution comes with example scripts. One is
......@@ -175,7 +175,7 @@ my $old_trace;
sub interact {
eval { require Gtk };
if ($@) {
my @res = map {
die __"the gtk perl module is required to run\nthis plug-in in interactive mode\n" unless defined $_->[3];
......@@ -267,7 +267,7 @@ Gimp::on_net {
my $this = this_script;
my(%map,@args);
my($interact)=1;
my($perl_sub,$function,$blurb,$help,$author,$copyright,$date,
$menupath,$imagetypes,$params,$results,$features,$code,$type)=@$this;
......@@ -300,7 +300,7 @@ Gimp::on_net {
$interact--;
}
}
# Fill in default arguments
foreach my $i (0..@$params-1) {
next if defined $args[$i];
......@@ -308,7 +308,7 @@ Gimp::on_net {
$args[$i] = $entry->[3]; # Default value
die __"parameter '$entry->[1]' is not optional\n" unless defined $args[$i] || $interact>0;
}
# Go for it
$perl_sub->(($interact>0 ? &Gimp::RUN_FULLINTERACTIVE : &Gimp::RUN_NONINTERACTIVE),
@args);
......@@ -343,7 +343,7 @@ Gimp::on_query {
sub odd_values(@) {
my %x = @_; values %x;
}
for(@$params) {
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_TOGGLE;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_FONT;
......@@ -641,12 +641,12 @@ sub register($$$$$$$$$;@) {
die __"menupath _must_ start with <Image>, <Toolbox>, <Load>, <Save> or <None>!";
}
}
$menupath =~ s%^<Toolbox>/Xtns/%__("<Toolbox>/Xtns/")%e;
$menupath =~ s%^<Image>/Filters/%__("<Image>/Filters/")%e;
#$menupath =~ s%^<Toolbox>/Xtns/%__("<Toolbox>/Xtns/")%e;
#$menupath =~ s%^<Image>/Filters/%__("<Image>/Filters/")%e;
undef $menupath if $menupath eq "<None>";#d#
@_==0 or die __"register called with too many or wrong arguments\n";
for my $p (@$params,@$results) {
next unless ref $p;
int($p->[0]) eq $p->[0] or croak __"$function: argument/return value '$p->[1]' has illegal type '$p->[0]'";
......@@ -654,7 +654,7 @@ sub register($$$$$$$$$;@) {
}
$function="perl_fu_".$function unless $function =~ /^(?:perl_fu_|extension_|plug_in_|file_)/ || $function =~ s/^\+//;
$function=~/^[0-9a-z_]+(-ALT)?$/ or carp __"$function: function name contains unusual characters, good style is to use only 0-9, a-z and _";
Gimp::logger message => __"function name contains dashes instead of underscores",
......@@ -670,7 +670,7 @@ sub register($$$$$$$$$;@) {
$params->[$_]->[3]=$defaults[$_];
}
}
# supplement default arguments
for (0..$#{$params}) {
$_[$_]=$params->[$_]->[3] unless defined($_[$_]);
......@@ -702,13 +702,13 @@ sub register($$$$$$$$$;@) {
if (@_) {
# prevent the standard arguments from showing up in interact
my @hide = splice @$params, 0, scalar@pre;
my $res;
local $^W=0; # perl -w is braindamaged
# gimp is braindamaged, is doesn't deliver useful values!!
($res,@_)=interact($function,$blurb,$help,$params,@{$fudata});
return unless $res;
unshift @$params, @hide;
}
}
......@@ -726,15 +726,15 @@ sub register($$$$$$$$$;@) {
}
$input_image = $_[0] if ref $_[0] eq "Gimp::Image";
$input_image = $pre[0] if ref $pre[0] eq "Gimp::Image";
$Gimp::Data{"$function/_fu_data"}=[@_];
print $function,"(",join(",",(@pre,@_)),")\n" if $Gimp::verbose;
Gimp::set_trace ($old_trace);
my @imgs = &$code(@pre,@_);
$old_trace = Gimp::set_trace (0);
if ($menupath !~ /^<Load>\//) {
if (@imgs) {
for my $i (0..$#imgs) {
......@@ -752,14 +752,14 @@ sub register($$$$$$$$$;@) {
} elsif ($run_mode != &Gimp::RUN_NONINTERACTIVE) {
$img->display_new unless $input_image && $$img == $$input_image;
}
} elsif (!@$retvals) {
} elsif (!@$retvals) {
warn __"WARNING: $function returned something that is not an image: \"$img\"\n";
}
}
}
Gimp->displays_flush;
}
Gimp::set_trace ($old_trace);
wantarray ? @imgs : $imgs[0];
};
......@@ -792,11 +792,17 @@ IMAGETYPE is one of GIF, JPG, JPEG, PNM or PNG, options include
options valid for all images
+F flatten the image (default depends on the image)
-F do not flatten the image
options for GIF and PNG images
+I do save as interlaced (GIF only)
-I do not save as interlaced (default)
options for GIF animations (use with -F)
+L save as looping animation
-L save as non-looping animation (default)
-Dn default frame delay (default is 0)
-Pn frame disposal method: 0=don't care, 1 = combine, 2 = replace
options for PNG images
-Cn use compression level n
......@@ -804,7 +810,7 @@ IMAGETYPE is one of GIF, JPG, JPEG, PNM or PNG, options include
-Qn use quality "n" to save file (JPEG only)
-S do not smooth (default)
+S smooth before saving
some examples:
test.jpg save the image as a simple jpeg
......@@ -819,13 +825,16 @@ some examples:
sub save_image($$) {
my($img,$path)=@_;
my($interlace,$flatten,$quality,$type,$smooth,$compress);
my($interlace,$flatten,$quality,$type,$smooth,$compress,$loop,$dispose);
$interlace=0;
$quality=75;
$smooth=0;
$compress=7;
$loop=0;
$delay=0;
$dispose=0;
$_=$path=~s/^([^:]+):// ? $1 : "";
$type=uc($1) if $path=~/\.([^.]+)$/;
$type=uc($1) if s/^(GIF|JPG|JPEG|PNM|PNG)//i;
......@@ -835,15 +844,18 @@ sub save_image($$) {
$smooth=$1 eq "+", next if s/^([-+])[sS]//;
$quality=$1*0.01, next if s/^-[qQ](\d+)//;
$compress=$1, next if s/^-[cC](\d+)//;
$loop=$1 eq "+", next if s/^([-+])[lL]//;
$delay=$1, next if s/^-[dD](\d+)//;
$dispose=$1, next if s/^-[pP](\d+)//;
croak __"$_: unknown/illegal file-save option";
}
$flatten=(()=$img->get_layers)>1 unless defined $flatten;
$img->flatten if $flatten;
# always save the active layer
my $layer = $img->get_active_layer;
if ($type eq "JPG" or $type eq "JPEG") {
eval { $layer->file_jpeg_save($path,$path,$quality,$smooth,1) };
$layer->file_jpeg_save($path,$path,$quality,$smooth,1,$interlace,"",0,1,0,0) if $@;
......@@ -852,7 +864,7 @@ sub save_image($$) {
eval { $img->convert_indexed(1,256) };
$img->convert_indexed(2,&Gimp::MAKE_PALETTE,256,1,1,"") if $@;
}
$layer->file_gif_save($path,$path,$interlace,0,0,0);
$layer->file_gif_save($path,$path,$interlace,$loop,$delay,$dispose);
} elsif ($type eq "PNG") {
$layer->file_png_save($path,$path,$interlace,$compress);
} elsif ($type eq "PNM") {
......
......@@ -15,7 +15,7 @@ use strict;
use vars qw($use_unix $use_tcp $trace_res $server_quit $max_pkt $unix $tcp $ps_flags
$auth @authorized $exclusive $rm $saved_rm %stats);
# the '' might be required (i.e. no ()). why??
use Gimp ('__');
use Gimp qw(__ N_);
use Gimp::Net ();
Gimp::set_trace(\$trace_res);
......@@ -304,7 +304,7 @@ sub query {
Gimp->install_procedure("extension_perl_server", "Start the Gimp-Perl Server",
"This is the server for plug-ins written using the Gimp::Net module",
"Marc Lehmann <pcg\@goof.com>", "Marc Lehmann", "1998-07-22",
__"<Toolbox>/Xtns/Perl/Server", "*",&Gimp::PROC_EXTENSION,
N_"<Toolbox>/Xtns/Perl/Server", "*",&Gimp::PROC_EXTENSION,
[
[&Gimp::PARAM_INT32, "run_mode", "Interactive, [non-interactive]"],
[&Gimp::PARAM_INT32, "flags", "internal flags (must be 0)"],
......
......@@ -95,7 +95,7 @@ sub extension_create_images {
sub query {
gimp_install_procedure("extension_create_images", "a test extension in perl",
"try it out", "Marc Lehmann", "Marc Lehmann", "1997-02-06",
__"<Toolbox>/Xtns/Create_Images", "*", PROC_EXTENSION,
N_"<Toolbox>/Xtns/Create_Images", "*", PROC_EXTENSION,
[[PARAM_INT32, "run_mode", "Interactive, [non-interactive]"]], []);
}
......
......@@ -3,7 +3,7 @@
#BEGIN {$^W=1};
use Gimp::Feature qw(perl-5.005 gtk-1.2);
use Gimp (':consts','__');
use Gimp (':consts','__','N_');
use Gimp::Fu;
use Gtk;
use Gtk::Gdk;
......@@ -485,7 +485,7 @@ register "extension_pdb_explorer",
"Marc Lehmann",
"Marc Lehmann",
"0.4alpha",
__"<Toolbox>/Xtns/PDB Explorer",
N_"<Toolbox>/Xtns/PDB Explorer",
"",
[],
sub {
......
#!/usr/bin/perl
use Gimp qw( :auto );
use Gimp qw( :auto N_ );
use Gimp::Fu;
# alpha2color.pl
......@@ -103,7 +103,7 @@ register
"Seth Burgess",
"Seth Burgess<sjburges\@gimp.org>",
"2-15-98",
__"<Image>/Image/Colors/Alpha2Color",
N_"<Image>/Image/Colors/Alpha2Color",
"RGBA",
[
[PF_COLOR, "color", "Color for current alpha", [127,127,127]]
......
......@@ -12,7 +12,7 @@
require 5.004;
use Gimp qw(:auto __);
use Gimp qw(:auto __ N_);
use Gimp::Fu;
use Gimp::Util;
......@@ -82,7 +82,7 @@ register
"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-15",
__"<Image>/Filters/Animation/Animate Cells",
N_"<Image>/Filters/Animation/Animate Cells",
"*",
[
[PF_TOGGLE, "work_on_copy", "", 1]
......
......@@ -91,7 +91,7 @@ register
"John Pitney",
"John Pitney <pitney\@uiuc.edu>",
"1999-03-15",
__"<Image>/Filters/Distorts/BlowInOut",
N_"<Image>/Filters/Distorts/BlowInOut",
"*",
[
[PF_INT32, "angle", "Wind Angle, 0 is left", 120],
......
......@@ -15,7 +15,7 @@ register "border_average",
"Marc Lehmann",
"Marc Lehmann",
"0.2.2",
__"<Image>/Filters/Misc/Border Average",
N_"<Image>/Filters/Misc/Border Average",
"RGB",
[
[PF_INT32, "thickness", "Border size to take in count", 10],
......
......@@ -8,7 +8,7 @@
# params: brick width/height, brick pattern, random light skew, border color
use Gimp ':auto';
use Gimp qw(:auto N_);
use Gimp::Fu;
use Gimp::Util;
......@@ -124,7 +124,7 @@ register
"Tels",
"http://bloodgate.com",
"10/26/1999a",
__"<Toolbox>/Xtns/Render/Bricks",
N_"<Toolbox>/Xtns/Render/Bricks",
"*",
[
[PF_PATTERN, "background", "Brick pattern", "Leather"],
......
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
# <sjburges@gimp.org> (original release)
#
use Gimp;
......@@ -21,15 +19,15 @@ use Gimp::Util;
# Gimp::set_trace(TRACE_ALL);
register "burst",
"Bursts from a central location\n",
"Bursts from a central location",
"Creates a Burst of various sizes from the center of the currently
selected areas. Can create either an elliptical burst, or go to sqare
spots. Also, you can specify how much (in pixels) to leave blank on
the inside and the outside of the burst. \n",
the inside and the outside of the burst.",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1999-07-31",
__"<Image>/Filters/Misc/Burst",
N_"<Image>/Filters/Misc/Burst",
"*",
[
[PF_RADIO, "shape", "Shape To Burst Into", 0, [Rectangle => 1, Ellipse=> 0]],
......
#!/usr/bin/perl
use Gimp qw(:auto __);
use Gimp qw(:auto __ N_);
use Gimp::Fu;
register "center_guide",
......@@ -9,7 +9,7 @@ register "center_guide",
"Claes G Lindblad <claesg\@algonet.se>",
"Claes G Lindblad",
"990323",
__"<Image>/Guides/Center Guide",
N_"<Image>/Guides/Center Guide",
"*",
[
[PF_RADIO,
......
......@@ -13,7 +13,7 @@ register "colour_to_alpha",
"Marc Lehmann",
"Marc Lehmann <pcg\@goof.com>",
"19990729",
__"<Image>/Filters/Colors/Colour To Alpha",
N_"<Image>/Filters/Colors/Colour To Alpha",
"RGB*",
[
[PF_COLOR, "colour", "The colour to replace"],
......
......@@ -27,7 +27,7 @@ register "plug_in_ditherize",
"Marc Lehmann",
"Marc Lehmann",
"1.2",
__"<Image>/Filters/Noise/Ditherize",
N_"<Image>/Filters/Noise/Ditherize",
"RGB*, GRAY*",
[
[PF_RADIO, "dither_type", "The dither type (see gimp_convert_indexed)", 1,
......
......@@ -11,7 +11,7 @@ register "gimp_fu_example_script", # fill in a function name
"Marc Lehmann <pcg\@goof.com>", # 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
N_"<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
......
......@@ -29,7 +29,7 @@ sub net {
sub query {
gimp_install_procedure("plug_in_example_oo", "a test plug-in in perl",
"try it out", "Marc Lehmann", "Marc Lehmann", "1998-04-27",
__"<Toolbox>/Xtns/Perl Example Plug-in", "*", PROC_EXTENSION,
N_"<Toolbox>/Xtns/Perl Example Plug-in", "*", PROC_EXTENSION,
[[PARAM_INT32, "run_mode", "Interactive, [non-interactive]"]], []);
}
......
......@@ -15,7 +15,7 @@ register "feedback",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"2-15-99",
__"<Image>/Filters/Noise/Feedback",
N_"<Image>/Filters/Noise/Feedback",
"RGB, GRAY",
[
[PF_SLIDER, "offset", "the amount the frames will offset", 3, [0, 255, 1]],
......
......@@ -35,7 +35,7 @@ register "fire",
"Marc Lehmann <pcg\@goof.com>",
"Marc Lehmann",
"19990802",
__"<Image>/Filters/Colors/Fire",
N_"<Image>/Filters/Colors/Fire",
"*",
[
[PF_SLIDER, "threshold", "Intensity at which to start smearing", 10, [0,255,1]],
......
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
# <sjburges@gimp.org>
# This is adrian and xachs idea - take a rectangluar selection, and select
# font type and string. Then fill it with whatever size is needed.
......@@ -41,7 +39,7 @@ register "fit_text",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1999-03-21",
__"<Image>/Filters/Render/Fit Text",
N_"<Image>/Filters/Render/Fit Text",
"*",
[
[PF_FONT, "font", "What font type to use - size will be ignored", $defaultfont],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment