see plug-ins/perl/Changes

This commit is contained in:
Marc Lehmann
1999-05-03 19:29:05 +00:00
parent 030009d780
commit a5d2c6d2bd
45 changed files with 456 additions and 455 deletions

View File

@ -11,6 +11,7 @@ Revision history for Gimp-Perl extension.
- replaced the default colour database by something far better.
- exchanged order of some compiler commandline arguments.
- improved Makefile support for embed.
- added embed.
1.08 Fri Apr 9 03:20:54 CEST 1999
- added guidegrid, git-text, roundrectsel, repdup, centerguide,

View File

@ -34,7 +34,7 @@ sub Create_Image {
my($Image,$Text_Layer,$Background_Layer,$Width,$Height);
# Let's see if we can plug a little daemon in here.
$border = 10;
$size = 100;
$Background_Colour = $white;
@ -43,10 +43,10 @@ sub Create_Image {
# Create an image. We'll just set whatever size here because we want
# to resize the image when we figure out how big the text is.
$Image = gimp_image_new(256,256,RGB);
# Create a layer for the text.
$Text_Layer = gimp_text($Image,-1,0,0,$text,$border,1,$size,PIXELS,"*",$font,"*","*","*","*");
# Do the fun stuff with the text.
gimp_palette_set_background($Text_Colour);
gimp_layer_set_preserve_trans($Text_Layer, TRUE);
@ -55,37 +55,37 @@ sub Create_Image {
# Now figure out the size of $Text_Layer.
$Width = gimp_drawable_width($Text_Layer);
$Height = gimp_drawable_height($Text_Layer);
# Create a layer for the background based on the size of the text.
$Background_Layer = gimp_layer_new($Image,$Width,$Height,RGB_IMAGE,"Background",100,NORMAL_MODE);
# Resize the $Image based on size of text.
gimp_image_resize($Image,$Width,$Height,0,0);
# Add the $Background_Layer to the image.
gimp_image_add_layer($Image, $Background_Layer, 1);
# Set the background colour and fill it in with that colour.
gimp_palette_set_background($Background_Colour);
gimp_drawable_fill($Background_Layer,BG_IMAGE_FILL);
#index_and_save ($Image, "/tmp/${text}_" . ".gif");
gimp_display_new ($Image) if $example;
#gimp_image_delete($Image) unless $example;
}
sub extension_create_images {
#Get our list of strings that we want to make images with.
$Image_Directory = "/tmp";
$active = 0;
open(IMAGE_LIST, "/tmp/image_list");
while( <IMAGE_LIST> ) {
chop;
Create_Image (split(/\|/));

View File

@ -201,7 +201,7 @@ sub complete_function {
sub complete_type {
my($type,$name,$desc)=@_;
if($type==PARAM_IMAGE) {
set_clist(map(("$$_: ".$_->get_filename,$$_),Gimp->list_images));
} elsif($type==PARAM_LAYER) {
@ -233,14 +233,14 @@ sub complete_type {
sub update_completion {
my($idx,$pos,@words)=get_words;
return unless $idx ne $last_arg;
eval { $argsvalid[$last_arg-1]->set('+') };
$last_arg=$idx;
eval { $argsvalid[$last_arg-1]->set('>') };
set_current_function $words[0];
if ($idx == 0) {
complete_function($words[0]);
} elsif ($idx>@args) {
@ -253,10 +253,10 @@ sub update_completion {
sub do_completion {
update_completion;
my($idx,$pos,@words)=get_words;
my($word)=$words[$idx];
$word=~s/[-_]/[-_]/g;
my(@matches)=grep /$word/i,keys %completion;
my $new;
@ -334,7 +334,7 @@ sub inputline {
$e->signal_connect("activate",\&execute_command);
$e->set_usize($ex*40,0);
$inputline=$e;
my $c = new Gtk::List;
$clist = $c;
$c->set_selection_mode(-single);
@ -351,7 +351,7 @@ sub inputline {
};
do_idle;
});
my $r = new Gtk::List;
$rlist = $r;
$r->set_selection_mode(-single);
@ -361,52 +361,52 @@ sub inputline {
sub create_main {
my $b;
my $t;
parse Gtk::Rc Gimp->gtkrc;
$t = new Gtk::Tooltips;
my $w = new Gtk::Dialog;
$window = $w;
$w->realize;
$ex = $w->style->font->string_width ('Mn')*0.5;
$w->set_title('PDB Explorer - the alpha version');
$w->signal_connect("destroy",sub {main_quit Gtk});
$b = new Gtk::Button "Close";
$w->action_area->add($b);
$b->signal_connect("clicked",sub {main_quit Gtk});
my $h = new Gtk::HBox (0,5);
$w->vbox->add ($h);
inputline;
$synopsis = new Gtk::Label "";
$synopsis->set_justify(-left);
my $table = new Gtk::Table 3,4,0;
$w->vbox->add($table);
my $cs = new Gtk::ScrolledWindow undef,undef;
$cs->set_policy(-automatic,-automatic);
$gtk_10 ? $cs->add ($clist) : $cs->add_with_viewport ($clist);
my $rs = new Gtk::ScrolledWindow undef,undef;
$rs->set_policy(-automatic,-automatic);
$gtk_10 ? $rs->add ($rlist) : $rs->add_with_viewport ($rlist);
$rs->set_usize(0,200);
$result = new Gtk::Entry;
$result->set_editable(0);
$result->set_usize($ex*30,0);
$statusbar = new Gtk::Label;
realize $window;
$table->border_width(10);
$table->attach(new Gtk::Label("Synopsis") ,0,1,0,1,{},{},0,0);
$table->attach($synopsis ,1,2,0,1,{},{},0,0);
#$table->attach(logo(),2,3,0,1,{},{},0,0);
@ -423,9 +423,9 @@ sub create_main {
$cinfo->border_width(10);
$cinfo->add (new_cinfo);
$w->vbox->add ($cinfo);
idle;
show_all $w;
}
@ -439,12 +439,12 @@ register "extension_pdb_explorer",
"",
[],
sub {
Gimp::init_gtk;
refresh;
create_main;
main Gtk;
();
};

View File

@ -9,7 +9,7 @@ use Gimp::Fu;
# 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,
# 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
@ -47,8 +47,8 @@ sub restore_layers_state($@) {
$i++;
}
}
sub alpha2col {
my ($img, $drawable, $color) = @_;
@ -57,7 +57,7 @@ sub alpha2col {
my @layers = gimp_image_get_layers($img);
# if there's not enough layers, abort.
# 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";
@ -75,11 +75,11 @@ sub alpha2col {
# 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);
$img->add_layer($newlay, 0);
$newlay->set_offsets(@offsets);
$target_layer->set_active_layer;
@ -88,9 +88,9 @@ sub alpha2col {
$img->selection_none;
$foreground = gimp_image_merge_visible_layers($img,0);
restore_layers_state($img, @layer_visibilities);
restore_layers_state($img, @layer_visibilities);
gimp_palette_set_background($oldcolor);
gimp_displays_flush();
return();
@ -110,5 +110,5 @@ register
],
\&alpha2col;
exit main;
exit main;

View File

@ -1,15 +1,15 @@
#!/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
# 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...
# a bit ugly, look at this one...
# I think it was tigert that suggested this. It turned out to be less
# 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>
@ -25,20 +25,20 @@ sub saw { # a sawtooth function on PI
return ($val/3.14159) ;
}
elsif ($val < 3.14159) {
return (-1+$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);
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
$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
@ -54,17 +54,17 @@ sub spin_layer { # the function for actually spinning the layer
# 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[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);
$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
$backlayer->fill(1); # BG-IMAGE-FILL
}
for ($i=0; $i<$numframes; $i++) {
@all_layers = $img->get_layers();
@ -75,7 +75,7 @@ sub spin_layer { # the function for actually spinning the layer
$destfram = $all_layers[$numframes]->copy(0);
$img->add_layer($destfram,0);
# clean up my temporary layers
# clean up my temporary layers
$img->remove_layer($all_layers[$numframes]);
$img->remove_layer($all_layers[$numframes+1]);
}
@ -107,7 +107,7 @@ register "billboard",
$img = gimp_image_new($maxwide, $maxhigh, RGB);
$tmpimglayer = $img->add_new_layer(0,3,1);
$tmpimglayer = $img->add_new_layer(0,3,1);
$img->display_new;
Gimp->progress_init("Billboard...",-1);
$oldbackground = gimp_palette_get_background();
@ -134,33 +134,33 @@ register "billboard",
}
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->set_visible($img->add_new_layer(1),($img->get_layers)[0]);
$img->merge_visible_layers(0);
if ($spinback) {
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)");
$all_layers[$frames-1]->set_name("Spin Layer SRC (250ms)");
if ($spinback) {
$all_layers[$frames/2-1]->set_name("Spin Layer DEST (250ms)");
$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); }
if ($indexed) { $img->convert_indexed(1,255); }
Palette->set_background($oldbackground);
gimp_displays_flush();

View File

@ -11,7 +11,7 @@ use Gimp::Fu;
# Gimp::set_trace(TRACE_CALL);
sub blowinout {
sub blowinout {
my ($img, $drawable, $angle, $nsteps, $distance, $inmode, $arithmode) = @_;
# bail out if $drawable isn't a layer
# print "Starting\n";
@ -23,7 +23,7 @@ sub blowinout {
#get the drawable dimensions
my $xsize = gimp_drawable_width($drawable);
my $ysize = gimp_drawable_height($drawable);
# Set background color to 128, for clearing dm
gimp_palette_set_background([128,128,128]);
@ -31,48 +31,48 @@ sub blowinout {
my $dm = gimp_image_new($xsize, $ysize, 1);
eval { $dm->undo_push_group_start };
# It needs to have 2 layers
my $dmlayer = gimp_layer_new($dm, $xsize, $ysize, GRAY_IMAGE, "newlayer",
my $dmlayer = gimp_layer_new($dm, $xsize, $ysize, GRAY_IMAGE, "newlayer",
100, NORMAL_MODE);
gimp_image_add_layer($dm, $dmlayer, 0);
# Create the layers, one-by-one
# Create the layers, one-by-one
my $i = 1;
my $xdist = ($arithmode) ?
$i * $distance / $nsteps * -cos($angle * 3.14159 / 180) :
my $xdist = ($arithmode) ?
$i * $distance / $nsteps * -cos($angle * 3.14159 / 180) :
$distance ** ($i/$nsteps) * -cos($angle * 3.14159 / 180);
my $ydist = ($arithmode) ?
$i * $distance / $nsteps * sin($angle * 3.14159 / 180) :
my $ydist = ($arithmode) ?
$i * $distance / $nsteps * sin($angle * 3.14159 / 180) :
$distance ** ($i/$nsteps) * sin($angle * 3.14159 / 180);
gimp_edit_clear($dmlayer);
plug_in_noisify(1, $dm, $dmlayer, 0, 255, 255, 255, 0);
gimp_levels($dmlayer, 0, 0, 255, 1.0, 128, 255);
gimp_levels($dmlayer, 0, 0, 255, 1.0, 128, 255);
$drawable = gimp_layer_copy($drawable, 0);
gimp_image_add_layer($img, $drawable, -1);
plug_in_displace(1, $img, $drawable, $xdist, $ydist, 1, 1, $dmlayer,
plug_in_displace(1, $img, $drawable, $xdist, $ydist, 1, 1, $dmlayer,
$dmlayer, 1);
if ( $inmode == 1 )
if ( $inmode == 1 )
{
gimp_image_lower_layer($img, $drawable);
};
for ( $i = 2; $i <= $nsteps; $i++ ) {
$xdist = ($arithmode) ?
$i * $distance / $nsteps * -cos($angle * 3.14159 / 180) :
$xdist = ($arithmode) ?
$i * $distance / $nsteps * -cos($angle * 3.14159 / 180) :
$distance ** ($i/$nsteps) * -cos($angle * 3.14159 / 180);
$ydist = ($arithmode) ?
$i * $distance / $nsteps * sin($angle * 3.14159 / 180) :
$ydist = ($arithmode) ?
$i * $distance / $nsteps * sin($angle * 3.14159 / 180) :
$distance ** ($i/$nsteps) * sin($angle * 3.14159 / 180);
gimp_edit_clear($dmlayer);
gimp_edit_clear($dmlayer);
plug_in_noisify(1, $dm, $dmlayer, 0, 255, 255, 255, 0);
gimp_levels($dmlayer, 0, 0, 255, 1.0, 128, 255);
$drawable = gimp_layer_copy($drawable, 0);
gimp_image_add_layer($img, $drawable, -1);
plug_in_displace(1, $img, $drawable, $xdist, $ydist, 1, 1, $dmlayer,
plug_in_displace(1, $img, $drawable, $xdist, $ydist, 1, 1, $dmlayer,
$dmlayer, 1);
if ( $inmode == 1 )
if ( $inmode == 1 )
{
gimp_image_lower_layer($img, $drawable);
};
}
}
eval { $dm->undo_push_group_end };
# gimp_image_remove_layer($dm, $dmlayer);
@ -80,7 +80,7 @@ sub blowinout {
gimp_palette_set_background($oldbg);
eval { $img->undo_push_group_end };
# gimp_displays_flush(); unneccessary (and dangerous ;)
(); # I like smileys ;)
}

View File

@ -27,37 +27,37 @@ register "border_average",
],
sub { # es folgt das eigentliche Skript...
my($image,$drawable,$thickness,$exponent)=@_;
($empty,@bounds)=$drawable->mask_bounds();
return () if $empty;
my $rexpo = 8-$exponent;
my $bucket_num = 1<<$exponent;
# ideally, we'd use a three-dimensional array, but index3 isn't
# implemented yet, so we do it flat (Still its nicer than C).
my $cube = zeroes long,$bucket_num**3;
my $width = $drawable->width;
my $height = $drawable->height;
$thickness=$width if $thickness>$width;
$thickness=$height if $thickness>$height;
local *add_new_colour = sub($) {
# linearize and quantize pixels (same as original, slightly wrong)
my $pixels = $_[0] >> $rexpo;
# intead of something like
# $cube->index3d($pixels)++;
# we have to first flatten the rgb triples into indexes and use index instead
my $flatten = long([$bucket_num**2,$bucket_num**1,$bucket_num**0]);
my $subcube = $cube->index(inner($pixels,$flatten)->clump(2));
$subcube++;
};
Gimp->progress_init("Border Average", 0);
add_new_colour ($drawable->get->pixel_rgn ($bounds[0] ,$bounds[1] , $thickness,$height, 0, 0)
->get_rect(0,0, $thickness,$height));
@ -67,13 +67,13 @@ register "border_average",
->get_rect(0,0, $width, $thickness));
add_new_colour ($drawable->get->pixel_rgn ($bounds[0] ,$bounds[3]-$thickness, $width ,$thickness, 0, 0)
->get_rect(0,0, $width, $thickness));
# now find the colour
my $max = $cube->maximum_ind;
my $b = $max % $bucket_num << $rexpo;
my $g = ($max >>= $exponent) % $bucket_num << $rexpo;
my $r = ($max >>= $exponent) % $bucket_num << $rexpo;
if ($Gimp::Fu::run_mode != RUN_NONINTERACTIVE)
{
my $layer = new Layer ($image, width $image, height $image, RGB_IMAGE, "bordercolour", 100, NORMAL_MODE);
@ -82,7 +82,7 @@ register "border_average",
$layer->edit_fill;
Gimp->message("Added layer with border colour ($r,$g,$b) on top");
}
[$r,$g,$b];
};

View File

@ -3,7 +3,7 @@
use Gimp qw( :auto );
use Gimp::Fu;
register "center_guide",
register "center_guide",
"Creates h- & v-guides at the center of the image.",
"Physical center = width/2 and height/2; Optical center = the Golden Mean.",
"Claes G Lindblad <claesg\@algonet.se>",

View File

@ -34,21 +34,21 @@ register "plug_in_ditherize",
],
sub {
my($image,$drawable,$colours)=@_;
$drawable->layer or die "this plug-in only works for layers";
# make sure somehting is selected
$drawable->mask_bounds or $image->selection_all;
my ($x1,$y1,$x2,$y2)=($drawable->mask_bounds)[1..4];
my ($w,$h)=($x2-$x1,$y2-$y1);
my $sel = $image->selection_save;
$image->rect_select($x1,$y1,$w,$h,SELECTION_REPLACE,0,0);
$drawable->edit_copy;
$sel->selection_load;
$sel->remove_channel;
my $copy = new Image($w, $h, $image->base_type);
my $draw = new Layer($copy, $w, $h,
$imagetype2layertype{$image->base_type},
@ -56,11 +56,11 @@ register "plug_in_ditherize",
$copy->add_layer ($draw, 1);
$draw->edit_paste(0)->anchor;
$copy->convert_indexed (1, $colours);
$draw->edit_copy;
$drawable->edit_paste(1)->anchor;
$copy->delete;
();
};

View File

@ -32,35 +32,35 @@ register "gimp_fu_example_script", # fill in a function name
[PF_GRADIENT , "a_gradients" , "An unused gradients" ],
],
sub {
# now do sth. useful with the garbage we got ;)
my($width,$height,$text,$font,$fg,$bg,$ignore,$brush,$pattern,$gradient)=@_;
# set tracing
Gimp::set_trace(TRACE_ALL);
my $img=new Image($width,$height,RGB);
# put an undo group around any modifications, so that
# they can be undone in one step. The eval shields against
# gimp-1.0, which does not have this function.
eval { $img->undo_push_group_start };
my $l=new Layer($img,$width,$height,RGB,"Background",100,NORMAL_MODE);
$l->add_layer(0);
# now a few syntax examples
Palette->set_foreground($fg) unless $ignore;
Palette->set_background($bg) unless $ignore;
fill $l BG_IMAGE_FILL;
# the next function only works in gimp-1.1
$text_layer=$img->text_fontname(-1,10,10,$text,5,1,xlfd_size($font),$font);
gimp_palette_set_foreground("green");
# close the undo push group
eval { $img->undo_push_group_end };

View File

@ -10,22 +10,22 @@ sub query {
sub net {
# simple benchmark ;)
$img=new Gimp::Image(600,300,RGB);
# the is the same as $img = new Image(600,300,RGB)
$bg=$img->layer_new(30,20,RGB_IMAGE,"Background",100,NORMAL_MODE);
$bg->add_layer(1);
new Gimp::Display($img);
for $i (0..255) {
Palette->set_background([$i,255-$i,$i]);
$bg->edit_fill;
Display->displays_flush ();
}
# Gimp::Net::server_quit; # kill the gimp-perl-server-extension (ugly name)
}

View File

@ -9,16 +9,16 @@ use Gimp;
# the extension that's called.
sub plug_in_example_oo {
my $img=new Image(300,200,RGB);
my $bg=new Layer($img,300,200,RGB_IMAGE,"Background",100,NORMAL_MODE);
Palette->set_background([200,200,100]);
$bg->fill(BG_IMAGE_FILL);
# Palette->set_background([200,100,200]);
# gimp_drawable_fill ($bg,BG_IMAGE_FILL);
$img->add_layer($bg,1);
new Display($img);
}

View File

@ -2,7 +2,7 @@
# 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
# 1.2: Added my email, and put it in "Noise" where it belongs
# <sjburges@gimp.org>
@ -23,14 +23,14 @@ register "feedback",
],
sub {
my($img,$drawable,$offset,$repeat)=@_;
eval { $img->undo_push_group_start };
for (; $repeat>0; $repeat--) {
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);
$copylayer->scale($img->width - $offset, $img->height - $offset, 0);
}
$img->flatten;
eval { $img->undo_push_group_end };

View File

@ -17,20 +17,20 @@ sub growfont {
@fontdesc = split /-/, $fontname;
$fontdesc[8] += $plussize;
$outname = join "-", @fontdesc;
return $outname;
}
return $outname;
}
register "fit_text",
"Fit Text - fit text to a selection",
register "fit_text",
"Fit Text - fit text to a selection",
"Have a rectangular selection, and select the font type and spacing. It will fill the selection with text as closely as possible. If no selection is made prior to running, it will fill the entire image.",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1999-03-21",
"<Image>/Filters/Render/Fit Text",
"*",
[
[PF_FONT, "font", "What font type to use - size will be ignored", $defaultfont],
[PF_STRING, "string", "Text String to fill with", "Fit Text"],
"<Image>/Filters/Render/Fit Text",
"*",
[
[PF_FONT, "font", "What font type to use - size will be ignored", $defaultfont],
[PF_STRING, "string", "Text String to fill with", "Fit Text"],
],
[],
['gimp-1.1'],
@ -39,34 +39,34 @@ register "fit_text",
($sel,$x1,$y1,$x2,$y2) = $img->gimp_selection_bounds;
$width = $x2-$x1;
$height = $y2-$y1;
@extents=gimp_text_get_extents_fontname($string,xlfd_size($xlfd),$xlfd);
$growsize = ($extents[0]<$width && $extents[1]<$height) ? 80 : -80;
if ($growsize > 0 ) {
while ($extents[0]<$width && $extents[1]<$height) {
$xlfd = growfont($xlfd,$growsize);
$xlfd = growfont($xlfd,$growsize);
@extents=gimp_text_get_extents_fontname($string,xlfd_size($xlfd),$xlfd);
}
$xlfd = growfont($xlfd, -$growsize);
}
else {
else {
while ($extents[0]>$width || $extents[1]>$height) {
$xlfd = growfont($xlfd,$growsize);
$xlfd = growfont($xlfd,$growsize);
@extents=gimp_text_get_extents_fontname($string,xlfd_size($xlfd),$xlfd);
}
}
while ($extents[0]<$width && $extents[1]<$height) {
$xlfd = growfont($xlfd,10); # precision for the last bit
$xlfd = growfont($xlfd,10); # precision for the last bit
@extents=gimp_text_get_extents_fontname($string,xlfd_size($xlfd),$xlfd);
}
while ($extents[0]>$width || $extents[1]>$height) {
$xlfd = growfont($xlfd,-4);
$xlfd = growfont($xlfd,-4);
@extents=gimp_text_get_extents_fontname($string,xlfd_size($xlfd),$xlfd);
}
# print $xlfd, "\n";
$tmplay = $layer->text_fontname($x1,$y1,$string,0,1,xlfd_size($xlfd), $xlfd);
$width2=$tmplay->width;
$height2=$tmplay->height;
@ -75,14 +75,14 @@ register "fit_text",
# print "$width2, $height2:$width, $height\n";
while ($width2<$width && $height2<$height) {
$tmplay->remove;
$xlfd = growfont($xlfd,4);
$xlfd = growfont($xlfd,4);
$tmplay=$layer->text_fontname($x1,$y1,$string,0,1,xlfd_size($xlfd), $xlfd);
$width2=$tmplay->width;
$height2=$tmplay->height;
}
$tmplay->remove;
$xlfd = growfont($xlfd,-2);
$xlfd = growfont($xlfd,-2);
$tmplay=$layer->text_fontname($x1,$y1,$string,0,1,xlfd_size($xlfd), $xlfd);
return();
};

View File

@ -101,7 +101,7 @@ sub font_table {
\@rows, $col1_width, $col2_width, $test_text,
\@fonts, $firstfont, $i);
}
}
return ();

View File

@ -95,7 +95,7 @@ sub hbox_vbox_add_row {
$row_height = $h if $h > $row_height;
}
$row_width -= $gutter_x;
# Do the layout
my $xpos = ($layout_width-$row_width)/2;
for $i ($row_start_idx..$row_end_idx) {
@ -131,10 +131,10 @@ sub hbox_vbox_create_layout {
$row_start_idx, $row_end_idx,
$ypos, $gutter_x));
$total_width = $row_width if $row_width > $total_width;
# Move to next row
$ypos+= $gutter_y + $row_height;
# Zero out various things
$row_start_idx = $row_end_idx+1;
$row_end_idx = $row_start_idx;
@ -143,7 +143,7 @@ sub hbox_vbox_create_layout {
$row_width = $imgs->[$row_start_idx]->width;
$row_height = $imgs->[$row_start_idx]->height;
$xpos = 0;
}
}
}
else {
$row_width += $gutter_x + $w;
@ -158,10 +158,10 @@ sub hbox_vbox_create_layout {
$row_start_idx, $row_end_idx,
$ypos, $gutter_x));
$total_width = $row_width if $row_width > $total_width;
$ypos+= $row_height;
}
$total_width = $layout_width;
$total_height = $ypos + $pad_y;
return ($total_width, $total_height, \@layout);
@ -175,7 +175,7 @@ sub decoration_drop_shadow {
my($layout) = shift;
$shadow_xoffs = 7;
$shadow_yoffs = 7;
# Put them on a row
$tiled_img = gimp_image_new($total_width, $total_height, RGB);
$tiled_drw = gimp_layer_new($tiled_img, $total_width, $total_height,
@ -184,23 +184,23 @@ sub decoration_drop_shadow {
RGB_IMAGE, "Shadow", 50, NORMAL_MODE);
$tiled_background = gimp_layer_new($tiled_img, $total_width, $total_height,
RGB_IMAGE, "Background", 100, NORMAL_MODE);
# Create masks
$tiled_drw_msk = $tiled_drw->create_mask(1);
$tiled_shadow_msk = $tiled_shadow->create_mask(1);
# Make sure respective images have alpha channels
$tiled_drw->layer_add_alpha();
$tiled_shadow->layer_add_alpha();
# Connect masks to respective layers
$tiled_img->add_layer_mask($tiled_drw, $tiled_drw_msk);
$tiled_img->add_layer_mask($tiled_shadow, $tiled_shadow_msk);
# Fill all the layers with some contents
gimp_palette_set_background([128,128,128]);
gimp_palette_set_background([128,128,128]);
$tiled_drw->fill(BG_IMAGE_FILL);
gimp_palette_set_background($bgcolor);
$tiled_background->fill(BG_IMAGE_FILL);
if ($bgpattern) {
@ -211,15 +211,15 @@ sub decoration_drop_shadow {
}
gimp_palette_set_background([0, 0, 0]); # Shadow color
$tiled_shadow->fill(BG_IMAGE_FILL);
# Add all the layers to the image
$tiled_img->add_layer($tiled_background,-1);
$tiled_img->add_layer($tiled_shadow,-1);
$tiled_img->add_layer($tiled_drw,-1);
gimp_display_new($tiled_img);
my $xpos = 0;
# Set color for drawing in mask
gimp_palette_set_background([255, 255, 255]);
for $ly_idx (0..@$layout-1) {
@ -231,23 +231,23 @@ sub decoration_drop_shadow {
$tiled_img->rect_select($xpos, $ypos, $w, $h, 0, 0, 0);
$tiled_img->edit_paste($tiled_drw, 0)
->floating_sel_anchor;
# why is the selection cleared?
$tiled_img->rect_select($xpos, $ypos, $w, $h, 0, 0, 0);
$tiled_img->edit_fill($tiled_drw_msk);
# why is the selection cleared?
$tiled_img->rect_select($xpos+$shadow_xoffs,
$ypos+$shadow_yoffs, $w, $h, 0, 0, 0);
$tiled_img->edit_fill($tiled_shadow_msk);
$tiled_img->selection_none();
}
# Blur the shadow
plug_in_gauss_rle(1, $tiled_img, $tiled_shadow_msk, 7, 1, 1);
# Apply the shadow mask
$tiled_img->remove_layer_mask($tiled_shadow, APPLY);
}
@ -256,7 +256,7 @@ sub decoration_sunken_windows {
my($layout) = shift;
$shadow_xoffs = 7;
$shadow_yoffs = 7;
# Create needed image and layers
$tiled_img = gimp_image_new($total_width, $total_height, RGB);
$tiled_drw = gimp_layer_new($tiled_img, $total_width, $total_height,
@ -267,17 +267,17 @@ sub decoration_sunken_windows {
RGB_IMAGE, "Punch mask", 100, NORMAL_MODE);
# Create masks
$tiled_punch_mask = $tiled_punch_layer->create_mask(0);
# Make sure respective images have alpha channels
$tiled_punch_layer->layer_add_alpha();
# Connect masks to respective layers
$tiled_img->add_layer_mask($tiled_punch_layer, $tiled_punch_mask);
# Fill all the layers with some contents
gimp_palette_set_background([128,128,128]);
gimp_palette_set_background([128,128,128]);
$tiled_drw->fill(BG_IMAGE_FILL);
gimp_palette_set_background($bgcolor);
$tiled_punch_layer->fill(BG_IMAGE_FILL);
if ($bgpattern) {
@ -288,15 +288,15 @@ sub decoration_sunken_windows {
}
gimp_palette_set_background([255, 255, 255]); # Punch stencil
$tiled_punch_stencil->fill(BG_IMAGE_FILL);
# Add all the layers to the image
$tiled_img->add_layer($tiled_punch_stencil,-1);
$tiled_img->add_layer($tiled_drw,-1);
$tiled_img->add_layer($tiled_punch_layer,-1);
gimp_display_new($tiled_img);
my $xpos = 0;
# Set color for drawing in mask
gimp_palette_set_background([0, 0, 0]);
for $ly_idx (0..@$layout-1) {
@ -308,21 +308,21 @@ sub decoration_sunken_windows {
$tiled_img->rect_select($xpos, $ypos, $w, $h, 0, 0, 0);
$tiled_img->edit_paste($tiled_drw, 0)
->floating_sel_anchor;
# why is the selection cleared?
$bw = 3;
$tiled_img->rect_select($xpos-$bw,
$ypos-$bw, $w+2*$bw, $h+2*$bw, 0, 0, 0);
$tiled_img->edit_fill($tiled_punch_stencil);
# why is the selection cleared?
$tiled_img->selection_none();
$tiled_img->rect_select($xpos, $ypos, $w, $h, 0, 0, 0);
$tiled_img->edit_fill($tiled_punch_mask);
$tiled_img->selection_none();
}
# Blur the punch stencil
plug_in_gauss_rle(1, $tiled_img, $tiled_punch_stencil, 7, 1, 1);
@ -358,13 +358,13 @@ sub net {
}
print "Done reading ", scalar(@imgs), " images\n";
# Now create a layout of the images. The layout algorithm
# should really be parameterized.
my ($total_width, $total_height, $layout) = hbox_vbox_create_layout(\@imgs);
print "total_size = ($total_width $total_height)\n";
# This is an example decoration. Others will be created in the future
if ($decoration eq "drop-shadow") {
decoration_drop_shadow($layout);
@ -384,7 +384,7 @@ sub net {
for $idx (0..@filenames-1) {
my ($img, $xpos, $ypos) = @{$layout->[$idx]};
my($w,$h) = ($img->width, $img->height);
printf INDEX "%s %.0f %.0f %.0f %.0f %s\n",
$filenames[$idx], $xpos, $ypos, $xpos+$w, $ypos+$h, $descr;
}
@ -415,22 +415,22 @@ Options:
-index if Create an index file mapping filename to bounding box
coordinates in output image, where if is the name of
the index file. The index file may e.g. be translated by
a subsequent program into a html index file.
a subsequent program into a html index file.
-layoutwidth lw Set total width of layout. (Default $layout_width)
-flatten Flatten the final image.
-bgcolor Set bg color.
-bgpattern Set bg pattern. Overrides the bgcolor.
-padx px Extra space around all images in x-direction. (Default $pad_x)
-pady py Extra space around all images in y-direction. (Default $pad_y)
-gutterx gx Space between images in x-direction. (Default $gutter_x)
-gutterx gy Space between images in y-direction. (Default $gutter_y)
-gutterx gx Space between images in x-direction. (Default $gutter_x)
-gutterx gy Space between images in y-direction. (Default $gutter_y)
-decoration alg Choose algorithm for drawing the decoration in the layout.
Known algorithms are:
drop-shadow
sunken-windows
Default is 'drop_shadow'.
__
/^-max_height/ and do { $max_height = shift; next; };
/^-index/ and do { $index_file = shift; next; };
/^-layoutwidth/ and do { $layout_width = shift; next; };

View File

@ -101,16 +101,16 @@ sub check {
sub read_pixels {
my($drawable,$im)=@_;
my $th = Gimp->tile_height;
Gimp->tile_cache_ntiles (1 + $drawable->width / Gimp->tile_width);
my $type = $drawable->type;
my $format;
$format = "RGB" if $type == RGB_IMAGE;
$format = "RGBA" if $type == RGBA_IMAGE;
$format = "GRAY" if $type == GRAY_IMAGE;
die "Indexed format and GRAYA not yet supported in GimpMagick!\n" unless $format;
my $temp = Gimp->temp_name('raw');
open TEMP,">$temp\0" or die "unable to open temporary file '$temp' for writing\n";
my ($empty,$x1,$y1,$x2,$y2) = $drawable->mask_bounds;
@ -136,11 +136,11 @@ sub write_pixels {
my($drawable,$im,$format)=@_;
my $th = Gimp->tile_height;
my $buf;
my $temp = Gimp->temp_name('raw');
$im->Write("$format:$temp");
open TEMP,"<$temp\0" or die "unable to open temporary file '$temp' for writing\n";
unlink $temp;
my ($empty,$x1,$y1,$x2,$y2) = $drawable->mask_bounds;
@ -151,7 +151,7 @@ sub write_pixels {
$drawable->image->selection_none;
($x1,$y1,$x2,$y2)=(0,0,$im->get('width','height'));
}
my $region = $drawable->get->pixel_rgn ($x1, $y1, $x2, $y2, 1, 1);
Gimp->progress_init ("transferring image data");
@ -206,7 +206,7 @@ sub gimp_magick {
my $w = new Gtk::Dialog;
$w->set_title ("GimpMagick! $VERSION");
my $b = new Gtk::Button "Apply";
$b->signal_connect (clicked => sub { write_pixels ($drawable, $im, $format); main_quit Gtk });
$w->action_area->add ($b);
@ -260,7 +260,7 @@ sub gimp_magick {
$w->vbox->add($execute);
update_preview ($im, $preview);
$w->show_all;
&$changed_command;
main Gtk;
@ -283,7 +283,7 @@ register "gimp_magick",
Gimp::init_gtk;
gimp_magick ($drawable);
$image;
};

View File

@ -7,7 +7,7 @@ sub goldenmean {
my ($short, $type) = @_;
$long = int(($short * 1.618) + 0.5);
$width = $short;
$height = $long;
@ -26,7 +26,7 @@ sub goldenmean {
return $img;
}
register "golden_mean",
register "golden_mean",
"Creates a new image with a ratio according to the Golden Mean",
"Select shortest side and orientation and I will automagically calculate the long side. As a plug-in companion, see <Image>/Center Guide.",
"Claes G Lindblad <claesg\@algonet.se>",

View File

@ -9,19 +9,19 @@ use Gimp::Util;
# Gimp::set_trace(TRACE_ALL);
register "guide_grid",
register "guide_grid",
"GuideGrid - creates a grid of guides\n",
"You specify the X spacing, the Y spacing, and initial offsets. It creates a grid of guides\n",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1999-03-20",
"<Image>/GuideGrid",
"*",
[
[PF_SPINNER, "x_spacing", "How far to space grid horizontally", 24, [1,1000,1]],
[PF_SPINNER, "y_spacing", "How far to space grid vertically", 24, [1,1000,1]],
[PF_SPINNER, "x_offset", "How much to initially offset it horizontally", 0, [0,1000,1]],
[PF_SPINNER, "y_offset", "How much to initially offset it vertically", 0, [0,1000,1]],
"<Image>/GuideGrid",
"*",
[
[PF_SPINNER, "x_spacing", "How far to space grid horizontally", 24, [1,1000,1]],
[PF_SPINNER, "y_spacing", "How far to space grid vertically", 24, [1,1000,1]],
[PF_SPINNER, "x_offset", "How much to initially offset it horizontally", 0, [0,1000,1]],
[PF_SPINNER, "y_offset", "How much to initially offset it vertically", 0, [0,1000,1]],
],
[],
['gimp-1.1'],

View File

@ -48,18 +48,18 @@ sub index_and_save($$) {
sub write_logo {
my($string,$active,$w,$h,$uc)=@_;
# create a new image
my $img=gimp_image_new($w,$h,RGB);
# and a layer for it
my $bg=gimp_layer_new($img,$w,$h,RGB_IMAGE,"Background",100,NORMAL_MODE);
gimp_image_add_layer($img,$bg,1);
set_fg($blend1);
set_bg($blend2);
# blend the background
gimp_blend($bg,FG_BG_HSV,NORMAL_MODE,LINEAR,100,0,
REPEAT_NONE,0,0,0,
@ -69,29 +69,29 @@ sub write_logo {
REPEAT_NONE,0,0,0,
$w,0,$w*0.92,0);
gimp_selection_all($img);
set_fg($black);
my ($text,$tw,$th,$ta,$td) = text ($img, $string, 1, $font, $active ? $h*0.7 : $h*0.5);
gimp_layer_translate ($text,($w-$tw)/2,($h-$th+$td)/2);
my ($shadow) = gimp_layer_copy ($text, 0);
plug_in_gauss_rle ($text, 1, 1, 1) unless $active;
gimp_image_add_layer ($img,$shadow,1);
gimp_shear ($shadow,1,HORIZONTAL,-$th);
gimp_layer_scale ($shadow, $tw, $th*0.3, 1);
gimp_layer_translate ($shadow, $th*0.1, $th*0.3);
plug_in_gauss_rle ($shadow, 1, 1, 1);
gimp_hue_saturation($bg, ALL_HUES, 0, 0, $active ? 10 : -40);
plug_in_nova ($bg, $h*0.4, $h*0.5, '#f0a020', 5, 50) if $active;
plug_in_nova ($bg, $w-$h*0.4, $h*0.5, '#f0a020', 5, 50) if $active;
# add an under construction sign
if ($uc) {
set_fg($active ? "#a00000" : "#000000");
@ -99,9 +99,9 @@ sub write_logo {
gimp_rotate ($uc,1,0.2);
gimp_layer_translate ($uc,$w*0.84,($h-$th+$td)/2);
}
index_and_save ($img, "/root/www/src/marc/images/${string}_".($active ? "on" : "off").".gif");
gimp_display_new ($img) if $example;
gimp_image_delete($img) unless $example;
}

View File

@ -22,7 +22,7 @@ use Gimp qw(:auto);
use Gimp::Fu;
use Fcntl qw(O_RDWR O_CREAT O_TRUNC);
use Gimp::Feature;
BEGIN { eval "use DB_File";
BEGIN { eval "use DB_File";
$@ and Gimp::Feature::missing('Berkeley DB interface module') }
# use strict;
# use vars qw($DO_HSV $debug);
@ -426,7 +426,7 @@ sub hue_dist {
my $d = abs($h1-$h2);
return($d>128?(256-$d):$d);
}
# Gimp::Fu registration routine for placing this function into gimp's PDB
register
"image_tile",

View File

@ -1,10 +1,10 @@
#!/usr/bin/perl
#!/usr/bin/perl
# Effect taken from http://tigert.gimp.org/gimp/tutorials/beveled_text/
# perl-ified by Seth Burgess <sjburges@gimp.org>
# Programatically, this script is about as dull as they come. The only
# Programatically, this script is about as dull as they come. The only
# exceptions are those of the neat util functions (that aren't all quite
# working btw). You can follow step by step with the website at
# working btw). You can follow step by step with the website at
# http://tigert.gimp.org/gimp/tutorials/beveled_text/
use Gimp;
@ -21,7 +21,7 @@ $date = "1999-03-23";
$imgtypes = "*";
$author = "Seth Burgess <sjburges\@gimp.org>";
$path =~ m,/([^/]+)$,;
$path =~ m,/([^/]+)$,;
$regname = $1;
$regname =~ s/ /_/g;
$regname =~ tr/A-Z/a-z/;
@ -30,22 +30,22 @@ $author =~ m/^(.*) </;
$authorname = $1;
register $regname, $shortdesc, $longdesc, $authorname, $author, $date, $path, $imgtypes,
[
[
[PF_FONT, "font", "Font Name"],
[PF_STRING, "text", "Enter your text to be beveled", "INNERBEVEL"],
[PF_COLOR, "top_color", "Blend to this color", $defaultcolor2],
[PF_COLOR, "bot_color", "Blend from this color", $defaultcolor1],
[PF_SLIDER, "azimuth", "Direction of the shine", 132, [0,255,5]],
[PF_SLIDER, "shinyness", "How shiny the final image will be",30, [0,90,5]],
[PF_SLIDER, "depth_shape", "Determines the final shape", 34 , [0,64,32]],
[PF_RADIO, "map", "The type of Map to use", 2, [Linear => 0, Spherical => 1, Sinusoidal => 2] ],
[PF_SLIDER, "depth_shape", "Determines the final shape", 34 , [0,64,32]],
[PF_RADIO, "map", "The type of Map to use", 2, [Linear => 0, Spherical => 1, Sinusoidal => 2] ],
],[],
[
'gimp-1.1',
], sub {
my ($font, $text, $color1, $color2, $azimuth, $elevation, $depth, $maptype) = @_;
# -- step 1 --
# -- step 1 --
$oldst = get_state();
gimp_palette_set_background($color1);
@ -55,7 +55,7 @@ gimp_palette_set_foreground($color2);
$img = gimp_image_new($dims[0]+10, $dims[1]+10, RGB);
# none of the macro's did quite what I was looking for here.
# none of the macro's did quite what I was looking for here.
# i.e. create a text layer on transparent only...
# -- step 2 --
@ -68,15 +68,15 @@ $layer = $img->merge_visible_layers(EXPAND_AS_NECESSARY);
# -- step 3 --
$layer->set_preserve_trans(1);
$layer->blend(FG_BG_RGB, 0, LINEAR, 100, 0, REPEAT_NONE, 0, 3, 0.20, @pt1, @pt2); # NORMAL isn't recognized
# -- step 4 --
# -- step 4 --
$layer2 = $layer->copy(0); # Can you override these to have a default? (would be nice)
$img->add_layer($layer2, 0);
# -- step 5 --
# -- step 5 --
$layer2->set_preserve_trans(1);
$img->selection_all;
gimp_palette_set_background([255,255,255]);
$layer2->edit_fill;
# -- step 6 --
# -- step 6 --
$layer2->set_preserve_trans(0);
$layer2->gauss_rle(6,1,1); # Defaults would be cool here too :)
# -- step 7 --
@ -91,7 +91,7 @@ $layer2->translate(2, 3);
$img->add_new_layer(2);
$img->gimp_selection_none();
set_state($oldst); # Doesn't seem to work - says it can't grok color
set_state($oldst); # Doesn't seem to work - says it can't grok color
return();
};

View File

@ -3,7 +3,7 @@
use Gimp qw( :auto );
use Gimp::Fu;
register "mirror_split",
register "mirror_split",
"Splits and mirrors half of the image, according to settings.",
"Just tick appropriate radio button.",
"Claes G Lindblad <claesg\@algonet.se>",

View File

@ -1,31 +1,31 @@
#!/usr/bin/perl
use Gimp;
use Gimp::Fu;
use Gimp::Util;
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;
# 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;

View File

@ -126,7 +126,7 @@ sub new_Entry {
my $name = $_[2];
$label->set_alignment (0, 0.5);
$hbox->pack_start ($label, 0, 0, 0);
$hbox->pack_start ($name , 1, 1, 0);
@ -139,9 +139,9 @@ sub new_Entry {
sub create_main {
my $b;
my $t;
parse Gtk::Rc Gimp->gtkrc;
$t = new Gtk::Tooltips;
my $w = new Gtk::Dialog;
@ -149,14 +149,14 @@ sub create_main {
$eX = $w->style->font->ascent + $w->style->font->descent + 10;
$window = $w;
$w->set_title("Parasite Editor - version $VERSION alpha");
$w->signal_connect("destroy",sub {main_quit Gtk});
$b = new Gtk::Button "Close";
$w->action_area->add($b);
$b->signal_connect("clicked",sub {main_quit Gtk});
my $v = new Gtk::VBox (0,5);
$w->vbox->add ($v);
@ -261,7 +261,7 @@ sub create_main {
if $parasite ne "";
});
addcmd ("Delete", sub {$detach_func->($current,$parasite) if $parasite; refresh_names});
show_all $w;
}
@ -277,11 +277,11 @@ register "extension_parasite_editor",
[],
['gimp-1.1'],
sub {
Gimp::init_gtk;
create_main;
main Gtk;
();
};

View File

@ -103,7 +103,7 @@ sub extension_perl_control_center {
$w = new Gtk::Dialog;
$w->set_title ('Perl Control Center');
$b = new Gtk::Button "View Perl Feature Status";
$b->signal_connect(clicked => sub { gtkview_log $s,'Perl Feature Status',generate_status});
$w->vbox->add($b);

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl
# <sjburges@gimp.org>
# This is tigert's request. I suppose it'll be useful to those that do
# this sort of thing. Personally I'll probably only run it to test and
# this sort of thing. Personally I'll probably only run it to test and
# put up a demo image.
use Gimp;
@ -23,7 +23,7 @@ sub get_vguides { # get back an ordered set of vertical guides
foreach $key(sort (keys %vkeys)) {
# print "Unshifting ", $key, "\n";
push @vguides, $vkeys{$key};
}
}
return @vguides;
}
@ -40,7 +40,7 @@ sub get_hguides { # get back an ordered set of horizontal guides
# need to sort them in order of their occurance in the image
foreach $key(sort keys %hkeys) {
push @hguides, $hkeys{$key};
}
}
return @hguides;
}
@ -58,7 +58,7 @@ sub dosel { # do the selection
$tmpimg->gimp_file_save(-1,"$savepath$imgpath$imgname","$savepath$imgpath$imgname");
$tmpimg->delete;
return "$imgpath$imgname"; # what I want printed in html
}
}
sub html_table_start {
($fn,$cellpadding,$cellspacing,$border,$capatalize) = @_;
@ -96,26 +96,26 @@ sub html_table_end {
# <tigert> html-file name: [_________________]
# <tigert> image-basename [__________________]
# <tigert> [x] use separate dir for images
# <tigert> image directory: [___________________]
# <tigert> image directory: [___________________]
# later, decided to have UPPER/lower case HTML toggle
# cellspacing: ___^
register "perlotine",
"Guilotine implemented ala perl, with html output",
register "perlotine",
"Guilotine implemented ala perl, with html output",
"Add guides to an image. Then run this. It will cut along the guides, and give you the html to reassemble the resulting images.",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1999-03-19",
"<Image>/Image/Transforms/Perl-o-tine",
"*",
[
[PF_STRING, "save_path", "The path to export the HTML to",$ENV{HOME}],
[PF_STRING, "html_file_name", "Filename to export","perlotine.html"],
[PF_STRING, "image_basename", "What to call the images","perlotine"],
"<Image>/Image/Transforms/Perl-o-tine",
"*",
[
[PF_STRING, "save_path", "The path to export the HTML to",$ENV{HOME}],
[PF_STRING, "html_file_name", "Filename to export","perlotine.html"],
[PF_STRING, "image_basename", "What to call the images","perlotine"],
[PF_TOGGLE, "separate_image_dir", "Use a separate directory for images?",0],
[PF_STRING, "relative_image_path", "The path to export the images to, relative to the Save Path", "images/"],
[PF_TOGGLE, "capitalize_tags", "Capatalize HTML tags?", 0],
[PF_STRING, "relative_image_path", "The path to export the images to, relative to the Save Path", "images/"],
[PF_TOGGLE, "capitalize_tags", "Capatalize HTML tags?", 0],
[PF_SPINNER, "cellspacing", "Add space between the table elements", 0, [0,15,1]],
], sub {
@ -124,11 +124,11 @@ register "perlotine",
@vert = get_vguides($img);
@horz = get_hguides($img);
if (!(scalar(@vert) || scalar(@horz))) {
if (!(scalar(@vert) || scalar(@horz))) {
die ("No horizontal or vertical guides found. Aborted.");
}
# print @vert, " LEN = ", scalar(@vert), "\n";
# print @horz, " LEN = ", scalar(@horz), "\n";
# print @vert, " LEN = ", scalar(@vert), "\n";
# print @horz, " LEN = ", scalar(@horz), "\n";
# foreach $guide (@vert) {
# print $img->get_guide_position($guide), "\n";
# }
@ -136,11 +136,11 @@ register "perlotine",
if (!($savepath=~ m,/$,)) { # add a trailing slash if its not on there
$savepath = $savepath . "/";
}
}
if (!($imgpath=~ m,/$,)) { # add a trailing slash if its not on there
$imgpath= $imgpath . "/";
}
}
if (!$separate) { $imgpath = ""; }
open FILE, ">$savepath$htmlname" or die "Couldn't open $savepath$filename: $!\n";
@ -153,9 +153,9 @@ register "perlotine",
$left=0;
for ($j=0; $j<=scalar(@vert); $j++) {
$right = ($j>$#vert) ? $img->width : $img->get_guide_position($vert[$j]);
$imgname = dosel($img, $savepath, $imgpath, $imgbasename, $left, $right, $top, $bot, $i, $j);
$imgname = dosel($img, $savepath, $imgpath, $imgbasename, $left, $right, $top, $bot, $i, $j);
html_table_entry(\*FILE, $imgname, $right-$left, $bot-$top, $capatalize);
$left = $right + $cellspacing;
$left = $right + $cellspacing;
}
html_table_row_end(\*FILE, $capatalize);
$top = $bot + $cellspacing;

View File

@ -10,19 +10,19 @@ use Gimp::Fu;
# by Seth Burgess <sjburges@gimp.org>
# June 29, 1998
#
# This perl plug-in prepares a multilayer RGB image for use as a
# transparent gif. To use this prpoerly, you want to have something
# This perl plug-in prepares a multilayer RGB image for use as a
# transparent gif. To use this prpoerly, you want to have something
# close to the intended background as the bottom layer. If convert
# to indexed is not selected, the bottom two options are unused.
#
#
# TODO: Write a nicer GUI than Gimp::Fu provides (learn some gtk)
# Anything else that seems useful
# Anything else that seems useful
# Gimp::set_trace(TRACE_ALL);
sub prep {
my ($img, $drawable, $threshold, $growth, $index, $dither, $colors) = @_;
# Duplicate this image, and work on the duplicate for the rest of the
# procedure.
my $out = gimp_channel_ops_duplicate($img);
@ -31,14 +31,14 @@ sub prep {
# duplicated image. To find length of the list, use $#layers
my @layers = gimp_image_get_layers($out);
# if there's not enough layers, abort.
# if there's not enough layers, abort.
if ($#layers <= 0) {
gimp_message("You need at least 2 layers to perform prep4gif");
print "Only ", scalar(@layers), " layers found!(", $layers[0],")\n";
return;
}
# Show the image early - this makes debugging a breeze
# Show the image early - this makes debugging a breeze
my $newdisplay = gimp_display_new($out);
# Hide the bottom layer, so it doesn't get into the merge visible later.
@ -50,17 +50,17 @@ sub prep {
# NOTE TO PERL NEWBIES - 'my' variables should be declared in their outermost
# scope - if defined inside the if statement, will disappear to program.
my $foreground;
my $foreground;
if ($#layers > 1) {
$foreground = gimp_image_merge_visible_layers($out, 0);
}
else {
else {
$foreground = $layers[0];
};
my $layer_mask = gimp_layer_create_mask($foreground,2);
gimp_image_add_layer_mask ($out, $foreground, $layer_mask);
gimp_image_add_layer_mask ($out, $foreground, $layer_mask);
gimp_threshold($layer_mask,$threshold,255);
# Transfer layer mask to selection, and grow the selection
@ -84,7 +84,7 @@ sub prep {
# Show all the changes.
gimp_displays_flush();
();
}

View File

@ -12,18 +12,18 @@ use Gimp::Util;
sub randint {
my ($int) = @_;
return int(rand()*$int +0.5);
}
}
register "random_blends",
"Random Blends - take a guess.",
register "random_blends",
"Random Blends - take a guess.",
"A random approach to art. Just try it. It might be good.",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1999-03-18",
"<Image>/Filters/Render/Random Blends",
"RGB*, GRAY*",
[
[PF_SPINNER, "number", "How many gradients to apply", 7, [1,255,1]],
"<Image>/Filters/Render/Random Blends",
"RGB*, GRAY*",
[
[PF_SPINNER, "number", "How many gradients to apply", 7, [1,255,1]],
],
[],
['gimp-1.1'],
@ -35,10 +35,10 @@ register "random_blends",
($sel,$x1,$y1,$x2,$y2) = $img->gimp_selection_bounds;
srand();
@gradientlist = gimp_gradients_get_list();
@gradientlist = gimp_gradients_get_list();
for ($i=0; $i<=$numgradients; $i++) {
gimp_gradients_set_active(@gradientlist[randint($#gradientlist)]);
$layer->gimp_blend(CUSTOM,
$layer->gimp_blend(CUSTOM,
6, # DIFFERENCE
# I'd really like to alternate how many arguments in gradient type depending
# on what version of gimp is being run.. Hints anyone? -sjb

View File

@ -5,7 +5,7 @@ use Gimp::Fu;
#Gimp::set_trace(TRACE_ALL);
register "repdup",
register "repdup",
"Repeats and duplicates a selection.",
"Hopefully self-explanatory...",
"Claes G Lindblad <claesg\@algonet.se>",

View File

@ -9,17 +9,17 @@ use Gimp::Util;
# Gimp::set_trace(TRACE_ALL);
register "round_rect_sel",
register "round_rect_sel",
"Rounds a rectangular selection.",
"Rounds a rectangular selection. If no selection exists, it selects all first, then rounds that selection. If there exists a selection, but its non-rectangluar, it will be replaced by a rectangluar one.",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1999-03-25",
"<Image>/Select/Round Rectangular Selection",
"*",
[
[PF_SPINNER, "x_rounding", "How much to round in the horizontal, in pixels", 16, [1,1000,1]],
[PF_SPINNER, "y_rounding", "How far to round the in vertical, in pixels", 16, [1,1000,1]],
"<Image>/Select/Round Rectangular Selection",
"*",
[
[PF_SPINNER, "x_rounding", "How much to round in the horizontal, in pixels", 16, [1,1000,1]],
[PF_SPINNER, "y_rounding", "How far to round the in vertical, in pixels", 16, [1,1000,1]],
], sub {
my($img,$layer,$x_round, $y_round) =@_;
eval { $img->undo_push_group_start };
@ -28,17 +28,17 @@ register "round_rect_sel",
$img->rect_select($bounds[1], $bounds[2], $bounds[3]-$bounds[1], $bounds[4]-$bounds[2], 0, 0, 0.5);
# cut out the corners
$img->rect_select($bounds[1], $bounds[2], $x_round/2, $y_round/2, 1, 0, 0.5);
$img->rect_select($bounds[3]-$x_round/2, $bounds[2], $x_round/2, $y_round/2, 1, 0, 0.5);
$img->rect_select($bounds[3]-$x_round/2, $bounds[4]-$y_round/2, $x_round/2, $y_round/2, 1, 0, 0.5);
$img->rect_select($bounds[1], $bounds[4]-$y_round/2, $x_round/2, $y_round/2, 1, 0, 0.5);
$img->rect_select($bounds[1], $bounds[2], $x_round/2, $y_round/2, 1, 0, 0.5);
$img->rect_select($bounds[3]-$x_round/2, $bounds[2], $x_round/2, $y_round/2, 1, 0, 0.5);
$img->rect_select($bounds[3]-$x_round/2, $bounds[4]-$y_round/2, $x_round/2, $y_round/2, 1, 0, 0.5);
$img->rect_select($bounds[1], $bounds[4]-$y_round/2, $x_round/2, $y_round/2, 1, 0, 0.5);
# add them back as elipses
$img->ellipse_select($bounds[1], $bounds[2], $x_round, $y_round, 0, 1, 0, 0.5);
$img->ellipse_select($bounds[3]-$x_round, $bounds[2], $x_round, $y_round, 0, 1, 0, 0.5);
$img->ellipse_select($bounds[3]-$x_round, $bounds[4]-$y_round, $x_round, $y_round, 0, 1, 0, 0.5);
$img->ellipse_select($bounds[1], $bounds[4]-$y_round, $x_round, $y_round, 0, 1, 0, 0.5);
$img->ellipse_select($bounds[1], $bounds[2], $x_round, $y_round, 0, 1, 0, 0.5);
$img->ellipse_select($bounds[3]-$x_round, $bounds[2], $x_round, $y_round, 0, 1, 0, 0.5);
$img->ellipse_select($bounds[3]-$x_round, $bounds[4]-$y_round, $x_round, $y_round, 0, 1, 0, 0.5);
$img->ellipse_select($bounds[1], $bounds[4]-$y_round, $x_round, $y_round, 0, 1, 0, 0.5);
eval { $img->undo_push_group_end };

View File

@ -40,12 +40,12 @@ register "scratches",
my($image,$drawable,$anglex,$angley,$gamma,$length,$width)=@_;
$image->undo_push_group_start;
my $layer1 = new_scratchlayer ($image, $length, $gamma, $anglex);
my $layer2 = new_scratchlayer ($image, $length, $gamma, $angley);
$drawable->displace ($width, $width, 1, 1, $layer1, $layer2, WRAP);
$layer1->remove_layer;
$layer2->remove_layer;

View File

@ -1,6 +1,6 @@
#!/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
# 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 :)
@ -10,10 +10,10 @@
# 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
# 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>
@ -29,20 +29,20 @@ sub saw { # a sawtooth function on PI
return ($val/3.14159) ;
}
elsif ($val < 3.14159) {
return (-1+$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);
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
$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
@ -54,12 +54,12 @@ sub spin_layer { # the function for actually spinning the layer
# 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[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);
$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
# fill entire layer with background
$framelay->fill(1); # BG-IMAGE-FILL
}
for ($i=0; $i<$numframes; $i++) {
@ -71,7 +71,7 @@ sub spin_layer { # the function for actually spinning the layer
$destfram = $all_layers[$numframes]->copy(0);
$img->add_layer($destfram,0);
# clean up my temporary layers
# clean up my temporary layers
$img->remove_layer($all_layers[$numframes]);
$img->remove_layer($all_layers[$numframes+1]);
}
@ -103,7 +103,7 @@ register "seth_spin",
Gimp->progress_init("Seth Spin...",-1);
$tmpimglayer = $img->add_new_layer(0,3,1);
$tmpimglayer = $img->add_new_layer(0,3,1);
$oldbackground = gimp_palette_get_background();
gimp_palette_set_background($color);
@ -130,34 +130,34 @@ register "seth_spin",
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->set_visible($img->add_new_layer(1),($img->get_layers)[0]);
$img->merge_visible_layers(0);
if ($spinback) {
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)");
$all_layers[$frames-1]->set_name("Spin Layer SRC (250ms)");
if ($spinback) {
$all_layers[$frames/2-1]->set_name("Spin Layer DEST (250ms)");
$all_layers[$frames/2-1]->set_name("Spin Layer DEST (250ms)");
}
else { $all_layers[0]->set_name("Spin Layer DEST (250ms)")}
$img->display_new;
# indexed conversion wants a display for some reason
if ($indexed) { $img->convert_indexed(1,255); }
if ($indexed) { $img->convert_indexed(1,255); }
gimp_palette_set_background($oldbackground);
gimp_displays_flush();

View File

@ -5,7 +5,7 @@ use Gimp::Fu;
#Gimp::set_trace(TRACE_ALL);
register "stampify",
register "stampify",
"Makes an image look like a postage stamp.",
"This plug-in works from the active layer. Depending on the size of the image, perforations may look strange. Test alternatives!",
"Claes G Lindblad <claesg\@algonet.se>",
@ -32,7 +32,7 @@ register "stampify",
gimp_drawable_fill($layer1, 1);
# create horisontal holes
gimp_selection_none($img2);
my $nholes = int (($nw + $gap) / ($diameter + $gap) + 0.5);
my $nholes = int (($nw + $gap) / ($diameter + $gap) + 0.5);
$pos = 0;
for ($i = 0; $i<$nholes; $i++) {
gimp_ellipse_select($img2,
@ -42,7 +42,7 @@ register "stampify",
$pos = $pos + $diameter + $gap;
}
# create vertical holes
my $nholes = int (($nh + $gap) / ($diameter + $gap) + 0.5);
my $nholes = int (($nh + $gap) / ($diameter + $gap) + 0.5);
$pos = 0;
for ($i = 0; $i<$nholes; $i++) {
gimp_ellipse_select($img2,

View File

@ -36,7 +36,7 @@ sub stamps {
return $img;
}
register "stamps",
register "stamps",
"Creates a rectangular image with stamp-like perforations.",
"Default values are not bad!",
"Claes G Lindblad <claesg\@algonet.se>",

View File

@ -32,7 +32,7 @@ use Gimp::Util;
# Gimp::set_trace(TRACE_ALL);
register
register
"terraltext",
"Make a cool text bumpmap thingy",
"Does a neat text render effect. If you uncheck the box, it uses the current layer. ".
@ -42,12 +42,12 @@ register
"1999-03-15",
"<Image>/Filters/Render/Terral Text",
"RGB*,GRAY*",
[
[
[ PF_RADIO, "solid_noise", "The Texture Type", 0, ["solid noise" => 1, "current picture" => 0]],
[ PF_FONT, "helvetica", "Font Name", "-*-helvetica-medium-r-normal-*-*-240-*-*-p-*-iso8859-1" ],
[ PF_STRING, "text", "Enter your Text to be Terral-ified", "TerralText"],
[ PF_SLIDER, "blur_amount", "Blur Amount", 10, [0,26,1]],
],
],
[],
['gimp-1.1'],
sub {
@ -55,8 +55,8 @@ sub {
$oldbg = gimp_palette_get_background();
$oldfg = gimp_palette_get_foreground();
if ($solidnoise) {
$pattern->plug_in_solid_noise(1,1,256*rand(), 1,2.5,2.5);
}
@ -66,7 +66,7 @@ sub {
# for now.
# Hello, Seth.. look at this:
$textlayer = $img->layer_new($img->width, $img->height, $img->layertype(1),
"TextLayer", 100, 0);
$img->add_layer($textlayer,1);
@ -76,14 +76,14 @@ sub {
# Place centered Text - what a PITA!
@extents = text_get_extents_fontname($text, xlfd_size($font), $font);
$width = $extents[0];
$height = $extents[1]; # there's other info in 2&3
$width = $extents[0];
$height = $extents[1]; # there's other info in 2&3
$width_offset = ($img->width - $width)/2;
$height_offset = ($img->height - $height)/2;
$floating=$textlayer->text_fontname($width_offset, $height_offset, $text, 0,0,xlfd_size($font), $font);
$floating=$textlayer->text_fontname($width_offset, $height_offset, $text, 0,0,xlfd_size($font), $font);
$floating->floating_sel_anchor;
$textlayer->plug_in_gauss_iir($blur, 1,1);
$textlayer->plug_in_gauss_iir($blur, 1,1);
$textlayer->invert();
$pattern->plug_in_bump_map($textlayer, 130.30, 40, 20, 0, 0, 0, 0, 1, 0, 0);
@ -91,12 +91,12 @@ sub {
$pattern->add_alpha;
}
$mask = $pattern->create_mask(0);
$img->add_layer_mask($pattern, $mask);
$img->add_layer_mask($pattern, $mask);
$textlayer->edit_copy();
$floater = $mask->edit_paste(0);
$floater->floating_sel_anchor;
$mask->levels(0, 0, 113, 0.24, 0, 255);
palette_set_background($oldbg);

View File

@ -53,7 +53,7 @@ sub tex_string_to_pgm {
if (exist_in_tex_path($input_file)) {
$input .= "\\input $input_file\n";
}
open(TEX, ">$fn_base.tex");
print TEX "\\nopagenumbers\n"
. "\\magnification\\magstep$magstep\n"
@ -62,7 +62,7 @@ sub tex_string_to_pgm {
. "$string\n"
. "\\bye";
close(TEX);
my $res = xec("tex $fn_base.tex < /dev/null");
# Deal with errors...
@ -77,7 +77,7 @@ sub tex_string_to_pgm {
my $h = $bbox[3]-$bbox[1];
$psoutput=~ s/^%%BoundingBox:.*$/%%BoundingBox: 0 0 $w $h/m;
$psoutput=~ s/^1 0 bop/-$bbox[0] -$bbox[1] translate\n$&/m;
# Output to file in order not to have to use Open2.
open(PS, ">$fn_base.ps");
print PS $psoutput;
@ -99,13 +99,13 @@ sub grey_file_to_float {
# Setup
my $save_bg = gimp_palette_get_background();
gimp_undo_push_group_start($img1);
# Load the new img
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);
# Create an alpha layer and copy image to alpha layer
gimp_layer_add_alpha($grey_layer);
$grey_img->selection_all();
@ -126,18 +126,18 @@ sub grey_file_to_float {
print STDERR "Yohoo!\n";
cleanup();
# Get rid of $grey_img
gimp_image_delete($grey_img);
# Restore
gimp_palette_set_background($save_bg);
gimp_undo_push_group_end($img1);
# Update the display
gimp_displays_flush();
return undef;
}
@ -153,9 +153,9 @@ sub tex_string_to_float {
tex_string_to_pgm($text, $input_file, $text, $ppi, $magstep, $anti_aliasing,
"$fn_base.pgm");
grey_file_to_float($img1, $drw1, "$fn_base.pgm");
return undef;
}
@ -163,7 +163,7 @@ sub tex_string_to_float {
register "tex_string_to_float", "Turn a TeX-string into floating layer", "Takes a TeX string as input and creates a floating layer of the rendered string in the current layer in the foreground color.",
"Dov Grobgeld <dov\@imagic.weizmann.ac.il>", "Dov Grobgeld",
"1999-03-16",
"<Image>/Filters/Render/TeX String",
"<Image>/Filters/Render/TeX String",
"*",
[
[PF_STRING, "input_file", "TeX macro file to input"],

View File

@ -3,7 +3,7 @@
use Gimp qw( :auto );
use Gimp::Fu;
register "triangle",
register "triangle",
"Creates a triangular selection with the diagonal as one of its sides.",
"Tick appropriate radio buttons.",
"Claes G Lindblad <claesg\@algonet.se>",

View File

@ -25,10 +25,10 @@ register
], [],
sub {
my ($img, $dwb, $polar, $lines, $smooth) = @_;
my $w = $dwb->width;
my $h = $dwb->height;
my $gdwb = $dwb->get;
my $regn = $gdwb->pixel_rgn (0, 0, $w, $h, 0, 0);
my $rect = $regn->get_rect (0, 0, $w, $h);

View File

@ -23,13 +23,13 @@ register "webify",
],
sub {
my($img,$drawable,$new,$alpha,$bg,$thresh,$colours,$autocrop)=@_;
$img = $img->channel_ops_duplicate if $new;
eval { $img->undo_group_start };
$drawable = $img->flatten;
if ($alpha) {
$drawable->add_alpha;
$drawable->by_color_select($bg,$thresh,SELECTION_REPLACE,1,0,0,0);
@ -37,9 +37,9 @@ register "webify",
}
Plugin->autocrop($drawable) if $autocrop;
$img->convert_indexed (1, $colours) if $colours;
eval { $img->undo_group_end };
$new ? ($img->clean_all, $img) : undef;
};

View File

@ -29,7 +29,7 @@ sub windify {
gimp_layer_set_mode($windlayercopy, 10); # Lighten Only
gimp_image_merge_visible_layers($out,0);
# many thanks to Dov for this suggestion as a workaround to the
# many thanks to Dov for this suggestion as a workaround to the
# gimp_image_merge_visible_layers bug
my $newlay = gimp_image_get_active_layer ($out);
@ -40,7 +40,7 @@ sub windify {
gimp_image_delete ($out);
gimp_palette_set_background($oldbg);
gimp_displays_flush();
undef;
}

View File

@ -5,24 +5,24 @@
# or Artistic liscence, whichever makes you happier.
#
# <Xach> sjburges: 1. pixelize the photo 2. in a new white layer, render a grid
# at the same resolution as the pixelize, then blur it. threshold the
# at the same resolution as the pixelize, then blur it. threshold the
# grid until you get a roundish blob in the center of each square (you
# may need to repeat a few times).
# <Xach> sjburges: meanwhile, back at the pixelized image, bumpmap it with
# itself and a depth of about 5. do this twice. then bumpmap it with
# <Xach> sjburges: meanwhile, back at the pixelized image, bumpmap it with
# itself and a depth of about 5. do this twice. then bumpmap it with
# the round blobby layer.
# <Xach> then create a new, clean grid, and bumpmap the pixelized layer with it
#
# (To get a decent blobby grid)
# <Xach> <Xach> render a grid at 10x10, gaussian blur at 7, then set levels to
# 196 1.00 234
# <Xach> <Xach> render a grid at 10x10, gaussian blur at 7, then set levels to
# 196 1.00 234
# Revision - 1.1: added a gimp_displays_flush() for 1.0.x users
# stopped deleting the layers after removal - it was
# causing bad things to happen with refcounts. I hope
# gimp is cleaning up this memory on its own...
# 1.2: Fixed buggy selection handling - oops ;)
# 1.2: Fixed buggy selection handling - oops ;)
# 1.3: Added undo capability by Marc Lehman <pcg@goof.com>
# 1.4: Marc Lehman <pcg@goof.com>, changed function name
# 1.5: Seth Burgess <sjburges@gimp.org> added my email, put it
@ -51,18 +51,18 @@ register "xach_blocks",
eval { $img->undo_push_group_start };
if (!$drawable->has_alpha) {
$drawable->add_alpha;
};
};
if ($img->selection_is_empty) {
$img->selection_all;
$selection_flag = 1;
}
$oldbackground = gimp_palette_get_background();
# Now the fun begins :)
# Now the fun begins :)
$selection = $img->selection_save;
#1. Pixelize the photo
$drawable->plug_in_pixelize($blocksize);
$drawable->plug_in_pixelize($blocksize);
# 2. in a new white layer, render a grid
# at the same resolution as the pixelize, then blur it.
$gridlayer = $img->layer_new($img->width, $img->height, RGBA_IMAGE, "Grid 1", 100, 0);
@ -74,35 +74,35 @@ register "xach_blocks",
$gridlayer->plug_in_grid($blocksize, $blocksize, 0, 0);
$gridlayer->plug_in_gauss_iir(0.7*$blocksize, 1, 1);
# threshold the
# threshold the
# grid until you get a roundish blob in the center of each square (you
# may need to repeat a few times).
# may need to repeat a few times).
$gridlayer->levels(0, 196, 234, $knobfactor/100.0 , 0, 255);
# <Xach> sjburges: meanwhile, back at the pixelized image, bumpmap it with
# itself and a depth of about 5. do this twice.
# <Xach> sjburges: meanwhile, back at the pixelized image, bumpmap it with
# itself and a depth of about 5. do this twice.
gimp_selection_load($selection);
$drawable->plug_in_bump_map($drawable, 135, 45, 5, 0, 0, 0, 0, 1, 0, 0);
$drawable->plug_in_bump_map($drawable, 135, 45, 5, 0, 0, 0, 0, 1, 0, 0);
$drawable->plug_in_bump_map($gridlayer, 135, 45, 5, 0, 0, 0, 0, 1, 0, 0);
# <Xach> then create a new, clean grid, and bumpmap the pixelized layer with it
$img->selection_all;
$cleangrid = $img->layer_new($img->width, $img->height,
$img->selection_all;
$cleangrid = $img->layer_new($img->width, $img->height,
RGBA_IMAGE, "Grid 2", 100, 0);
$img->add_layer($cleangrid,0);
gimp_edit_fill($cleangrid);
$cleangrid->plug_in_grid($blocksize, $blocksize, 0, 0);
gimp_selection_load($selection);
$drawable->plug_in_bump_map($cleangrid, 135, 45, 3, 0, 0, 0, 0, 1, 0, 0);
$img->selection_all;
$img->selection_all;
# Clean up stuff
$img->remove_layer($cleangrid);
# $cleangrid->delete; # Deleting these layers after removal seems to cause
# strange problems (I think gimp handles this
# strange problems (I think gimp handles this
# automatically now)
$img->remove_layer($gridlayer);
# $gridlayer->delete;

View File

@ -4,11 +4,11 @@
#[Xach] start off with an image, then pixelize it
#[Xach] then add alpha->add layer mask [20:21]
#[Xach] render a checkerboard into the layer mask
#[Xach] duplicate the image. fill the original with black, then blur the layer
# mask (i used 30% of pixelize size) and offset it by some value (i
#[Xach] duplicate the image. fill the original with black, then blur the layer
# mask (i used 30% of pixelize size) and offset it by some value (i
# chose 20% of the pixelize size)
#[Xach] duplicate the duplicate, remove the layer mask, move it below everything
#[Xach] then add a new white layer on top, set the mode to multiply, and render
#[Xach] then add a new white layer on top, set the mode to multiply, and render
# a grid into it at pixelize size
#[Xach] that's a bit roundabout, but it's also in the xcf
#
@ -17,7 +17,7 @@
# Revision 1.1: Marc Lehman <pcg@goof.com> added undo capability
# Revision 1.2: Marc Lehman <pcg@goof.com>, changed function name
# Revision 1.3: Seth Burgess <sjburges@gimp.org>, changed location and
# Revision 1.3: Seth Burgess <sjburges@gimp.org>, changed location and
# added my email address
#
# Here's the boring start of every script...
@ -43,13 +43,13 @@ register "xach_shadows",
# $selection_flag = 0;
if (!$drawable->has_alpha) {
$drawable->add_alpha;
};
# This only can be applied to an entire image right now..
};
# This only can be applied to an entire image right now..
# $selection = $img->selection_save;
$img->selection_all;
$oldbackground = gimp_palette_get_background();
# Now the fun begins :)
$drawable->plug_in_pixelize($blocksize);
# Now the fun begins :)
$drawable->plug_in_pixelize($blocksize);
$shadowlayer = $drawable->layer_copy(0);
$img->add_layer($shadowlayer,0);
$checkmask = $shadowlayer->create_mask(WHITE_MASK);
@ -59,7 +59,7 @@ register "xach_shadows",
$frontlayer = $shadowlayer->layer_copy(0);
$img->add_layer($frontlayer,0);
gimp_palette_set_background([0,0,0]);
$shadowlayer->fill(BG_IMAGE_FILL);
$shadowlayer->fill(BG_IMAGE_FILL);
$checkmask->plug_in_gauss_iir(0.3*$blocksize, 1, 1);
gimp_channel_ops_offset ($checkmask, 1, 0, 0.2*$blocksize, 0.2*$blocksize);

View File

@ -27,13 +27,13 @@ register "xachvision",
$midlayer = $drawable->gimp_layer_copy(1);
$img->add_layer($midlayer, 0);
$toplayer = $drawable->gimp_layer_copy(0);
$toplayer = $drawable->gimp_layer_copy(0);
$img->add_layer($toplayer, 0);
gimp_palette_set_background($color);
$toplayer->edit_fill();
$toplayer->set_mode(COLOR_MODE);
gimp_palette_set_background([0,0,0]);
$drawable->edit_fill();

View File

@ -134,7 +134,7 @@ yinyang
B<yinyang> is a B<Gimp> plugin. It generates a Yin/Yang symbol, which
is a Chinese symbol of duality. It takes as parameters (provided by the
Gimp user interface) the width and height of the resulting image;
Gimp user interface) the width and height of the resulting image;
a toggle to indicate if "eyes" should be inserted (see I<EYES>);
a toggle to indicate if the eyes should be images that are
loaded separately; the two filenames for the eyes and a toggle to