From a30b735a87ad40eccc1fe5c96e9a4aefc226a7a1 Mon Sep 17 00:00:00 2001 From: Marc Lehmann Date: Fri, 19 Nov 1999 20:06:56 +0000 Subject: [PATCH] see plug-ins/perl/Changes --- plug-ins/perl/Changes | 6 +- plug-ins/perl/Gimp.pm | 29 ++--- plug-ins/perl/Gimp/Compat.pm | 2 +- plug-ins/perl/Gimp/Lib.pm | 2 +- plug-ins/perl/Gimp/Lib.xs | 3 +- plug-ins/perl/Gimp/Module.pm | 2 +- plug-ins/perl/Gimp/Pod.pm | 2 +- plug-ins/perl/Gimp/Util.pm | 2 +- plug-ins/perl/MANIFEST | 2 - plug-ins/perl/Makefile.PL | 6 +- plug-ins/perl/Net/Net.pm | 2 +- plug-ins/perl/Perl-Server | 2 +- plug-ins/perl/UI/UI.pm | 2 +- plug-ins/perl/examples/billboard | 190 ---------------------------- plug-ins/perl/examples/ditherize.pl | 19 ++- plug-ins/perl/examples/innerbevel | 2 + plug-ins/perl/examples/sethspin.pl | 167 ------------------------ plug-ins/perl/examples/terral_text | 6 +- 18 files changed, 51 insertions(+), 395 deletions(-) delete mode 100755 plug-ins/perl/examples/billboard delete mode 100755 plug-ins/perl/examples/sethspin.pl diff --git a/plug-ins/perl/Changes b/plug-ins/perl/Changes index 22fcf44035..fc5a87ef6b 100644 --- a/plug-ins/perl/Changes +++ b/plug-ins/perl/Changes @@ -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). diff --git a/plug-ins/perl/Gimp.pm b/plug-ins/perl/Gimp.pm index 6822efcb42..0897414e0d 100644 --- a/plug-ins/perl/Gimp.pm +++ b/plug-ins/perl/Gimp.pm @@ -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; } diff --git a/plug-ins/perl/Gimp/Compat.pm b/plug-ins/perl/Gimp/Compat.pm index 451cee91d1..462abfdae6 100644 --- a/plug-ins/perl/Gimp/Compat.pm +++ b/plug-ins/perl/Gimp/Compat.pm @@ -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', '__'); diff --git a/plug-ins/perl/Gimp/Lib.pm b/plug-ins/perl/Gimp/Lib.pm index f7837c102c..f519805002 100644 --- a/plug-ins/perl/Gimp/Lib.pm +++ b/plug-ins/perl/Gimp/Lib.pm @@ -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 diff --git a/plug-ins/perl/Gimp/Lib.xs b/plug-ins/perl/Gimp/Lib.xs index 965c4a48dd..7effa7042d 100644 --- a/plug-ins/perl/Gimp/Lib.xs +++ b/plug-ins/perl/Gimp/Lib.xs @@ -1464,7 +1464,7 @@ gimp_call_procedure (proc_name, ...) GParamDef *params; GParamDef *return_vals; int i=0, j=0; /* work around bogus warning. */ - + if (!gimp_is_initialized) croak ("gimp_call_procedure(%s,...) called without an active connection", proc_name); @@ -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); } diff --git a/plug-ins/perl/Gimp/Module.pm b/plug-ins/perl/Gimp/Module.pm index 0fa36cd470..d8a40fb21b 100644 --- a/plug-ins/perl/Gimp/Module.pm +++ b/plug-ins/perl/Gimp/Module.pm @@ -19,7 +19,7 @@ package Gimp::Module; use base qw(DynaLoader); require DynaLoader; -$VERSION=1.15; +$VERSION=1.16; bootstrap Gimp::Module; diff --git a/plug-ins/perl/Gimp/Pod.pm b/plug-ins/perl/Gimp/Pod.pm index a953d316ba..48ce7ad508 100644 --- a/plug-ins/perl/Gimp/Pod.pm +++ b/plug-ins/perl/Gimp/Pod.pm @@ -1,6 +1,6 @@ package Gimp::Pod; -$VERSION=1.15; +$VERSION=1.16; sub myqx(&) { local $/; diff --git a/plug-ins/perl/Gimp/Util.pm b/plug-ins/perl/Gimp/Util.pm index f26061fda5..fb7127ed0a 100644 --- a/plug-ins/perl/Gimp/Util.pm +++ b/plug-ins/perl/Gimp/Util.pm @@ -51,7 +51,7 @@ require Exporter; use Gimp; -$VERSION=1.15; +$VERSION=1.16; ############################################################################## =pod diff --git a/plug-ins/perl/MANIFEST b/plug-ins/perl/MANIFEST index 17b4177a0e..25cb54b433 100644 --- a/plug-ins/perl/MANIFEST +++ b/plug-ins/perl/MANIFEST @@ -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 diff --git a/plug-ins/perl/Makefile.PL b/plug-ins/perl/Makefile.PL index 3347337ed9..99bc24e7cb 100644 --- a/plug-ins/perl/Makefile.PL +++ b/plug-ins/perl/Makefile.PL @@ -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 "; diff --git a/plug-ins/perl/Net/Net.pm b/plug-ins/perl/Net/Net.pm index fd1fd814cd..a83111258f 100644 --- a/plug-ins/perl/Net/Net.pm +++ b/plug-ins/perl/Net/Net.pm @@ -19,7 +19,7 @@ use Gimp ('croak','__'); require DynaLoader; -$VERSION = 1.15; +$VERSION = 1.16; bootstrap Gimp::Net $VERSION; diff --git a/plug-ins/perl/Perl-Server b/plug-ins/perl/Perl-Server index 7ba6db0800..b7d47483cf 100755 --- a/plug-ins/perl/Perl-Server +++ b/plug-ins/perl/Perl-Server @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -Dt # # you can enable unix sockets, tcp sockets, or both (or neither...) diff --git a/plug-ins/perl/UI/UI.pm b/plug-ins/perl/UI/UI.pm index 97df1c5cb8..9383bd8bc0 100644 --- a/plug-ins/perl/UI/UI.pm +++ b/plug-ins/perl/UI/UI.pm @@ -7,7 +7,7 @@ use base 'DynaLoader'; BEGIN { require DynaLoader; - $VERSION = 1.15; + $VERSION = 1.16; bootstrap Gimp::UI $VERSION; } diff --git a/plug-ins/perl/examples/billboard b/plug-ins/perl/examples/billboard deleted file mode 100755 index 4c514fda4a..0000000000 --- a/plug-ins/perl/examples/billboard +++ /dev/null @@ -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 -# - -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 ", - "1.3", - __"/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; - diff --git a/plug-ins/perl/examples/ditherize.pl b/plug-ins/perl/examples/ditherize.pl index cb33c2f136..d27b6d43da 100755 --- a/plug-ins/perl/examples/ditherize.pl +++ b/plug-ins/perl/examples/ditherize.pl @@ -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", __"/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; + (); }; diff --git a/plug-ins/perl/examples/innerbevel b/plug-ins/perl/examples/innerbevel index 7d38cfcea6..c079039c6e 100755 --- a/plug-ins/perl/examples/innerbevel +++ b/plug-ins/perl/examples/innerbevel @@ -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 { ; print "HO\n"; } + use Gimp; use Gimp::Fu; use Gimp::Util; diff --git a/plug-ins/perl/examples/sethspin.pl b/plug-ins/perl/examples/sethspin.pl deleted file mode 100755 index 8b2c0fac41..0000000000 --- a/plug-ins/perl/examples/sethspin.pl +++ /dev/null @@ -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 -# - -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 ", - "1.3", - "/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; - diff --git a/plug-ins/perl/examples/terral_text b/plug-ins/perl/examples/terral_text index f609afe742..8f826b3dbf 100644 --- a/plug-ins/perl/examples/terral_text +++ b/plug-ins/perl/examples/terral_text @@ -39,7 +39,7 @@ register "Otherwise, it overwrites the current layer and uses a solid noise", "Seth Burgess", "Seth Burgess ", - "1999-03-15", + "19991119", "/Filters/Render/Terral Text", "RGB*,GRAY*", [ @@ -53,6 +53,8 @@ sub { ($img, $pattern, $solidnoise, $font, $text, $blur) = @_; $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;