see plug-ins/perl/Changes

This commit is contained in:
Marc Lehmann 1999-04-09 01:28:14 +00:00
parent de98bdb546
commit 8650675f22
21 changed files with 411 additions and 108 deletions

View File

@ -1,7 +1,15 @@
Revision history for Gimp-Perl extension.
1.08 Fri Apr 9 03:20:54 CEST 1999
- added guidegrid, git-text, roundrectsel, repdup, centerguide,
stampify, goldenmean, triangle.
stampify, goldenmean, triangle, billboard, mirrorsplit.
- improved error detection when some moron forgets to 'use strict'
and tries to use undefined symbols.
- added VALUE, RED, GREEN, BLUE constants for gimp_levels.
- added WRAP, SMEAR, BLACK constants for plug_in_displace.
- RUN_WITH_LAST_VALS is ignored if no LAST_VALS exist.
- fixed a bug in Gimp::Data, FETCH returned undef for valid keys.
- small compatibility fix in scm2scm.
1.072 Sat Mar 27 21:04:39 CET 1999
- scripts will now be correctly installed when IN_GIMP.

View File

@ -13,7 +13,7 @@ use subs qw(init end lock unlock canonicalize_color);
require DynaLoader;
@ISA=qw(DynaLoader);
$VERSION = 1.072;
$VERSION = 1.08;
@_param = qw(
PARAM_BOUNDARY PARAM_CHANNEL PARAM_COLOR PARAM_DISPLAY PARAM_DRAWABLE
@ -56,6 +56,10 @@ $VERSION = 1.072;
BLUE_HUES MAGENTA_HUES
HORIZONTAL VERTICAL
VALUE RED GREEN BLUE
WRAP SMEAR BLACK
));
@_procs = qw(
@ -66,81 +70,90 @@ bootstrap Gimp $VERSION;
# defs missing from libgimp
sub BEHIND_MODE (){ 2 };
sub BEHIND_MODE (){ 2 }
sub FG_BG_RGB (){ 0 };
sub FG_BG_HSV (){ 1 };
sub FG_TRANS (){ 2 };
sub CUSTOM (){ 3 };
sub FG_BG_RGB (){ 0 }
sub FG_BG_HSV (){ 1 }
sub FG_TRANS (){ 2 }
sub CUSTOM (){ 3 }
sub LINEAR (){ 0 };
sub BILINEAR (){ 1 };
sub RADIAL (){ 2 };
sub SQUARE (){ 3 };
sub CONICAL_SYMMETRIC (){ 4 };
sub CONICAL_ASYMMETRIC (){ 5 };
sub SHAPEBURST_ANGULAR (){ 6 };
sub SHAPEBURST_SPHERICAL(){ 7 };
sub SHAPEBURST_DIMPLED (){ 8 };
sub SPIRAL_CLOCKWISE (){ 9 };
sub SPIRAL_ANTICLOCKWISE(){10 };
sub LINEAR (){ 0 }
sub BILINEAR (){ 1 }
sub RADIAL (){ 2 }
sub SQUARE (){ 3 }
sub CONICAL_SYMMETRIC (){ 4 }
sub CONICAL_ASYMMETRIC (){ 5 }
sub SHAPEBURST_ANGULAR (){ 6 }
sub SHAPEBURST_SPHERICAL(){ 7 }
sub SHAPEBURST_DIMPLED (){ 8 }
sub SPIRAL_CLOCKWISE (){ 9 }
sub SPIRAL_ANTICLOCKWISE(){10 }
sub REPEAT_NONE (){ 0 };
sub REPEAT_SAWTOOTH (){ 1 };
sub REPEAT_TRIANGULAR (){ 2 };
sub REPEAT_NONE (){ 0 }
sub REPEAT_SAWTOOTH (){ 1 }
sub REPEAT_TRIANGULAR (){ 2 }
sub FG_BUCKET_FILL (){ 0 };
sub BG_BUCKET_FILL (){ 1 };
sub PATTERN_BUCKET_FILL (){ 2 };
sub FG_BUCKET_FILL (){ 0 }
sub BG_BUCKET_FILL (){ 1 }
sub PATTERN_BUCKET_FILL (){ 2 }
sub RED_CHANNEL (){ 0 };
sub GREEN_CHANNEL (){ 1 };
sub BLUE_CHANNEL (){ 2 };
sub GRAY_CHANNEL (){ 3 };
sub INDEXED_CHANNEL (){ 4 };
sub RED_CHANNEL (){ 0 }
sub GREEN_CHANNEL (){ 1 }
sub BLUE_CHANNEL (){ 2 }
sub GRAY_CHANNEL (){ 3 }
sub INDEXED_CHANNEL (){ 4 }
sub WHITE_MASK (){ 0 };
sub BLACK_MASK (){ 1 };
sub ALPHA_MASK (){ 2 };
sub WHITE_MASK (){ 0 }
sub BLACK_MASK (){ 1 }
sub ALPHA_MASK (){ 2 }
sub APPLY (){ 0 };
sub DISCARD (){ 1 };
sub APPLY (){ 0 }
sub DISCARD (){ 1 }
sub EXPAND_AS_NECESSARY (){ 0 };
sub CLIP_TO_IMAGE (){ 1 };
sub CLIP_TO_BOTTOM_LAYER(){ 2 };
sub EXPAND_AS_NECESSARY (){ 0 }
sub CLIP_TO_IMAGE (){ 1 }
sub CLIP_TO_BOTTOM_LAYER(){ 2 }
sub SELECTION_ADD (){ 0 };
sub SELECTION_SUB (){ 1 };
sub SELECTION_REPLACE (){ 2 };
sub SELECTION_INTERSECT (){ 3 };
sub SELECTION_ADD (){ 0 }
sub SELECTION_SUB (){ 1 }
sub SELECTION_REPLACE (){ 2 }
sub SELECTION_INTERSECT (){ 3 }
sub PIXELS (){ 0 };
sub POINTS (){ 1 };
sub PIXELS (){ 0 }
sub POINTS (){ 1 }
sub IMAGE_CLONE (){ 0 };
sub PATTERN_CLONE (){ 1 };
sub IMAGE_CLONE (){ 0 }
sub PATTERN_CLONE (){ 1 }
sub BLUR (){ 0 };
sub SHARPEN (){ 1 };
sub BLUR (){ 0 }
sub SHARPEN (){ 1 }
sub ALL_HUES (){ 0 };
sub RED_HUES (){ 1 };
sub YELLOW_HUES (){ 2 };
sub GREEN_HUES (){ 3 };
sub CYAN_HUES (){ 4 };
sub BLUE_HUES (){ 5 };
sub MAGENTA_HUES (){ 6 };
sub ALL_HUES (){ 0 }
sub RED_HUES (){ 1 }
sub YELLOW_HUES (){ 2 }
sub GREEN_HUES (){ 3 }
sub CYAN_HUES (){ 4 }
sub BLUE_HUES (){ 5 }
sub MAGENTA_HUES (){ 6 }
sub MESSAGE_BOX (){ 0 };
sub CONSOLE (){ 1 };
sub MESSAGE_BOX (){ 0 }
sub CONSOLE (){ 1 }
sub SHADOWS (){ 0 };
sub MIDTONES (){ 1 };
sub HIGHLIGHTS (){ 2 };
sub SHADOWS (){ 0 }
sub MIDTONES (){ 1 }
sub HIGHLIGHTS (){ 2 }
sub HORIZONTAL (){ 0 };
sub VERTICAL (){ 1 };
sub HORIZONTAL (){ 0 }
sub VERTICAL (){ 1 }
sub VALUE (){ 0 }
sub RED (){ 1 }
sub GREEN (){ 2 }
sub BLUE (){ 3 }
sub WRAP (){ 0 }
sub SMEAR (){ 1 }
sub BLACK (){ 2 }
# internal constants shared with Perl-Server

View File

@ -12,7 +12,7 @@ sub TIEHASH {
sub FETCH {
eval { Gimp->find_parasite ($_[1])->data }
|| $@ ? Gimp->get_data ($_[1]) : ();
|| ($@ ? Gimp->get_data ($_[1]) : ());
}
sub STORE {

View File

@ -933,15 +933,23 @@ sub register($$$$$$$$$;@) {
for (0..$#{$params}) {
$_[$_]=$params->[$_]->[3] unless defined($_[$_]);
}
if ($run_mode == &Gimp::RUN_INTERACTIVE) {
if (@_) {
my $res;
local $^W=0; # perl -w is braindamaged
my $VAR1; # Data::Dumper is braindamaged
# gimp is braindamaged, is doesn't deliver useful values!!
($res,@_)=interact($function,$blurb,$help,$params,@{eval $Gimp::Data{"$function/_fu_data"}});
return unless $res;
if ($run_mode == &Gimp::RUN_INTERACTIVE
|| $run_mode == &Gimp::RUN_WITH_LAST_VALS) {
my $fudata = $Gimp::Data{"$function/_fu_data"};
my $VAR1; # Data::Dumper is braindamaged
local $^W=0; # perl -w is braindamaged
if ($run_mode == &Gimp::RUN_WITH_LAST_VALS && $fudata ne "") {
@_ = @{eval $fudata};
} else {
if (@_) {
my $res;
local $^W=0; # perl -w is braindamaged
# gimp is braindamaged, is doesn't deliver useful values!!
($res,@_)=interact($function,$blurb,$help,$params,@{eval $fudata});
return unless $res;
}
}
} elsif ($run_mode == &Gimp::RUN_FULLINTERACTIVE) {
my($res);
@ -949,9 +957,6 @@ sub register($$$$$$$$$;@) {
undef @pre;
return unless $res;
} elsif ($run_mode == &Gimp::RUN_NONINTERACTIVE) {
} elsif ($run_mode == &Gimp::RUN_WITH_LAST_VALS) {
my $VAR1; # Data::Dumper is braindamaged
@_=@{eval $Gimp::Data{"$function/_fu_data"}};
} else {
die "run_mode must be INTERACTIVE, NONINTERACTIVE or WITH_LAST_VALS\n";
}

View File

@ -564,6 +564,50 @@ canonicalize_colour (char *err, SV *sv, GParamColor *c)
LEAVE;
}
/* check for common typoes. */
static void check_for_typoe (char *croak_str, char *p)
{
STRLEN dc;
char b[80];
dTHR;
g_snprintf (b, sizeof b, "%s_MODE", p); if (perl_get_cv (b, 0)) goto gotit;
g_snprintf (b, sizeof b, "%s_MASK", p); if (perl_get_cv (b, 0)) goto gotit;
g_snprintf (b, sizeof b, "SELECTION_%s", p); if (perl_get_cv (b, 0)) goto gotit;
g_snprintf (b, sizeof b, "%s_IMAGE", p); if (perl_get_cv (b, 0)) goto gotit;
strcpy (b, "1"); if (strEQ (b, "TRUE" )) goto gotit;
strcpy (b, "0"); if (strEQ (b, "FALSE")) goto gotit;
return;
gotit:
sprintf (croak_str, "Expected an INT32 but got '%s'. Maybe you meant '%s' instead and forgot to 'use strict'", p, b);
}
/* check for 'enumeration types', i.e. integer constants. do not allow
string constants here, and check for common typoes. */
static int check_int (char *croak_str, SV *sv)
{
dTHR;
if (SvTYPE (sv) == SVt_PV && !SvIOKp(sv))
{
STRLEN dc;
char *p = SvPV (sv, dc);
if (*p
&& *p != '0' && *p != '1' & *p != '2' && *p != '3' && *p != '4'
&& *p != '5' && *p != '6' & *p != '7' && *p != '8' && *p != '9')
{
sprintf (croak_str, "Expected an INT32 but got '%s'. Add '*1' if you really intend to pass in a string", p);
check_for_typoe (croak_str, p);
return 0;
}
}
return 1;
}
/* replacement newSVpv with only one argument. */
#define neuSVpv(arg) newSVpv((arg),0)
@ -699,7 +743,8 @@ convert_sv2gimp (char *croak_str, GParam *arg, SV *sv)
switch (arg->type)
{
case PARAM_INT32: arg->data.d_int32 = sv2gimp_extract_noref (SvIV, "INT32");
case PARAM_INT32: check_int (croak_str, sv);
arg->data.d_int32 = sv2gimp_extract_noref (SvIV, "INT32");
case PARAM_INT16: arg->data.d_int16 = sv2gimp_extract_noref (SvIV, "INT16");
case PARAM_INT8: arg->data.d_int8 = sv2gimp_extract_noref (SvIV, "INT8");
case PARAM_FLOAT: arg->data.d_float = sv2gimp_extract_noref (SvNV, "FLOAT");;

View File

@ -83,3 +83,6 @@ examples/centerguide
examples/stampify
examples/goldenmean
examples/triangle
examples/billboard
examples/mirrorsplit

View File

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

View File

@ -16,6 +16,8 @@ bugs
[KILL] * perl_fu_webify in homepage-logo.pl
* wait for working gimp_file_load (or do it myself?)
* get rid of xs_exit. please please fuck me plenty.
* do not install scm2scm and scm2perl on 56.004
* create gimpstyle.pod
important issues

171
plug-ins/perl/examples/billboard Executable file
View File

@ -0,0 +1,171 @@
#!/usr/bin/perl -w
# 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;
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, $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);
$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,255); }
Palette->set_background($oldbackground);
gimp_displays_flush();
return();
};
exit main;

View File

@ -8,7 +8,7 @@ register "gimp_fu_example_script", # fill in a function name
"Just a starting point to derive new ". # a (possibly multiline) help text
"scripts. Always remember to put a long".
"help message here!",
"Marc Lehmann", # don't forget your name (author)
"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

View File

@ -104,10 +104,7 @@ sub font_table {
}
return undef; # This may generate a warning, but it's better than
# getting a duplicate image, which is what I get if I
# return $lastimg
# return $lastimg;
return ();
}
sub display_fonts {

View File

@ -17,7 +17,7 @@ sub goldenmean {
}
$img = gimp_image_new($width, $height, RGB);
$layer = gimp_layer_new($img, $width, $height, RGB, "Layer 1", 100, NORMAL_MODE);
$layer = gimp_layer_new($img, $width, $height, RGB_IMAGE, "Layer 1", 100, NORMAL_MODE);
gimp_image_add_layer($layer, -1);
gimp_palette_set_background([255, 255, 255]);

View File

@ -0,0 +1,55 @@
#!/usr/bin/perl
use Gimp qw( :auto );
use Gimp::Fu;
register "MirrorSplit",
"Splits and mirrors half of the image, according to settings.",
"Just tick appropriate radio button.",
"Claes G Lindblad <claesg\@algonet.se>",
"Claes G Lindblad <claesg\@algonet.se>",
"990405",
"<Image>/Filters/Distorts/MirrorSplit",
"*",
[
[PF_RADIO, "mirror", "Which half to mirror?", 0,
[Upper => 0, Lower => 1, Left => 2, Right => 3]
]
],
sub {
my ($img, $layer, $mirror) = @_;
$w = $layer->width();
$h = $layer->height();
$wspan = int ($w / 2 + 0.5);
$hspan = int ($h / 2 + 0.5);
eval { $img->undo_push_group_start };
my $oldname = gimp_layer_get_name($layer);
my $temp1 = gimp_layer_copy($layer, 1);
gimp_image_add_layer($img, $temp1, 0);
if ($mirror == 0) { # upper half
$temp2 = gimp_flip($temp1, VERTICAL);
gimp_rect_select($img, 0, 0, $w, $hspan, SELECTION_REPLACE, 0, 0);
};
if ($mirror == 1) { # lower half
$temp2 = gimp_flip($temp1, VERTICAL);
gimp_rect_select($img, 0, $hspan, $w, $h - $hspan, SELECTION_REPLACE, 0, 0);
};
if ($mirror == 2) { # left half
$temp2 = gimp_flip($temp1, HORIZONTAL);
gimp_rect_select($img, 0, 0, $wspan, $h, SELECTION_REPLACE, 0, 0);
};
if ($mirror == 3) { # right half
$temp2 = gimp_flip($temp1, HORIZONTAL);
gimp_rect_select($img, $wspan, 0, $w - $wspan, $h, SELECTION_REPLACE, 0, 0);
};
gimp_edit_cut($temp2);
my $temp3 = gimp_image_merge_down($img, $temp2, 2);
gimp_layer_set_name($temp3, $oldname);
eval { $img->undo_push_group_end };
return $img;
};
exit main;

View File

@ -35,7 +35,7 @@ sub prep {
if ($#layers <= 0) {
gimp_message("You need at least 2 layers to perform prep4gif");
print "Only ", scalar(@layers), " layers found!(", $layers[0],")\n";
return 0;
return;
}
# Show the image early - this makes debugging a breeze
@ -85,7 +85,7 @@ sub prep {
# Show all the changes.
gimp_displays_flush();
undef;
();
}
register

View File

@ -14,7 +14,7 @@ register "RepDup",
"<Image>/Edit/Repeat & Duplicate",
"*",
[
[PF_SPINNER, "repeats", "Number of repetitions",
[PF_SPINNER, "repeats", "Number of repeats",
3, [1, 1000, 1] ],
[PF_SPINNER, "xoffset", "X-offset",
50, [-1000, 1000, 1] ],
@ -33,7 +33,7 @@ register "RepDup",
for ($i = 0; $i < $repeats; $i++) {
$b[1] = $b[1] + $xoffset;
$b[2] = $b[2] + $yoffset;
gimp_rect_select($img, $b[1], $b[2], $w, $h, REPLACE, 0, 0);
gimp_rect_select($img, $b[1], $b[2], $w, $h, SELECTION_REPLACE, 0, 0);
$bit_bucket = gimp_edit_paste($layer, 0);
gimp_floating_sel_anchor($bit_bucket);
gimp_selection_none($img);

View File

@ -34,6 +34,8 @@ register "scratches",
[PF_SPINNER , "length" , "The scratch length" , 10, [ 0, 400]],
#[PF_BOOL, , "bump_map" , "Use bump map instead of displace", 0],
],
[],
['gimp-1.1'],
sub {
my($image,$drawable,$anglex,$angley,$gamma,$length,$width)=@_;

View File

@ -44,7 +44,7 @@ sub spin_layer { # the function for actually spinning the layer
# Now lets spin it!
$stepsize = 3.14159/$numframes; # in radians
for ($i=0; $i<=3.14159; $i+=$stepsize) {
Gimp->progress_update ($i/0.0314159);
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);

View File

@ -11,7 +11,7 @@ register "Stampify",
"Claes G Lindblad <claesg\@algonet.se>",
"Claes G Lindblad <claesg\@algonet.se>",
"990328",
"<Image>/Filters/Decor/Stampify",
"<Image>/Script-Fu/Decor/Stampify",
"*",
[
[PF_COLOR, "paper", "Paper colour", [242, 242, 242]],

View File

@ -4,50 +4,52 @@ use Gimp qw( :auto );
use Gimp::Fu;
sub stamps {
my ($size, $bgcolor, $fgcolor, $diameter, $gap) = @_;
my ($size, $hole, $paper, $diameter, $gap) = @_;
gimp_palette_set_background($fgcolor);
gimp_palette_set_background($paper);
$img = gimp_image_new($size, $size, RGB);
$layer = gimp_layer_new($img, $size, $size, RGB, "Layer 1", 100, NORMAL_MODE);
$layer = gimp_layer_new($img, $size, $size, RGB_IMAGE, "Layer 1", 100, NORMAL_MODE);
gimp_image_add_layer($layer, -1);
gimp_palette_set_background($bgcolor);
gimp_palette_set_background($hole);
$layer->gimp_edit_fill;
gimp_selection_none($img);
gimp_palette_set_background($fgcolor);
my $ncircles = int(($size + $gap) / ($diameter + $gap));
$x = 0;
for ($i=0; $i<$ncircles; $i++) {
gimp_ellipse_select($img,
$x, 0,
$diameter, $diameter,
REPLACE, 1, 0, 0);
SELECTION_ADD, 1, 0, 0);
gimp_ellipse_select($img,
0, $x,
$diameter, $diameter,
REPLACE, 1, 0, 0);
SELECTION_ADD, 1, 0, 0);
$x = $x + $diameter + $gap;
gimp_palette_set_foreground($fgcolor);
gimp_edit_fill($layer);
gimp_selection_none($img);
}
gimp_palette_set_background($paper);
gimp_edit_fill($layer);
gimp_selection_none($img);
# here, at last, comes the clever part! :-)
$layer->channel_ops_offset(1, 0, -($diameter / 2), -($diameter / 2));
return $img;
}
register "stamps",
"Makes stamp-like perforations",
"Creates a rectangular image with stamp-like perforations.",
"Default values are not bad!",
"claesg\@algonet.se",
"Claes G Lindblad",
"Claes G Lindblad <claesg\@algonet.se>",
"Claes G Lindblad <claesg\@algonet.se>",
"990314",
"<Toolbox>/Xtns/Render/Stamps",
"*",
[
[PF_INT32, "size", "Img size", 90],
[PF_COLOR, "fgcolor", "fg color", [255, 255, 255]],
[PF_COLOR, "bgcolor", "bg color", [0, 0, 0]],
[PF_INT32, "diameter", "Diameter", 10],
[PF_INT32, "gap", "Gap", 5]
[PF_INT32, "size", "img size", 90],
[PF_COLOR, "paper", "paper color", [255, 255, 255]],
[PF_COLOR, "hole", "hole color", [0, 0, 0]],
[PF_INT32, "diameter", "diameter", 10],
[PF_INT32, "gap", "gap", 5]
],
\&stamps;

View File

@ -101,7 +101,7 @@ sub grey_file_to_float {
gimp_undo_push_group_start($img1);
# Load the new img
my $grey_img = gimp_file_load(RUN_NON_INTERACTIVE, $fn, $fn);
my $grey_img = gimp_file_load(RUN_NONINTERACTIVE, $fn, $fn);
# Get name of new layer
my $grey_layer = gimp_image_get_active_layer($grey_img);

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl
require 5.005;
use 5.005;
# Copyright Marc Lehmann <pcg@goof.com>
#