Commit 9e274a71 authored by Marc Lehmann's avatar Marc Lehmann

see plug-ins/perl/Changes

parent 1efdbb0e
......@@ -7,6 +7,8 @@ Revision history for Gimp-Perl extension.
- (some) changes for the gimp api renaming.
- added export capabilities to miff/avi.
- fixed "dirty" identifier clash with <= 5.005_03 && PERL_POLLUTE.
- updated seth's scripts.
- improved avi hunk skipping and 24 bit handling.
1.14 Mon Oct 11 03:23:13 CEST 1999
- set the version of all modules explicitly (for the benefit of CPAN).
......
......@@ -281,3 +281,26 @@ convert_15_24_inplace (datasv)
OUTPUT:
datasv
void
convert_bgr_rgb_inplace (datasv)
SV * datasv
CODE:
char *data, *end;
data = SvPV_nolen (datasv);
end = SvEND (datasv);
while (data < end)
{
char x = data[0];
data[0] = data[2];
data[2] = x;
data += 3;
}
OUTPUT:
datasv
......@@ -102,7 +102,6 @@ examples/goldenmean
examples/triangle
examples/billboard
examples/mirrorsplit
examples/oneliners
examples/randomart1
examples/colourtoalpha
examples/pixelmap
......
......@@ -5,7 +5,7 @@ use Config;
$|=1;
@examples =
qw(windy.pl prep4gif.pl webify.pl PDB tex-to-float ditherize.pl
qw(windify.pl prep4gif.pl webify.pl PDB tex-to-float ditherize.pl
border.pl view3d.pl feedback.pl xachlego.pl xachshadow.pl parasite-editor
scratches.pl blowinout.pl terral_text xachvision.pl perlcc gouge
sethspin.pl animate_cells image_tile yinyang stamps font_table
......
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
#!/usr/bin/perl
use Gimp qw( :auto );
use Gimp::Fu;
# alpha2color.pl
# by Seth Burgess <sjburges@gimp.org>
# Version 0.02
# Oct 16th, 1998
#
# This script simply changes the current alpha channel to a given color
# instead. I'm writing it primarily for use with the displace plugin,
# but I imagine it'll have other uses.
# TODO: Selection is currently ignored. It'd be better if it remembered
# what the previous selection was.
# Also, it needs to find a happier home than in the Filters/Misc menu.
# Gimp::set_trace(TRACE_ALL);
# Revision History
# v0.02 - fixed up @color (should be $color) and undef; (should be return();)
sub save_layers_state ($) {
$img = shift;
my @layers = $img->get_layers;
$i = 0;
foreach $lay (@layers) {
if ($lay->get_visible){
$arr[$i] = 1;
}
else {
$arr[$i] = 0;
}
$i++;
}
return @arr;
}
sub restore_layers_state($@) {
$img = shift;
@arr = @_;
my @layers = $img->get_layers;
$i = 0;
foreach $lay (@layers) {
$lay->set_visible($arr[$i]);
$i++;
}
}
sub alpha2col {
my ($img, $drawable, $color) = @_;
my $oldcolor = gimp_palette_get_background();
my @layers = gimp_image_get_layers($img);
# if there's not enough layers, abort.
if ($#layers < 0) {
gimp_message("You need at least 1 layer to perform alpha2color!");
print "Only ", scalar(@layers), " layers found!(", $layers[0],")\n";
return 0;
}
# Hide the bottom layer, so it doesn't get into the merge visible later.
@layer_visibilities = save_layers_state ($img);
# foreach $visible (@layer_visibilities) {
# print $visible, "\n";
# }
$target_layer = gimp_image_get_active_layer($img);
@offsets=$target_layer->offsets;
# print $target_layer, "\n";
foreach $eachlay (@layers) {
$eachlay->set_visible(0);
}
$target_layer->set_visible(1);
gimp_palette_set_background($color);
$newlay = $target_layer->copy(1);
$img->add_layer($newlay, 0);
$newlay->set_offsets(@offsets);
$target_layer->set_active_layer;
$img->selection_all;
$target_layer->edit_fill;
$img->selection_none;
$foreground = gimp_image_merge_visible_layers($img,0);
restore_layers_state($img, @layer_visibilities);
gimp_palette_set_background($oldcolor);
gimp_displays_flush();
return();
}
register
"plug_in_alpha2color",
"Alpha 2 Color",
"Change the current alpha to a selected color.",
"Seth Burgess",
"Seth Burgess<sjburges\@gimp.org>",
"2-15-98",
"<Image>/Image/Colors/Alpha2Color",
"RGBA",
[
[PF_COLOR, "color", "Color for current alpha", [127,127,127]]
],
\&alpha2col;
exit main;
<!--
Available WWWOFFLE Variables (all with a '$' prefix).
localhost = The hostname of the server running wwwoffled (='localhost:8080').
url = The URL that was asked for (='http://www.gimp.org/%7Esjburges/alpha2color.pl').
already = A flag to indicate that the page is already cached (='').
password = A one-time password to allow cancellation of the page (='0U3T7nn1gRTCe8Y3QkMQOg').
-->
<HEAD>
<TITLE>WWWOFFLE - Will Get http://www.gimp.org/%7Esjburges/alpha2color.pl</TITLE>
</HEAD>
<BODY>
<!-- Standard WWWOFFLE Message Page Top Banner -->
<p align=center>
<b>WWWOFFLE</b> - <b>W</b>orld <b>W</b>ide <b>W</b>eb <b>Offl</b>ine <b>E</b>xplorer
</p>
<hr>
<!-- Standard WWWOFFLE Message Page Top Banner -->
<H1 align=center>WWWOFFLE Request Recorded</H1>
<p align=center>
Your request for URL
<br>
<b><tt>http://www.gimp.org/%7Esjburges/alpha2color.pl</tt></b>
<br>
has been recorded for download.
</p>
<!--
Useful WWWOFFLE Buttons
-->
<p align=center>
[<a href="http://localhost:8080/control/delete-req/password=0U3T7nn1gRTCe8Y3QkMQOg?http://www.gimp.org/%7Esjburges/alpha2color.pl">Cancel</a>|Refresh:<a href="http://localhost:8080/refresh-options/?http://www.gimp.org/%7Esjburges/alpha2color.pl">Options</a>|<a href="http://localhost:8080/monitor-options/?http://www.gimp.org/%7Esjburges/alpha2color.pl">Monitor</a>|<a href="http://localhost:8080/index/url/?http://www.gimp.org/%7Esjburges/alpha2color.pl">Index</a>]
</p>
<!-- Standard WWWOFFLE Message Page Bottom Buttons -->
<hr>
<p align=center>
WWWOFFLE - [<a href="http://localhost:8080/Welcome.html">Welcome Page</a>|<a href="http://localhost:8080/FAQ.html">FAQ</a>] - WWWOFFLE
</p>
<!-- Standard WWWOFFLE Message Page Bottom Buttons -->
</BODY>
</HTML>
......@@ -29,7 +29,7 @@ register "file_avi_save",
"Saves images in the 24 bit uncompressed AVI format used by windows software",
"Marc Lehmann",
"Marc Lehmann <pcg\@goof.com>",
"1999-10-26",
"1999-11-08",
"<Save>/AVI",
"RGB",
[
......@@ -122,6 +122,7 @@ register "file_avi_save",
my $d = $r->get_rect2(0,0,$width,$height);
Gimp::RAW::convert_32_24_inplace $d if $r->bpp == 4;
Gimp::RAW::reverse_v_inplace $d, $width*3;
Gimp::RAW::convert_bgr_rgb_inplace $d if $depth == 24;
Gimp::RAW::convert_24_15_inplace $d if $depth == 16;
$idx1 .= "00db" . pack "V*", 16, tell FILE, $framesize if $index;
......@@ -177,10 +178,10 @@ sub skip_hunk {
register "file_avi_load",
"load uncompressed avi movie",
"Loads images that were saved in 24 bit uncompressed RGB AVI format used mainly by windows",
"Loads images that were saved in 15/24 bit uncompressed RGB AVI format used mainly by windows",
"Marc Lehmann",
"Marc Lehmann <pcg\@goof.com>",
"1999-09-14",
"1999-11-08",
"<Load>/AVI",
undef,
[],
......@@ -248,6 +249,7 @@ register "file_avi_load",
100,NORMAL_MODE);
Gimp::RAW::convert_15_24_inplace $comment if $depth == 16;
Gimp::RAW::convert_bgr_rgb_inplace $comment if $depth == 24;
Gimp::RAW::reverse_v_inplace $comment,$width*3;
(new PixelRgn $layer,0,0,$width,$height,1,0)->set_rect2($comment,0,0);
$layer->add_layer(0);
......@@ -257,8 +259,12 @@ register "file_avi_load",
"00dc" => sub { die "compressed data not handled\n" },
"01wb" => \&skip_hunk, # audio data
"idx1" => \&skip_hunk, # hunk index
"ISFT" => \&skip_hunk, # i? software?
"ICOP" => \&skip_hunk, # i? copyright?
"IDIT" => \&skip_hunk, # i? time stamp??
sub {
warn "skipping hunk (@_), please report!\n";
skip_hunk $_[1];
}
);
......
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
#!/usr/bin/perl -w
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;
<!--
Available WWWOFFLE Variables (all with a '$' prefix).
localhost = The hostname of the server running wwwoffled (='localhost:8080').
url = The URL that was asked for (='http://www.gimp.org/%7Esjburges/billboard').
already = A flag to indicate that the page is already cached (='').
password = A one-time password to allow cancellation of the page (='G2HohImsZPA9Rmi3igNl5Q').
-->
<HEAD>
<TITLE>WWWOFFLE - Will Get http://www.gimp.org/%7Esjburges/billboard</TITLE>
</HEAD>
<BODY>
<!-- Standard WWWOFFLE Message Page Top Banner -->
<p align=center>
<b>WWWOFFLE</b> - <b>W</b>orld <b>W</b>ide <b>W</b>eb <b>Offl</b>ine <b>E</b>xplorer
</p>
<hr>
<!-- Standard WWWOFFLE Message Page Top Banner -->
<H1 align=center>WWWOFFLE Request Recorded</H1>
<p align=center>
Your request for URL
<br>
<b><tt>http://www.gimp.org/%7Esjburges/billboard</tt></b>
<br>
has been recorded for download.
</p>
<!--
Useful WWWOFFLE Buttons
-->
<p align=center>
[<a href="http://localhost:8080/control/delete-req/password=G2HohImsZPA9Rmi3igNl5Q?http://www.gimp.org/%7Esjburges/billboard">Cancel</a>|Refresh:<a href="http://localhost:8080/refresh-options/?http://www.gimp.org/%7Esjburges/billboard">Options</a>|<a href="http://localhost:8080/monitor-options/?http://www.gimp.org/%7Esjburges/billboard">Monitor</a>|<a href="http://localhost:8080/index/url/?http://www.gimp.org/%7Esjburges/billboard">Index</a>]
</p>
<!-- Standard WWWOFFLE Message Page Bottom Buttons -->
<hr>
<p align=center>
WWWOFFLE - [<a href="http://localhost:8080/Welcome.html">Welcome Page</a>|<a href="http://localhost:8080/FAQ.html">FAQ</a>] - WWWOFFLE
</p>
<!-- Standard WWWOFFLE Message Page Bottom Buttons -->
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
#!/usr/bin/perl
# Revision 1.0: Released it
# 1.1: Marc Lehman added undo capability! <pcg@goof.com>
# 1.2: Added my email, and put it in "Noise" where it belongs
# <sjburges@gimp.org>
use Gimp;
use Gimp::Fu;
register "feedback",
"Take an image and feed it back onto itself multiple times",
"This plug-in simulates video feedback. It makes for kinda a neat desktop if you're into that sort of thing",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"2-15-99",
"<Image>/Filters/Noise/Feedback",
"RGB, GRAY",
[
[PF_SLIDER, "offset", "the amount the frames will offset", 3, [0, 255, 1]],
[PF_SLIDER, "repeat", "the number of times to repeat the illusion", 3, [0, 100, 1]],
],
sub {
my($img,$drawable,$offset,$repeat)=@_;
eval { $img->undo_push_group_start };
for (; $repeat>0; $repeat--) {
$drawable = $img->flatten;
$copylayer = $drawable->copy(1);
$img->add_layer($copylayer,0);
$copylayer->scale($img->width - $offset, $img->height - $offset, 0);
}
$img->flatten;
eval { $img->undo_push_group_end };
return();
};
exit main;
<!--
Available WWWOFFLE Variables (all with a '$' prefix).
localhost = The hostname of the server running wwwoffled (='localhost:8080').
url = The URL that was asked for (='http://www.gimp.org/%7Esjburges/feedback.pl').
already = A flag to indicate that the page is already cached (='').
password = A one-time password to allow cancellation of the page (='Bw7RTyicLuhCFPIb6HarMg').
-->
<HEAD>
<TITLE>WWWOFFLE - Will Get http://www.gimp.org/%7Esjburges/feedback.pl</TITLE>
</HEAD>
<BODY>
<!-- Standard WWWOFFLE Message Page Top Banner -->
<p align=center>
<b>WWWOFFLE</b> - <b>W</b>orld <b>W</b>ide <b>W</b>eb <b>Offl</b>ine <b>E</b>xplorer
</p>
<hr>
<!-- Standard WWWOFFLE Message Page Top Banner -->
<H1 align=center>WWWOFFLE Request Recorded</H1>
<p align=center>
Your request for URL
<br>
<b><tt>http://www.gimp.org/%7Esjburges/feedback.pl</tt></b>
<br>
has been recorded for download.
</p>
<!--
Useful WWWOFFLE Buttons
-->
<p align=center>
[<a href="http://localhost:8080/control/delete-req/password=Bw7RTyicLuhCFPIb6HarMg?http://www.gimp.org/%7Esjburges/feedback.pl">Cancel</a>|Refresh:<a href="http://localhost:8080/refresh-options/?http://www.gimp.org/%7Esjburges/feedback.pl">Options</a>|<a href="http://localhost:8080/monitor-options/?http://www.gimp.org/%7Esjburges/feedback.pl">Monitor</a>|<a href="http://localhost:8080/index/url/?http://www.gimp.org/%7Esjburges/feedback.pl">Index</a>]
</p>
<!-- Standard WWWOFFLE Message Page Bottom Buttons -->
<hr>
<p align=center>
WWWOFFLE - [<a href="http://localhost:8080/Welcome.html">Welcome Page</a>|<a href="http://localhost:8080/FAQ.html">FAQ</a>] - WWWOFFLE
</p>
<!-- Standard WWWOFFLE Message Page Bottom Buttons -->
</BODY>
</HTML>
#!/usr/bin/perl
use Gimp;
use Gimp::Fu;
use Gimp::Util;
# These are a couple of one-liners that you might find handy. Both should
# be undoable w/o any special magick, and work with any gimp.
# <sjburges@gimp.org>
register "layer_to_image_size", "Layer2ImageSize", "Expands layer to image size",
"Seth Burgess", "Seth Burgess <sjburges\@gimp.org>", "1.0",
__"<Image>/Layers/Layer to Image Size", "RGB*, GRAY*", [ ], sub {
($img, $layer) = @_;
$layer->resize($img->width, $img->height, $layer->offsets);
();
};
# <sjburges@gimp.org>
register "center_layer", "Center Layer",
"Centers the current layer on the image",
"Seth Burgess", "Seth Burgess <sjburges\@gimp.org>",
"1.0", __"<Image>/Layers/Center Layer", "RGB*, GRAY*", [], sub {
($img, $layer) = @_;
$layer->set_offsets(($img->width - $layer->width )/2,
($img->height - $layer->height)/2);
();
};
exit main;
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell