see plug-ins/perl/Changes

This commit is contained in:
Marc Lehmann 1999-11-19 20:06:56 +00:00
parent d824473956
commit a30b735a87
18 changed files with 51 additions and 395 deletions

View file

@ -1,6 +1,9 @@
Revision history for Gimp-Perl extension.
1.15
1.16
- removed sethspin.pl & billboard, they are no longer maintained :(
1.15 Fri Nov 19 19:12:16 CET 1999
- added italian translations by Daniele Medri (madrid@kjws.com).
- POINTS really are decipoints: correct xlfd_size to create
larger (& more correct) fonts.
@ -16,6 +19,7 @@ Revision history for Gimp-Perl extension.
- more warnings on people insisting on using broken perls.
- renamed init_gtk to gtk_init, asdded gtk_init_hook function to
work around the horrible initialization problems in Gtk.
- goto &name is horribly broken somewhere. going back to eval _again_.
1.14 Mon Oct 11 03:23:13 CEST 1999
- set the version of all modules explicitly (for the benefit of CPAN).

View file

@ -12,7 +12,7 @@ use subs qw(init end lock unlock canonicalize_color);
BEGIN {
require DynaLoader;
@ISA=qw(DynaLoader);
$VERSION = 1.15;
$VERSION = 1.16;
bootstrap Gimp $VERSION;
}
@ -353,7 +353,7 @@ sub quiet_die {
$in_top ? exit(1) : die "IGNORE THIS MESSAGE\n";
}
unless($no_SIG) {
unless($no_SIG||1) {
$SIG{__DIE__} = sub {
unless ($^S || !defined $^S || $in_quit) {
die_msg $_[0];
@ -466,9 +466,9 @@ sub ignore_functions(@) {
@ignore_function{@_}++;
}
sub _croak($) {
sub recroak($) {
$_[0] =~ s/ at .*? line \d+.*$//s;
croak($_[0]);
croak $_[0];
}
sub AUTOLOAD {
@ -482,30 +482,27 @@ sub AUTOLOAD {
my $ref = \&{"Gimp::Util::$sub"};
*{$AUTOLOAD} = sub {
shift unless ref $_[0];
goto &$ref; # does not always work, PERLBUG! #FIXME
#my @r = eval { &$ref };
#_croak $@ if $@;
#wantarray ? @r : $r[0];
#goto &$ref; # does not work, PERLBUG! #FIXME
my @r = eval { &$ref };
recroak $@ if $@; wantarray ? @r : $r[0];
};
goto &$AUTOLOAD;
} elsif (UNIVERSAL::can($interface_pkg,$sub)) {
my $ref = \&{"$interface_pkg\::$sub"};
*{$AUTOLOAD} = sub {
shift unless ref $_[0];
goto &$ref; # does not always work, PERLBUG! #FIXME
#my @r = eval { &$ref };
#_croak $@ if $@;
#wantarray ? @r : $r[0];
#goto &$ref; # does not work, PERLBUG! #FIXME
my @r = eval { &$ref };
recroak $@ if $@; wantarray ? @r : $r[0];
};
goto &$AUTOLOAD;
} elsif (_gimp_procedure_available ($sub)) {
*{$AUTOLOAD} = sub {
shift unless ref $_[0];
unshift @_, $sub;
goto &gimp_call_procedure; # does not always work, PERLBUG! #FIXME
#my @r=eval { gimp_call_procedure (@_) };
#_croak $@ if $@;
#wantarray ? @r : $r[0];
#goto &gimp_call_procedure; # does not work, PERLBUG! #FIXME
my @r = eval { gimp_call_procedure (@_) };
recroak $@ if $@; wantarray ? @r : $r[0];
};
goto &$AUTOLOAD;
}

View file

@ -43,7 +43,7 @@ Gimp-Perl extension (contact him to include new functions) is Marc Lehmann
package Gimp::Compat;
$VERSION=1.15;
$VERSION=1.16;
use Gimp ('croak', '__');

View file

@ -6,7 +6,7 @@ use base qw(DynaLoader);
require DynaLoader;
$VERSION = 1.15;
$VERSION = 1.16;
use subs qw(
gimp_call_procedure gimp_main gimp_init

View file

@ -1586,6 +1586,7 @@ gimp_call_procedure (proc_name, ...)
destroy_paramdefs (params, nparams);
destroy_paramdefs (return_vals, nreturn_vals);
if (croak_str[0])
croak (croak_str);
}

View file

@ -19,7 +19,7 @@ package Gimp::Module;
use base qw(DynaLoader);
require DynaLoader;
$VERSION=1.15;
$VERSION=1.16;
bootstrap Gimp::Module;

View file

@ -1,6 +1,6 @@
package Gimp::Pod;
$VERSION=1.15;
$VERSION=1.16;
sub myqx(&) {
local $/;

View file

@ -51,7 +51,7 @@ require Exporter;
use Gimp;
$VERSION=1.15;
$VERSION=1.16;
##############################################################################
=pod

View file

@ -83,7 +83,6 @@ examples/terral_text
examples/xachvision.pl
examples/gimpmagick
examples/perlcc
examples/sethspin.pl
examples/animate_cells
examples/yinyang
examples/image_tile
@ -100,7 +99,6 @@ examples/centerguide
examples/stampify
examples/goldenmean
examples/triangle
examples/billboard
examples/mirrorsplit
examples/randomart1
examples/colourtoalpha

View file

@ -30,9 +30,9 @@ if ($ARGV[0] ne "--writemakefile") {
qw(windify.pl prep4gif.pl webify.pl PDB tex-to-float ditherize.pl
feedback.pl xachlego.pl xachshadow.pl parasite-editor
scratches.pl blowinout.pl terral_text xachvision.pl perlcc
sethspin.pl animate_cells image_tile yinyang stamps font_table
animate_cells image_tile yinyang stamps font_table
perlotine randomblends innerbevel fit-text guidegrid roundrectsel
repdup centerguide stampify goldenmean triangle billboard mirrorsplit
repdup centerguide stampify goldenmean triangle mirrorsplit
layerfuncs randomart1 glowing_steel frame_reshuffle frame_filter
logulator miff gimpmagick guide_remove guides_to_selection burst
fire povray avi layerfuncs bricks
@ -249,7 +249,7 @@ msgmerge:
# set \$VERSION in all modules
setver:
\$(PERL) -pi -e 's/^(\\s*\\\$\$VERSION\\s*=\\s*).*\$\$/\$\${1}\$(VERSION);/' *.pm Gimp/*.pm
\$(PERL) -pi -e 's/^(\\s*\\\$\$VERSION\\s*=\\s*).*\$\$/\$\${1}\$(VERSION);/' *.pm Gimp/*.pm UI/*.pm Net/*.pm
";

View file

@ -19,7 +19,7 @@ use Gimp ('croak','__');
require DynaLoader;
$VERSION = 1.15;
$VERSION = 1.16;
bootstrap Gimp::Net $VERSION;

View file

@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/perl -Dt
#
# you can enable unix sockets, tcp sockets, or both (or neither...)

View file

@ -7,7 +7,7 @@ use base 'DynaLoader';
BEGIN {
require DynaLoader;
$VERSION = 1.15;
$VERSION = 1.16;
bootstrap Gimp::UI $VERSION;
}

View file

@ -1,190 +0,0 @@
#!/usr/bin/perl
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
# This one's all mine. Well, its GPL/Artisitic but I"m the author and
# creator. I think you need gimp 1.1 or better for this - if you don't,
# please let me know
# I'm hacking this on top of my sethspin script, so this is doing even more
# stuff it wasn't really designed to do. Hence if you thought sethspin was
# a bit ugly, look at this one...
# I think it was tigert that suggested this. It turned out to be less
# complex than I orginally thought so I figured I'd give it a spin.
# Seth Burgess
# <sjburges@gimp.org>
use Gimp qw(:auto);
use Gimp::Fu;
use Gimp::Util;
# Uncomment below to spew forth much data about whats going on.
#Gimp::set_trace(TRACE_ALL);
sub saw { # a sawtooth function on PI
($val) = @_;
if ($val < 3.14159/2.0) {
return ($val/3.14159) ;
}
elsif ($val < 3.14159) {
return (-1+$val/3.14159);
}
elsif ($val < 3.14159+3.14159/2.0) {
return ($val/3.14159) ;
}
else {
return (-1+$val/3.14159);
}
}
sub spin_layer { # the function for actually spinning the layer
my ($img, $spin, $dest, $numframes, $prp, $blinds) = @_;
# Now lets spin it!
$stepsize = 3.14159/$numframes; # in radians
for ($i=0; $i<=3.14159; $i+=$stepsize) {
Gimp->progress_update ($i/3.14159);
# create a new layer for spinning
$framelay = ($i < 3.14159/2.0) ? $spin->copy(1) : $dest->copy(1);
$img->add_layer($framelay, 0);
# spin it a step
# Here I need to make the proper selection, repeatedly if necessary
$blindheight = $img->height/$blinds;
for ($j=0; $j<$blinds; $j++) {
# select a section
$img->rect_select(0, $j*$blindheight, $img->width, $blindheight, 2, 0, 0.13);
@x = $img->selection_bounds();
# x[1],x[2] x[3],x[2]
# x[1],x[4] x[3],x[4]
$floater = $framelay->perspective(1,
$x[1]+saw($i)*$prp*$framelay->width,$x[2]+$blindheight *sin($i)/2,
$x[3]-saw($i)*$prp*$framelay->width,$x[2]+$blindheight *sin($i)/2,
$x[1]-saw($i)*$prp*$framelay->width,$x[4]-$blindheight *sin($i)/2,
$x[3]+saw($i)*$prp*$framelay->width,$x[4]-$blindheight *sin($i)/2);
# Gimp Perspective Functionality has changed. It used to create a floating
# selection if there was a selection active already. Now it only does that
# in interactive - PDB makes it a new layer. Fine by me, wish the docs had
# changed though.
# $floater->floating_sel_anchor;
} # end for ($j=0;...
# I need to create another layer beind this spun one now
$backlayer = $framelay->layer_copy(0);
$img->add_layer($backlayer, 1);
$backlayer->fill(1); # BG-IMAGE-FILL
}
for ($i=0; $i<$numframes; $i++) {
@all_layers = $img->get_layers();
$img->set_visible($all_layers[$i],$all_layers[$i+1]);
$img->merge_visible_layers(0);
}
@all_layers = $img->get_layers();
$destfram = $all_layers[$numframes]->copy(0);
$img->add_layer($destfram,0);
# clean up my temporary layers
$img->remove_layer($all_layers[$numframes]);
$img->remove_layer($all_layers[$numframes+1]);
}
register "billboard",
"Billboard",
"Take one image. Spin it about the multiple axes, and end up with another image. I made it for easy web buttons, mostly because somebody suggested to me.",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1.3",
__"<Toolbox>/Xtns/Animation/Billboard",
"*",
[
[PF_DRAWABLE, "source", "What drawable to spin from?"],
[PF_DRAWABLE, "destination","What drawable to spin to?"],
[PF_INT8, "frames", "How many frames to use?", 16],
[PF_COLOR, "background", "What color to use for background if not transparent", [0,0,0]],
[PF_SLIDER, "perspective", "How much perspective effect to get", 40, [0,255,5]],
[PF_TOGGLE, "spin_back", "Also spin back?" , 0],
[PF_TOGGLE, "convert_indexed", "Convert to indexed?", 1],
[PF_SPINNER, "billboard_slats", "Number of shades", 3, [1,50,1]],
],
[],
['gimp-1.1'],
sub {
my($src,$dest,$frames,$color,$psp,$spinback,$indexed, $shadenum) =@_;
$maxwide = ($src->width > $dest->width) ? $src->width : $dest->width;
$maxhigh = ($src->height > $dest->height) ? $src->height: $dest->height;
$img = gimp_image_new($maxwide, $maxhigh, RGB);
$tmpimglayer = $img->add_new_layer(0,3,1);
$img->display_new;
Gimp->progress_init("Billboard...",-1);
$oldbackground = gimp_palette_get_background();
Palette->set_background($color);
$src->edit_copy();
$spinlayer = $tmpimglayer->edit_paste(1);
$spinlayer->floating_sel_to_layer();
$dest->edit_copy();
$destlayer = $tmpimglayer->edit_paste(1);
$destlayer->floating_sel_to_layer();
$tmpimglayer->remove_layer;
$spinlayer->resize($maxwide, $maxhigh, $spinlayer->offsets);
$destlayer->resize($maxwide, $maxhigh, $destlayer->offsets);
# work around for PF_SLIDER when < 1
$psp = $psp/255.0;
# need an even number of frames for spinback
if ($frames%2 && $spinback) {
$frames++;
gimp_message("An even number of frames is needed for spin back.\nAdjusted frames up to $frames");
}
spin_layer($img, $spinlayer, $destlayer, $spinback ? $frames/2 : $frames-1, $psp, $shadenum);
$img->set_visible($img->add_new_layer(1),($img->get_layers)[0]);
$img->merge_visible_layers(0);
if ($spinback) {
@layerlist = $img->get_layers();
$img->add_layer($layerlist[$frames/2]->copy(0),0);
@layerlist = $img->get_layers();
spin_layer($img, $layerlist[1], $layerlist[0], $frames/2, $psp, $shadenum);
$img->remove_layer(($img->get_layers)[0]);
}
# unhide and name layers
@all_layers = $img->get_layers;
$img->set_visible(@all_layers);
for ($i=1; $i<=$frames ; $i++) {
$all_layers[$i-1]->set_name("Spin Layer $i (50ms)");
}
$all_layers[$frames-1]->set_name("Spin Layer SRC (250ms)");
if ($spinback) {
$all_layers[$frames/2-1]->set_name("Spin Layer DEST (250ms)");
}
else { $all_layers[0]->set_name("Spin Layer DEST (250ms)")}
# indexed conversion wants a display for some reason
if ($indexed) {
$img->convert_indexed(1, # dither type = fs
MAKE_PALETTE, # palette type
255, # number of colors
0, # don't dither transparency
1, # (ignored)
"Custom" # custom palette name
);
}
Palette->set_background($oldbackground);
gimp_displays_flush();
return();
};
exit main;

View file

@ -26,18 +26,22 @@ register "plug_in_ditherize",
"This script takes the current selection and dithers it just like convert to indexed",
"Marc Lehmann",
"Marc Lehmann",
"1.1",
"1.2",
__"<Image>/Filters/Noise/Ditherize",
"RGB*, GRAY*",
[
[PF_SLIDER, "colours", "The number of colours to dither to", 10, [0, 256]],
[PF_RADIO, "dither_type", "The dither type (see gimp_convert_indexed)", 1,
[none => 0, fs => 1, "fs/low-bleed" => 2, ordered => 3]],
[PF_SLIDER, "colours", "The number of colours to dither to", 10, [0, 256, 1, 1]],
],
sub {
my($image,$drawable,$colours)=@_;
my($image,$drawable,$dither,$colours)=@_;
$drawable->is_layer or die "this plug-in only works for layers";
# make sure somehting is selected
$image->undo_push_group_start;
# make sure something is selected
$drawable->mask_bounds or $image->selection_all;
my ($x1,$y1,$x2,$y2)=($drawable->mask_bounds)[1..4];
@ -50,17 +54,20 @@ register "plug_in_ditherize",
$sel->remove_channel;
my $copy = new Image($w, $h, $image->base_type);
$copy->undo_disable;
my $draw = new Layer($copy, $w, $h,
$imagetype2layertype{$image->base_type},
"temporary layer",100,NORMAL_MODE);
"temporary layer", 100, NORMAL_MODE);
$copy->add_layer ($draw, 1);
$draw->edit_paste(0)->anchor;
$copy->convert_indexed (1, $colours);
$copy->convert_indexed ($dither, MAKE_PALETTE, $colours, 1, 1, "");
$draw->edit_copy;
$drawable->edit_paste(1)->anchor;
$copy->delete;
$image->undo_push_group_end;
();
};

View file

@ -7,6 +7,8 @@
# working btw). You can follow step by step with the website at
# http://tigert.gimp.org/gimp/tutorials/beveled_text/
BEGIN { <STDIN>; print "HO\n"; }
use Gimp;
use Gimp::Fu;
use Gimp::Util;

View file

@ -1,167 +0,0 @@
#!/usr/bin/perl
# This one's all mine. Well, its GPL/Artisitic but I"m the author and creator. # I think you need gimp 1.1 or better for this - if you don't, please let
# me know
# As a fair warning, some of this code is a bit ugly. But thats perl for ya :)
#
# Revision History:
# 1.0 - Initial (too early) release
# 1.1 - Second (still ugly) release: Made the perspective setting actually do
# something
# 1.2 - Used some of the convienence functions, and made things a little eaiser
# from the user's standpoint too. Also moved it from the
# Filters->Animations-> menu to Xtns->Animations. I think its
# clearer whats going on this way. It also works w/ any 2 layers now.
# Seth Burgess
# <sjburges@gimp.org>
use Gimp qw/:auto/;
use Gimp::Fu;
use Gimp::Util;
# Gimp::set_trace(TRACE_ALL);
sub saw { # a sawtooth function on PI
($val) = @_;
if ($val < 3.14159/2.0) {
return ($val/3.14159) ;
}
elsif ($val < 3.14159) {
return (-1+$val/3.14159);
}
elsif ($val < 3.14159+3.14159/2.0) {
return ($val/3.14159) ;
}
else {
return (-1+$val/3.14159);
}
}
sub spin_layer { # the function for actually spinning the layer
my ($img, $spin, $dest, $numframes, $prp) = @_;
# Now lets spin it!
$stepsize = 3.14159/$numframes; # in radians
for ($i=0; $i<=3.14159; $i+=$stepsize) {
Gimp->progress_update ($i/3.14159);
# create a new layer for spinning
$framelay = ($i < 3.14159/2.0) ? $spin->copy(1) : $dest->copy(1);
$img->add_layer($framelay, 0);
# spin it a step
$img->selection_all();
@x = $img->selection_bounds();
# x[1],x[2] x[3],x[2]
# x[1],x[4] x[3],x[4]
$floater = $framelay->perspective(1,
$x[1]+saw($i)*$prp*$framelay->width,$x[2]+$spin->height *sin($i)/2,
$x[3]-saw($i)*$prp*$framelay->width,$x[2]+$spin->height *sin($i)/2,
$x[1]-saw($i)*$prp*$framelay->width,$x[4]-$spin->height *sin($i)/2,
$x[3]+saw($i)*$prp*$framelay->width,$x[4]-$spin->height *sin($i)/2);
#$floater->floating_sel_to_layer;
# fill entire layer with background
$framelay->fill(1); # BG-IMAGE-FILL
}
for ($i=0; $i<$numframes; $i++) {
@all_layers = $img->get_layers();
$img->set_visible($all_layers[$i],$all_layers[$i+1]);
$img->merge_visible_layers(0);
}
@all_layers = $img->get_layers();
$destfram = $all_layers[$numframes]->copy(0);
$img->add_layer($destfram,0);
# clean up my temporary layers
$img->remove_layer($all_layers[$numframes]);
$img->remove_layer($all_layers[$numframes+1]);
}
register "seth_spin",
"Seth Spin",
"Take one image. Spin it about the horizontal axis, and end up with another image. I made it for easy web buttons.",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1.3",
"<Toolbox>/Xtns/Animation/Seth Spin",
"*",
[
[PF_DRAWABLE, "source", "What drawable to spin from?"],
[PF_DRAWABLE, "destination","What drawable to spin to?"],
[PF_INT8, "frames", "How many frames to use?", 16],
[PF_COLOR, "background", "What color to use for background if not transparent", [0,0,0]],
[PF_SLIDER, "perspective", "How much perspective effect to get", 40, [0,255,5]],
[PF_TOGGLE, "spin_back", "Also spin back?" , 1],
[PF_TOGGLE, "convert_indexed", "Convert to indexed?", 1],
],
[],
['gimp-1.1'],
sub {
my($src,$dest,$frames,$color,$psp,$spinback,$indexed) =@_;
$maxwide = ($src->width > $dest->width) ? $src->width : $dest->width;
$maxhigh = ($src->height > $dest->height) ? $src->height: $dest->height;
$img = gimp_image_new($maxwide, $maxhigh, RGB);
$tmpimglayer = $img->add_new_layer(0,3,1);
$img->display_new;
Gimp->progress_init("Seth Spin...",-1);
$oldbackground = gimp_palette_get_background();
gimp_palette_set_background($color);
$src->edit_copy();
$spinlayer = $tmpimglayer->edit_paste(1);
$spinlayer->floating_sel_to_layer();
$dest->edit_copy();
$destlayer = $tmpimglayer->edit_paste(1);
$destlayer->floating_sel_to_layer();
$tmpimglayer->remove_layer;
$spinlayer->resize($maxwide, $maxhigh, $spinlayer->offsets);
$destlayer->resize($maxwide, $maxhigh, $destlayer->offsets);
# work around for PF_SLIDER when < 1
$psp = $psp/255.0;
# need an even number of frames for spinback
if ($frames%2 && $spinback) {
$frames++;
gimp_message("An even number of frames is needed for spin back.\nAdjusted frames up to $frames");
}
spin_layer($img, $spinlayer, $destlayer, $spinback ? $frames/2 : $frames-1, $psp);
# it makes ugly sounds on the next line, but no harm is done.
$img->set_visible($img->add_new_layer(1),($img->get_layers)[0]);
$img->merge_visible_layers(0);
if ($spinback) {
@layerlist = $img->get_layers();
$img->add_layer($layerlist[$frames/2]->copy(0),0);
@layerlist = $img->get_layers();
spin_layer($img, $layerlist[1], $layerlist[0], $frames/2, $psp);
$img->remove_layer(($img->get_layers)[0]);
}
# unhide and name layers
@all_layers = $img->get_layers;
$img->set_visible(@all_layers);
for ($i=1; $i<=$frames ; $i++) {
$all_layers[$i-1]->set_name("Spin Layer $i (50ms)");
}
$all_layers[$frames-1]->set_name("Spin Layer SRC (250ms)");
if ($spinback) {
$all_layers[$frames/2-1]->set_name("Spin Layer DEST (250ms)");
}
else { $all_layers[0]->set_name("Spin Layer DEST (250ms)")}
# indexed conversion wants a display for some reason
if ($indexed) { $img->convert_indexed(1,255); }
gimp_palette_set_background($oldbackground);
gimp_displays_flush();
return();
};
exit main;

View file

@ -39,7 +39,7 @@ register
"Otherwise, it overwrites the current layer and uses a solid noise",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1999-03-15",
"19991119",
"<Image>/Filters/Render/Terral Text",
"RGB*,GRAY*",
[
@ -54,6 +54,8 @@ sub {
$oldbg = gimp_palette_get_background();
$oldfg = gimp_palette_get_foreground();
$img->undo_push_group_start;
if ($solidnoise) {
$pattern->plug_in_solid_noise(1,1,256*rand(), 1,2.5,2.5);
}
@ -96,6 +98,8 @@ sub {
$mask->levels(0, 0, 113, 0.24, 0, 255);
$img->undo_push_group_end;
palette_set_background($oldbg);
palette_set_foreground($oldfg);
return;