mirror of https://github.com/GNOME/gimp.git
see plug-ins/perl/Changes
This commit is contained in:
parent
11b113db61
commit
49ac3a5efa
|
@ -1,5 +1,11 @@
|
|||
Revision history for Gimp-Perl extension.
|
||||
|
||||
- updated seths scripts, added remove_guides...
|
||||
- examples/glowing_steel was missing from the MANIFEST!!
|
||||
- data types for RADIO, SPINNER etc.. are guessed better now.
|
||||
- added examples/guides_to_selection.
|
||||
- added examples/burst, without even looking at it ;)
|
||||
|
||||
1.1 Fri Jul 30 07:37:30 CEST 1999
|
||||
- one of the most successful releases, in terms of features & bugfixes.
|
||||
- it was also a long night. And expensive (irc).
|
||||
|
|
|
@ -790,6 +790,18 @@ Gimp::on_query {
|
|||
} else {
|
||||
die "menupath _must_ start with <Image>, <Toolbox>, <Load>, <Save> or <None>!";
|
||||
}
|
||||
|
||||
# guess the datatype. yeah!
|
||||
sub datatype(@) {
|
||||
for(@_) {
|
||||
return Gimp::PARAM_STRING unless /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/; # perlfaq4
|
||||
return Gimp::PARAM_FLOAT unless /^[+-]?\d+$/; # again
|
||||
}
|
||||
return Gimp::PARAM_INT32;
|
||||
}
|
||||
sub odd_values(@) {
|
||||
my %x = @_; values %x;
|
||||
}
|
||||
|
||||
unshift(@$params,
|
||||
[&Gimp::PARAM_INT32,"run_mode","Interactive, [non-interactive]"]);
|
||||
|
@ -797,10 +809,6 @@ Gimp::on_query {
|
|||
$menupath,$imagetypes,$type,
|
||||
[map {
|
||||
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_TOGGLE;
|
||||
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_SLIDER;
|
||||
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_SPINNER;
|
||||
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_ADJUSTMENT;
|
||||
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_RADIO;
|
||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_FONT;
|
||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_BRUSH;
|
||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_PATTERN;
|
||||
|
@ -808,6 +816,10 @@ Gimp::on_query {
|
|||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_CUSTOM;
|
||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_FILE;
|
||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_TEXT;
|
||||
$_->[0]=datatype(odd_values(@{$_->[4]})) if $_->[0] == PF_RADIO;
|
||||
$_->[0]=datatype($_->[3],@{$_->[4]}) if $_->[0] == PF_SLIDER;
|
||||
$_->[0]=datatype($_->[3],@{$_->[4]}) if $_->[0] == PF_SPINNER;
|
||||
$_->[0]=datatype($_->[3],@{$_->[4]}) if $_->[0] == PF_ADJUSTMENT;
|
||||
$_;
|
||||
} @$params],
|
||||
$results);
|
||||
|
|
|
@ -108,3 +108,7 @@ examples/frame_filter
|
|||
examples/gouge
|
||||
examples/logulator
|
||||
examples/miff
|
||||
examples/guide_remove
|
||||
examples/glowing_steel
|
||||
examples/guides_to_selection
|
||||
examples/burst
|
||||
|
|
|
@ -13,7 +13,7 @@ $|=1;
|
|||
perlotine randomblends innerbevel fit-text guidegrid roundrectsel
|
||||
repdup centerguide stampify goldenmean triangle billboard mirrorsplit
|
||||
oneliners randomart1 pixelmap glowing_steel frame_reshuffle frame_filter
|
||||
logulator miff magick
|
||||
logulator miff magick guide_remove guides_to_selection burst
|
||||
);
|
||||
@shebang = (map("examples/$_",@examples),
|
||||
qw(Perl-Server examples/example-net.pl examples/homepage-logo.pl
|
||||
|
|
|
@ -12,6 +12,9 @@ aaron sherman email schicken(!!!!) wegen logulator
|
|||
|
||||
paint_funcs.h convolve.h gimpdrawable.h gimpimage.h lut_funcs.h paint_core.h plug_in.h flip_tool.h
|
||||
|
||||
Guides->To Selection
|
||||
firetext!
|
||||
|
||||
script-fu 4.9 vs. 3.3
|
||||
|
||||
bugs
|
||||
|
@ -39,7 +42,8 @@ bugs
|
|||
|
||||
important issues
|
||||
|
||||
* gimpdoc with caching & exampling ;--->
|
||||
* constant names (RADIO) automatically into help strings!
|
||||
* gimpdoc with caching & [DONE]exampling ;--->
|
||||
* migrate BOOT: into INIT() (forgot why but important for B)
|
||||
* gimp_progress_done, gimp_progress_close
|
||||
* maybe implement --enable-perl=runtime-only?
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -0,0 +1,191 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
|
||||
if 0; # not running under some shell
|
||||
# <sjburges@gimp.org> (original release)
|
||||
#
|
||||
use Gimp;
|
||||
use Gimp::Fu;
|
||||
use Gimp::Util;
|
||||
|
||||
# This script was requested by jimmac, and I thought it sounded moderately
|
||||
# useful. I could have just made a couple selection masks and made it
|
||||
# moderately useful, but instead I redid all the math myself to make it
|
||||
# intresting and have a really nice effect on the end points (rather than
|
||||
# chopping off odd-shaped brushes when the ellipse ends).
|
||||
|
||||
# Its good to exercise the ol geometry skills every now and then ;)
|
||||
# Enjoy,
|
||||
# Seth Burgess <sjburges@gimp.org>
|
||||
|
||||
# Gimp::set_trace(TRACE_ALL);
|
||||
|
||||
register "burst",
|
||||
"Bursts from a central location\n",
|
||||
"Creates a Burst of various sizes from the center of the currently
|
||||
selected areas. Can create either an elliptical burst, or go to sqare
|
||||
spots. Also, you can specify how much (in pixels) to leave blank on
|
||||
the inside and the outside of the burst. \n",
|
||||
"Seth Burgess",
|
||||
"Seth Burgess <sjburges\@gimp.org>",
|
||||
"1999-07-31",
|
||||
"<Image>/Filters/Misc/Burst",
|
||||
"*",
|
||||
[
|
||||
[PF_RADIO, "shape", "Shape To Burst Into", 0, [Rectangle => 1, Ellipse=> 0]],
|
||||
[PF_RADIO, "fade_dir", "Fade Direction (if set)", 0, [In => 1, Out => 0]],
|
||||
[PF_VALUE, 'points', "How many points", "16"],
|
||||
[PF_VALUE, 'inside_pixels', "Inside Pixels", "10"],
|
||||
[PF_VALUE, 'outside_pixels', "Outside Pixels", "10"]
|
||||
],
|
||||
[],
|
||||
[],
|
||||
sub {
|
||||
my($img,$layer,$shape, $fade_dir, $points, $inside_pixels, $outside_pixels) =@_;
|
||||
$pi = 3.1415927;
|
||||
|
||||
eval { $img->undo_push_group_start };
|
||||
|
||||
($dumb, $x1, $y1, $x2, $y2) = $img->selection_bounds;
|
||||
$img->selection_none;
|
||||
|
||||
$width = $x2 - $x1;
|
||||
$height = $y2 - $y1;
|
||||
|
||||
# print "X1 = $x1, X2 = $x2, Y1 = $y1, Y2 = $y2\n";
|
||||
$center_x = $x1 + $width/2;
|
||||
$center_y = $y1 + $height/2;
|
||||
|
||||
if ($shape == 0)
|
||||
{ #ellipse
|
||||
$angle = 0;
|
||||
for ($i = 0; $angle <2*$pi-0.01; $i++ )
|
||||
{
|
||||
$angle = $i * 2*$pi/$points;
|
||||
|
||||
# use the major/minor axis description of an ellipse:
|
||||
# x^2 y^2
|
||||
# --- + --- = 1
|
||||
# a^2 b^2
|
||||
#
|
||||
# where a is the x axis, b is the y axis, and the equation of
|
||||
# a line passing through 0 (y=mb). Solve for x&y, and pick the
|
||||
# correct one for the angle.
|
||||
|
||||
$a = $width/2 - $outside_pixels;
|
||||
$b = $height/2 - $outside_pixels;
|
||||
|
||||
# dimensions for an "inside ellipse"
|
||||
$c = ($a>$b)?$inside_pixels:$inside_pixels*$a/$b;
|
||||
$d = ($a>$b)?$inside_pixels*$b/$a:$inside_pixels;
|
||||
|
||||
# get the slope
|
||||
$m = sin($angle)/cos($angle);
|
||||
if ($m ==0) { $m = 0.000000000001; } #avoid div by 0
|
||||
if ($c ==0) { $c = 0.000000000001; } #avoid div by 0
|
||||
if ($d ==0) { $d = 0.000000000001; } #avoid div by 0
|
||||
|
||||
# find the positive solution of the quadratic for the endpoints
|
||||
$x = sqrt(1/((1/$a/$a)+($m*$m/$b/$b)));
|
||||
$y = sqrt(1/((1/($m*$m*$a*$a))+(1/$b/$b)));
|
||||
|
||||
# and find the starting points in the same manner
|
||||
$x_start = sqrt(1/((1/$c/$c)+($m*$m/$d/$d)));
|
||||
$y_start = sqrt(1/((1/($m*$m*$c*$c))+(1/$d/$d)));
|
||||
|
||||
# pick the right solution of the quadratic
|
||||
if ($angle < $pi/2 || $angle > 3*$pi/2)
|
||||
{
|
||||
$x = -$x;
|
||||
$x_start = -$x_start;
|
||||
}
|
||||
if ($angle > $pi)
|
||||
{
|
||||
$y = -$y;
|
||||
$y_start = -$y_start;
|
||||
}
|
||||
|
||||
# do translations to center stuff
|
||||
$x = $x + $center_x;
|
||||
$y = $y + $center_y;
|
||||
$x_start = $x_start + $center_x;
|
||||
$y_start = $y_start + $center_y;
|
||||
|
||||
# print "X = $x, Y = $y, M = $m\n";
|
||||
|
||||
if ($fade_dir == 1)
|
||||
{
|
||||
$layer->paintbrush_default(4, [$x, $y, $x_start, $y_start]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$layer->paintbrush_default(4, [$x_start, $y_start, $x, $y]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ #rectangle
|
||||
# The idea here is to see where the line intersects with the
|
||||
# rightmost line. If the abs of that is higer than the height,
|
||||
# see where it intersects the top instead.
|
||||
|
||||
#print "width = $width, height = $height\n";
|
||||
|
||||
$angle = 0;
|
||||
for ($i = 0; $angle <2*$pi-0.01; $i++ )
|
||||
{
|
||||
$angle = $i * 2*$pi/$points;
|
||||
|
||||
# get the slope
|
||||
$m = sin($angle)/cos($angle);
|
||||
# print "M = $m\n";
|
||||
if (abs($m*$width/2) < $height/2-$outside_pixels)
|
||||
{ # draw on the right/left borders
|
||||
$x = $width/2-$outside_pixels;
|
||||
$y = $m*($width/2-$outside_pixels);
|
||||
$x_start = ($width>$height)
|
||||
?$inside_pixels
|
||||
:$inside_pixels*$width/$height;
|
||||
$y_start = ($width>$height)
|
||||
?$m*$inside_pixels
|
||||
:$m*$inside_pixels*$width/$height;
|
||||
}
|
||||
else
|
||||
{ # draw on the top/bottom borders
|
||||
$y = $height/2-$outside_pixels;
|
||||
$x = ($height/2-$outside_pixels)/$m;
|
||||
$y_start = ($width>$height)
|
||||
?$inside_pixels*$height/$width
|
||||
:$inside_pixels;
|
||||
$x_start = ($width>$height)
|
||||
?$inside_pixels*$height/$width/$m
|
||||
:$inside_pixels/$m;
|
||||
}
|
||||
|
||||
if ($angle > $pi)
|
||||
{
|
||||
$x = -$x;
|
||||
$y = -$y;
|
||||
$x_start = -$x_start;
|
||||
$y_start = -$y_start;
|
||||
}
|
||||
# print "X = $x, Y = $y\n";
|
||||
# do translations to center stuff
|
||||
$x = $x + $center_x;
|
||||
$y = $y + $center_y;
|
||||
$x_start = $x_start + $center_x;
|
||||
$y_start = $y_start + $center_y;
|
||||
if ($fade_dir == 1)
|
||||
{
|
||||
$layer->paintbrush_default(4, [$x, $y, $x_start, $y_start]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$layer->paintbrush_default(4, [$x_start, $y_start, $x, $y]);
|
||||
}
|
||||
}
|
||||
}
|
||||
eval { $img->undo_push_group_end };
|
||||
return();
|
||||
};
|
||||
exit main;
|
|
@ -1,8 +1,18 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
|
||||
if 0; # not running under some shell
|
||||
# <sjburges@gimp.org>
|
||||
# This is adrian and xachs idea - take a rectangluar selection, and select
|
||||
# font type and string. Then fill it with whatever size is needed.
|
||||
|
||||
# This uses highly non-scientific "for my test image these were ok"
|
||||
# approximations - I didn't chart anything or calcualte tradeoffs. Really
|
||||
# it doesn't matter until the fine tuning, which takes awhile.
|
||||
|
||||
# 7/15/99: added support if the user selects in pixels (assumes 72 dpi - deal)
|
||||
# and tuned it a bit more <sjburges@gimp.org>
|
||||
|
||||
use Gimp;
|
||||
use Gimp::Fu;
|
||||
use Gimp::Util;
|
||||
|
@ -11,12 +21,17 @@ use Gimp::Util;
|
|||
|
||||
$defaultfont = "-*-blippo-heavy-r-normal-*-*-360-*-*-p-*-iso8859-1";
|
||||
undef $defaultfont;
|
||||
$calls = 0;
|
||||
|
||||
sub growfont {
|
||||
($fontname, $plussize) = @_;
|
||||
@fontdesc = split /-/, $fontname;
|
||||
$fontdesc[8] += $plussize;
|
||||
$fontdesc[8] eq "*" ?
|
||||
$fontdesc[7] += $plussize/72 : # if in pixels
|
||||
$fontdesc[8] += $plussize; # if in points
|
||||
$outname = join "-", @fontdesc;
|
||||
print ("!!!${fontdesc[8]}-${fondesc[9]}!!!\n");
|
||||
$calls ++;
|
||||
return $outname;
|
||||
}
|
||||
|
||||
|
@ -39,7 +54,7 @@ register "fit_text",
|
|||
$height = $y2-$y1;
|
||||
|
||||
@extents=gimp_text_get_extents_fontname($string,xlfd_size($xlfd),$xlfd);
|
||||
$growsize = ($extents[0]<$width && $extents[1]<$height) ? 80 : -80;
|
||||
$growsize = ($extents[0]<$width && $extents[1]<$height) ? 288 : -288;
|
||||
if ($growsize > 0 ) {
|
||||
while ($extents[0]<$width && $extents[1]<$height) {
|
||||
$xlfd = growfont($xlfd,$growsize);
|
||||
|
@ -55,15 +70,11 @@ register "fit_text",
|
|||
}
|
||||
|
||||
while ($extents[0]<$width && $extents[1]<$height) {
|
||||
$xlfd = growfont($xlfd,10); # precision for the last bit
|
||||
$xlfd = growfont($xlfd,144); # 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);
|
||||
@extents=gimp_text_get_extents_fontname($string,xlfd_size($xlfd),$xlfd);
|
||||
}
|
||||
# print $xlfd, "\n";
|
||||
$xlfd = growfont($xlfd, -144);
|
||||
|
||||
$tmplay = $layer->text_fontname($x1,$y1,$string,0,1,xlfd_size($xlfd), $xlfd);
|
||||
$width2=$tmplay->width;
|
||||
|
@ -73,15 +84,31 @@ register "fit_text",
|
|||
# print "$width2, $height2:$width, $height\n";
|
||||
while ($width2<$width && $height2<$height) {
|
||||
$tmplay->remove;
|
||||
$xlfd = growfont($xlfd,4);
|
||||
$xlfd = growfont($xlfd,288);
|
||||
$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);
|
||||
$tmplay=$layer->text_fontname($x1,$y1,$string,0,1,xlfd_size($xlfd), $xlfd);
|
||||
|
||||
while ($width2>$width || $height2>$height) {
|
||||
$tmplay->remove;
|
||||
$xlfd = growfont($xlfd,-72);
|
||||
$tmplay=$layer->text_fontname($x1,$y1,$string,0,1,xlfd_size($xlfd), $xlfd);
|
||||
$width2=$tmplay->width;
|
||||
$height2=$tmplay->height;
|
||||
}
|
||||
while ($width2<$width && $height2<$height) {
|
||||
$tmplay->remove;
|
||||
$xlfd = growfont($xlfd,12);
|
||||
$tmplay=$layer->text_fontname($x1,$y1,$string,0,1,xlfd_size($xlfd), $xlfd);
|
||||
$width2=$tmplay->width;
|
||||
$height2=$tmplay->height;
|
||||
}
|
||||
$tmplay->remove;
|
||||
$xlfd = growfont($xlfd,-12);
|
||||
$tmplay=$layer->text_fontname($x1,$y1,$string,0,1,
|
||||
xlfd_size($xlfd), $xlfd);
|
||||
# print $calls;
|
||||
return();
|
||||
};
|
||||
exit main;
|
||||
|
|
|
@ -0,0 +1,452 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# A plug-in for GIMP for producing logos and other such nifty things
|
||||
# which appear to be made of steel and floating over a glowing cloud.
|
||||
# This plug-in also includes several filters and such for performing the
|
||||
# various stages of this logo (e.g. burshed steel, add glow, highlight edges).
|
||||
#
|
||||
# Written in 1999 (c) by Aaron Sherman <ajs@ajs.com>.
|
||||
# This plugin may be distributed under the same terms as The Gimp itself.
|
||||
# See http://www.gimp.org/ for more information on The Gimp.
|
||||
#
|
||||
|
||||
require 5.004;
|
||||
|
||||
use Gimp qw(:auto);
|
||||
use Gimp::Fu;
|
||||
use Gimp::Util;
|
||||
|
||||
use strict;
|
||||
use vars qw($glowing_steel_version $glowing_steel_released
|
||||
$gimp_white_fudge);
|
||||
|
||||
$glowing_steel_version = "1.0a";
|
||||
$glowing_steel_released = "6/14/1999";
|
||||
|
||||
# In version 1.1.6, gimp_layer_translate did not work correctly, given an
|
||||
# offset of -1, so set this to -1, if that bug goes away:
|
||||
$gimp_white_fudge = -2;
|
||||
|
||||
sub perl_fu_glowing_steel {
|
||||
my $string = shift;
|
||||
my $font = shift;
|
||||
my $size = shift;
|
||||
my $units = PIXELS;
|
||||
my $glow = shift;
|
||||
my $background = shift;
|
||||
my $radius = shift;
|
||||
my $do_highl = shift;
|
||||
my $antialias = shift;
|
||||
|
||||
# Gimp::set_trace(TRACE_ALL);
|
||||
|
||||
($size, $units) = xlfd_size($font) if $size < 1;
|
||||
die("glowing_steel: No font size given or inferable") if $size < 1;
|
||||
|
||||
my $old = gimp_palette_get_foreground();
|
||||
my $image = gimp_image_new(100, 100, RGB);
|
||||
gimp_image_disable_undo($image);
|
||||
my $textlayer = gimp_text_fontname($image, -1, $radius*2,
|
||||
$radius*2, $string, 0, $antialias,
|
||||
$size, $units, $font);
|
||||
my $width = $textlayer->width+$radius*4;
|
||||
my $height = $textlayer->height+$radius*4;
|
||||
gimp_image_resize($image, $width, $height, 0, 0);
|
||||
my $backlayer = gimp_layer_new($image, $width, $height, RGBA_IMAGE,
|
||||
"Background", 100, NORMAL_MODE);
|
||||
gimp_image_add_layer($image, $backlayer, 1);
|
||||
gimp_layer_set_preserve_trans($textlayer,1);
|
||||
|
||||
perl_fu_brushed_metal($image, $textlayer, 25, 135);
|
||||
|
||||
if ($do_highl) {
|
||||
perl_fu_highlight_edges($image, $textlayer, 1);
|
||||
# Merge in the highlight so that the glow shape will include the 1-pixel
|
||||
# highlight
|
||||
my $hl_layer = (gimp_image_get_layers($image))[0];
|
||||
$textlayer = gimp_image_merge_down($image, $hl_layer, EXPAND_AS_NECESSARY);
|
||||
}
|
||||
gimp_layer_set_name($textlayer, "Text");
|
||||
|
||||
# Fill the background
|
||||
gimp_selection_all($image);
|
||||
gimp_palette_set_foreground($background);
|
||||
gimp_bucket_fill($backlayer, FG_BUCKET_FILL, NORMAL_MODE, 100, 0, 1, 0, 0);
|
||||
|
||||
# Make the glow:
|
||||
perl_fu_add_glow($image, $textlayer, $glow, $radius);
|
||||
|
||||
gimp_palette_set_foreground($old);
|
||||
|
||||
gimp_image_enable_undo($image);
|
||||
gimp_selection_none($image);
|
||||
gimp_image_set_active_layer($image,$backlayer);
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
sub perl_fu_add_glow {
|
||||
my $image = shift;
|
||||
my $drawable = shift;
|
||||
my $color = shift;
|
||||
my $radius = shift;
|
||||
my $old_draw = $drawable;
|
||||
my $is_float = 0;
|
||||
my $old_sel = gimp_selection_save($image);
|
||||
|
||||
gimp_undo_push_group_start($image);
|
||||
|
||||
if (!gimp_drawable_layer($drawable)) {
|
||||
die("add_glow: Only layers can have glow added");
|
||||
}
|
||||
|
||||
if (!gimp_drawable_has_alpha($drawable)) {
|
||||
my($sel,$x1,$y1,$x2,$y2) = gimp_selection_bounds($image);
|
||||
if ($sel) {
|
||||
$is_float = 1;
|
||||
$drawable = gimp_selection_float($drawable,0,0);
|
||||
} else {
|
||||
die("add_glow: Need a selection to work on");
|
||||
}
|
||||
}
|
||||
|
||||
my $type = gimp_drawable_type($drawable);
|
||||
my $glow = gimp_layer_new($image, gimp_image_width($image),
|
||||
gimp_image_height($image), $type, "Glow layer",
|
||||
100, NORMAL_MODE);
|
||||
my $lnum;
|
||||
if (!defined($lnum = gimp_layer_get_position($drawable))) {
|
||||
# Bug in Gimp::Util?
|
||||
warn("add_glow: gimp_layer_get_position failed");
|
||||
$lnum = 0;
|
||||
}
|
||||
gimp_image_add_layer($image, $glow, $lnum);
|
||||
|
||||
# Clear out the new layer
|
||||
gimp_selection_all($image);
|
||||
gimp_edit_clear($glow);
|
||||
# Add the glow
|
||||
my $old = gimp_palette_get_foreground();
|
||||
gimp_palette_set_foreground($color);
|
||||
gimp_selection_layer_alpha($drawable);
|
||||
gimp_selection_grow($image, $radius);
|
||||
gimp_selection_feather($image, $radius*1.5);
|
||||
gimp_bucket_fill($glow,FG_BUCKET_FILL,NORMAL_MODE,100,255,0,0,0);
|
||||
gimp_palette_set_foreground($old);
|
||||
gimp_selection_layer_alpha($drawable);
|
||||
gimp_edit_clear($glow);
|
||||
|
||||
gimp_selection_load($old_sel);
|
||||
gimp_floating_sel_anchor($drawable) if $is_float;
|
||||
gimp_image_set_active_layer($image,$old_draw);
|
||||
gimp_undo_push_group_end($image);
|
||||
gimp_displays_flush();
|
||||
}
|
||||
|
||||
sub perl_fu_brushed_metal {
|
||||
my $image = shift;
|
||||
my $drawable = shift;
|
||||
my $length = shift;
|
||||
my $angle = shift;
|
||||
|
||||
gimp_undo_push_group_start($image);
|
||||
|
||||
# A whole lot of layer fiddling to get around the fact that
|
||||
# plug_in_mblur does the wrong thing with borders....
|
||||
my($bset, $x1, $y1, $x2, $y2) = gimp_selection_bounds($image);
|
||||
if (!$bset) {
|
||||
if(gimp_drawable_has_alpha($drawable)) {
|
||||
gimp_selection_layer_alpha($drawable);
|
||||
} else {
|
||||
gimp_selection_all($image);
|
||||
}
|
||||
my $ignore;
|
||||
($ignore, $x1, $y1, $x2, $y2) = gimp_selection_bounds($image);
|
||||
}
|
||||
$x1-=$length;
|
||||
$y1-=$length;
|
||||
$x2+=$length;
|
||||
$y2+=$length;
|
||||
my $width = $x2-$x1;
|
||||
my $height = $y2-$y1;
|
||||
my $templ = gimp_layer_new($image, $width, $height, RGBA_IMAGE, "Temp",
|
||||
100, NORMAL_MODE);
|
||||
gimp_image_add_layer($image, $templ, 0);
|
||||
my $target_select = gimp_selection_save($image);
|
||||
gimp_selection_none($image);
|
||||
|
||||
# Render the actual effect into our temporary layer
|
||||
plug_in_solid_noise($image, $templ, 0, 0, time(),
|
||||
1, 1.5, 2.5);
|
||||
gimp_brightness_contrast($templ, 50, 0);
|
||||
plug_in_noisify($image, $templ, 0, 0.3, 0.3, 0.3, 0);
|
||||
plug_in_mblur($image, $templ, 0, $length, $angle);
|
||||
|
||||
# Now put it into the target layer
|
||||
gimp_selection_load($target_select);
|
||||
gimp_edit_copy($templ);
|
||||
my $float = gimp_edit_paste($drawable, 0);
|
||||
gimp_layer_set_offsets($float, $x1+$length, $y1+$length);
|
||||
gimp_floating_sel_anchor($float);
|
||||
gimp_image_remove_layer($image,$templ);
|
||||
# gimp_layer_delete($templ);
|
||||
|
||||
gimp_undo_push_group_end($image);
|
||||
|
||||
gimp_displays_flush();
|
||||
}
|
||||
|
||||
sub perl_fu_highlight_edges {
|
||||
my $image = shift;
|
||||
my $drawable = shift;
|
||||
my $pixels = shift;
|
||||
my $old_draw = $drawable;
|
||||
my $is_float = 0;
|
||||
my $old_sel = gimp_selection_save($image);
|
||||
|
||||
gimp_undo_push_group_start($image);
|
||||
|
||||
if (!gimp_drawable_layer($drawable)) {
|
||||
gimp_message("highlight_edges: Only layers can be highlighted!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gimp_drawable_has_alpha($drawable)) {
|
||||
my($sel,$x1,$y1,$x2,$y2) = gimp_selection_bounds($image);
|
||||
if ($sel) {
|
||||
$is_float = 1;
|
||||
$drawable = gimp_selection_float($drawable,0,0);
|
||||
} else {
|
||||
die("highlight_edges: Need a selection (or alpha layer) to work on");
|
||||
}
|
||||
}
|
||||
|
||||
gimp_selection_layer_alpha($drawable);
|
||||
my $white = gimp_layer_copy($drawable,0);
|
||||
my $black = gimp_layer_copy($drawable,0);
|
||||
my $lnum;
|
||||
if (!defined($lnum = gimp_layer_get_position($drawable))) {
|
||||
# Bug in Gimp::Util?
|
||||
warn("highlight_edges: gimp_layer_get_position failed");
|
||||
$lnum = 0;
|
||||
}
|
||||
gimp_image_add_layer($image, $black, $lnum);
|
||||
gimp_image_add_layer($image, $white, $lnum);
|
||||
my $old = gimp_palette_get_foreground();
|
||||
gimp_palette_set_foreground([255,255,255]);
|
||||
gimp_bucket_fill($white,FG_BUCKET_FILL,NORMAL_MODE,100,255,0,0,0);
|
||||
gimp_palette_set_foreground([0,0,0]);
|
||||
gimp_bucket_fill($black,FG_BUCKET_FILL,NORMAL_MODE,100,255,0,0,0);
|
||||
gimp_palette_set_foreground($old);
|
||||
gimp_layer_translate($white, $gimp_white_fudge, -1);
|
||||
gimp_layer_translate($black, 1, 1);
|
||||
$white = gimp_image_merge_down($image, $white, EXPAND_AS_NECESSARY);
|
||||
gimp_layer_set_name($white, "Edge Highlight");
|
||||
gimp_selection_layer_alpha($drawable);
|
||||
gimp_edit_clear($white);
|
||||
|
||||
gimp_selection_load($old_sel);
|
||||
gimp_floating_sel_anchor($drawable) if $is_float;
|
||||
# gimp_image_set_active_layer($image,$old_draw);
|
||||
gimp_undo_push_group_end($image);
|
||||
gimp_displays_flush();
|
||||
}
|
||||
|
||||
# Register the plug-ins:
|
||||
register
|
||||
"highlight_edges",
|
||||
"Frame an alpha layer with black and white edges",
|
||||
"Use this pluggin to highlight the edges of an alpha layer and make ".
|
||||
"it appear to have height. Not quite the same as a beveled edge, ".
|
||||
"this is a somewhat more subtle technique.",
|
||||
"Aaron Sherman", "Aaron Sherman (c)", "1999-06-14",
|
||||
"<Image>/Filters/Render/Highlight Edges",
|
||||
"*",
|
||||
[
|
||||
[PF_INT32, "edging", "Pixels", 1]
|
||||
],
|
||||
\&perl_fu_highlight_edges;
|
||||
|
||||
register
|
||||
"brushed_metal",
|
||||
"Create a brushed metal surface effect",
|
||||
"Use this pluggin to make a surface (selected area) look like ".
|
||||
"brushed metal (kind of like steel).",
|
||||
"Aaron Sherman", "Aaron Sherman (c)", "1999-06-14",
|
||||
"<Image>/Filters/Render/Brushed Metal",
|
||||
"*",
|
||||
[
|
||||
[PF_SLIDER, "stroke_length", "Length", 25, [1, 100, 1]],
|
||||
[PF_SLIDER, "angle", "Angle (0-359)", 135, [0, 359, 1]]
|
||||
],
|
||||
\&perl_fu_brushed_metal;
|
||||
|
||||
register
|
||||
"add_glow",
|
||||
"Add a glow behind an alpha layer",
|
||||
"Use this pluggin to add a glowing layer behind an existing layer. This ".
|
||||
"is very different from drop shadows, as the glow will extend out ".
|
||||
"in the given radius from all edges of the layer.",
|
||||
"Aaron Sherman", "Aaron Sherman (c)", "1999-06-14",
|
||||
"<Image>/Filters/Render/Add Glow",
|
||||
"*",
|
||||
[
|
||||
[PF_COLOR, "glow_color", "Color", [0x00, 0x00, 0xff]],
|
||||
[PF_SPINNER, "glow_radius", "Radius", 10, [1, 1000, 1]]
|
||||
],
|
||||
\&perl_fu_add_glow;
|
||||
|
||||
register
|
||||
"glowing_steel",
|
||||
"Render metal surface over glowing background",
|
||||
"Use this pluggin to create the effect of a metalic surface over ".
|
||||
"a glowing surface. This effect was inspired by a poster for the ".
|
||||
"film \"Lost In Space\".",
|
||||
"Aaron Sherman", "Aaron Sherman (c)", "1999-06-14",
|
||||
"<Toolbox>/Xtns/Render/Logos/Glowing Steel",
|
||||
"*",
|
||||
[
|
||||
[PF_STRING, "string", "string", "GET LOST"],
|
||||
# The font in the poster was like "cobalt extended"
|
||||
[PF_FONT, "font", "Font", undef],
|
||||
[PF_SPINNER, "size", "Size", 100, [0, 3000, 1]],
|
||||
[PF_COLOR, "glow_color", "Color", [0xff, 0xd0, 0x00]],
|
||||
[PF_COLOR, "background", "Color", [0x00, 0x00, 0x00]],
|
||||
[PF_INT32, "glow_radius", "radius", 4],
|
||||
[PF_TOGGLE, "highlight_edges", "", 1],
|
||||
[PF_TOGGLE, "antialias", "", 1]
|
||||
],
|
||||
[
|
||||
[PF_IMAGE, "image", "resulting image"]
|
||||
],
|
||||
\&perl_fu_glowing_steel;
|
||||
|
||||
exit main;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
glowing_steel - A logo plugin for the Gimp
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
<Toolbox>/Xtns/Logos/Glowing Steel
|
||||
<Image>/Filters/Render/Brushed Metal
|
||||
<Image>/Filters/Render/Highlight Edges
|
||||
<Image>/Filters/Render/Add Glow
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This plugin renders the given text in the given font and size in a logo
|
||||
style that combines the I<Brushed Metal> effect with the I<Highlight Edges>
|
||||
and I<Add Glow> effects. The text is surfaced with brushed metal, and
|
||||
highlighted, and the glow is added in the background.
|
||||
|
||||
This plug-in also includes the effects listed above as separete tools
|
||||
which may be used independant of creating a logo. These tools are:
|
||||
|
||||
=over 5
|
||||
|
||||
=item Brushed Metal
|
||||
|
||||
Takes length of brush strokes and angle, and renders a brushed metal surface
|
||||
into the target drawable.
|
||||
|
||||
PDB call:
|
||||
|
||||
perl_fu_brushed_metal(image, drawable, length, angle)
|
||||
|
||||
C<length> must be greater than 1.
|
||||
|
||||
=item Highlight Edges
|
||||
|
||||
Takes a number of pixels and adds a black/white highlight to the drawable.
|
||||
Target drawable must be an alpha layer.
|
||||
|
||||
PDB call:
|
||||
|
||||
perl_fu_highlight_edges(image, drawable, pixels)
|
||||
|
||||
=item Add Glow
|
||||
|
||||
Takes a color and radius, and renders a fuzzy glow in the given color,
|
||||
out to the given radius behind the target drawable. This is added as
|
||||
a new layer, and the target drawable must be an alpha layer.
|
||||
|
||||
PDB call:
|
||||
|
||||
perl_fu_add_glow(image, drawable, color, radius)
|
||||
|
||||
=back
|
||||
|
||||
=head1 PARAMETERS
|
||||
|
||||
The following parameters can be set by the user (or caller) of glowing_steel:
|
||||
|
||||
=over 5
|
||||
|
||||
=item B<String>
|
||||
|
||||
The string to display
|
||||
|
||||
=item B<Font>
|
||||
|
||||
The Font to render the string in.
|
||||
|
||||
=item B<Size>
|
||||
|
||||
The size to use for the font. Note: if B<Font> includes a size, it will
|
||||
be ignored. This is because not all fonts I<do> include a size (e.g.
|
||||
True Type Fonts from the xttf server).
|
||||
|
||||
Passing a value less than 1 (e.g. 0) for the size will force use of the given
|
||||
font's size, but as noted above, this may be sub-optimal (e.g. you may not
|
||||
be given size choices in the font dialog).
|
||||
|
||||
=item B<Glow Color>
|
||||
|
||||
The color to use for the background glow.
|
||||
|
||||
=item B<Background Color>
|
||||
|
||||
The color to use for the background layer.
|
||||
|
||||
=item B<Glow Radius>
|
||||
|
||||
The radius in pixels that the glow should eminate from the edge of the text.
|
||||
|
||||
=item B<Highlight Edges>
|
||||
|
||||
This toggle tells glowing_steel if it should (true) or should not
|
||||
(false) add one-pixel black/white edge highlighting. Default is to
|
||||
add the highlighting.
|
||||
|
||||
=item B<Antialias>
|
||||
|
||||
This toggle will turn on (true) or off (false) font antialiasing. This
|
||||
should only be used if you find that this plugin crashes because the font
|
||||
you chose could not be antialiased (the gimp will display an error suggesting
|
||||
that you turn off antialiasing).
|
||||
|
||||
=back
|
||||
|
||||
PDB call:
|
||||
|
||||
perl_fu_glowing_metal( string, font, size, glow_color,
|
||||
back_color, glow_radius, highlight, antialias)
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Written in 1999 (c) by Aaron Sherman E<lt>ajs@ajs.comE<gt>
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
TBD
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<gimp>, L<perl>, L<Gimp>: the Gimp module for perl.
|
||||
|
||||
=cut
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
#
|
||||
# 11/7/99 <brendy@swipnet.se>
|
||||
# Guides are pretty good, but I want to be able to remove them.
|
||||
#
|
||||
|
||||
use Gimp;
|
||||
use Gimp::Fu;
|
||||
use Gimp::Util;
|
||||
|
||||
# Gimp::set_trace(TRACE_ALL);
|
||||
|
||||
register "guide_remove",
|
||||
"guideremove - erases all existing guides\n",
|
||||
"Just does it!\n",
|
||||
"Brendon Humphrey",
|
||||
"Brendon Humphrey <brendy\@swipnet.se>",
|
||||
"1999-07-20",
|
||||
"<Image>/Guides/Remove Guides",
|
||||
"*",
|
||||
[],
|
||||
[],
|
||||
['gimp-1.1'],
|
||||
sub {
|
||||
my($img,$layer,$xspace, $yspace, $xoffset, $yoffset) =@_;
|
||||
|
||||
#
|
||||
# Remove all existing guides
|
||||
#
|
||||
$i=$img->find_next_guide(0);
|
||||
while ($i != 0) {
|
||||
$img->delete_guide($i);
|
||||
$i=$img->find_next_guide($i);
|
||||
}
|
||||
|
||||
#
|
||||
# Refresh the display (probably not good, works for me!)
|
||||
#
|
||||
#$img->selection_all();
|
||||
#$img->selection_none();
|
||||
|
||||
();
|
||||
};
|
||||
exit main;
|
|
@ -1,8 +1,17 @@
|
|||
#!/usr/bin/perl
|
||||
# <sjburges@gimp.org>
|
||||
# This is adrian's idea - take random blends and difference them. You're
|
||||
# bound to come up w/ something cool eventually.
|
||||
|
||||
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
|
||||
if 0; # not running under some shell
|
||||
# <sjburges@gimp.org> (original release)
|
||||
#
|
||||
# 11/7/99 <brendy@swipnet.se>
|
||||
# Added an option to remove existing guides
|
||||
# Added progress bar.
|
||||
# ** How can we force the display to update after adding guides? **
|
||||
#
|
||||
# 12/7/99 <sjburges@gimp.org>
|
||||
# Changed the display code in C and got rid of ugly hack in perl.
|
||||
#
|
||||
use Gimp;
|
||||
use Gimp::Fu;
|
||||
use Gimp::Util;
|
||||
|
@ -10,36 +19,66 @@ use Gimp::Util;
|
|||
# Gimp::set_trace(TRACE_ALL);
|
||||
|
||||
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>",
|
||||
"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]],
|
||||
],
|
||||
[],
|
||||
['gimp-1.1'],
|
||||
sub {
|
||||
my($img,$layer,$xspace, $yspace, $xoffset, $yoffset) =@_;
|
||||
"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>",
|
||||
"1999-03-20",
|
||||
"<Image>/Guides/Guide Grid",
|
||||
"*",
|
||||
[
|
||||
[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]],
|
||||
[PF_TOGGLE, "remove_old_guides", "Remove existing guides?", 0],
|
||||
],
|
||||
[],
|
||||
['gimp-1.1'],
|
||||
sub {
|
||||
my($img,$layer,$xspace, $yspace, $xoffset, $yoffset, $remove_old_guides) =@_;
|
||||
|
||||
for ($i=$xoffset; $i<$img->width; $i+=$xspace) {
|
||||
if ($i) {
|
||||
$img->add_vguide($i);
|
||||
}
|
||||
}
|
||||
#
|
||||
# Remove all existing guides (this is optional)
|
||||
#
|
||||
if($remove_old_guides) {
|
||||
$i=$img->find_next_guide(0);
|
||||
while ($i != 0) {
|
||||
$img->delete_guide($i);
|
||||
$i=$img->find_next_guide(0);
|
||||
}
|
||||
}
|
||||
|
||||
for ($i=$yoffset; $i<$img->height; $i+=$yspace) {
|
||||
if ($i) {
|
||||
$img->add_hguide($i);
|
||||
}
|
||||
}
|
||||
#
|
||||
# Add vertical guides to the image
|
||||
#
|
||||
for ($i=$xoffset; $i<$img->width; $i+=$xspace) {
|
||||
if ($i) {
|
||||
$img->add_vguide($i);
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Add horizontal guides to the image
|
||||
#
|
||||
for ($i=$yoffset; $i<$img->height; $i+=$yspace) {
|
||||
if ($i) {
|
||||
$img->add_hguide($i);
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# I fixed this in Gimp C code (it wasn't flushing guides properly)
|
||||
# Seth Burgess <sjburges@gimp.org>
|
||||
#
|
||||
|
||||
##
|
||||
## Refresh the display (probably not good, works for me!)
|
||||
##
|
||||
##
|
||||
#$img->selection_all();
|
||||
#$img->selection_none();
|
||||
|
||||
return();
|
||||
};
|
||||
};
|
||||
exit main;
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use Gimp;
|
||||
use Gimp::Fu;
|
||||
use Gimp::Util;
|
||||
|
||||
register "guide_to_selection",
|
||||
"Selects the area under the selection",
|
||||
"Selects the area under the guides and a small area beneath",
|
||||
"Marc Lehmann",
|
||||
"Marc Lehmann <pcg\@goof.com>",
|
||||
"1999-08-01",
|
||||
"<Image>/Guides/To Selection",
|
||||
"*",
|
||||
[
|
||||
[PF_RADIO, "operation", "The selection operation", REPLACE, [ADD => ADD, SUB => SUB, REPLACE => REPLACE]],
|
||||
[PF_TOGGLE, "feather", "Feather the selection?", 0],
|
||||
[PF_SPINNER, "feather_radius","Radius for feather operation", 1, [0, 1000, 1e0]],
|
||||
],
|
||||
[],
|
||||
['gimp-1.1'],
|
||||
sub {
|
||||
my($img, $drawable, $operation, $feather, $radius) = @_;
|
||||
my($W,$H) = ($img->width, $img->height);
|
||||
|
||||
$i = $img->find_next_guide(0);
|
||||
while ($i) {
|
||||
my ($x,$y,$w,$h);
|
||||
$x = $img->get_guide_position($i);
|
||||
if ($img->get_guide_orientation($i) == ORIENTATION_HORIZONTAL) {
|
||||
($x,$y,$w,$h) = (0,$x-$width,$W,1);
|
||||
} else {
|
||||
($x,$y,$w,$h) = ($x,0,1,$H);
|
||||
}
|
||||
$img->rect_select($x,$y,$w,$h,$operation,$feather,$radius);
|
||||
$operation = ADD if $operation == REPLACE;
|
||||
|
||||
$i = $img->find_next_guide($i);
|
||||
}
|
||||
|
||||
();
|
||||
};
|
||||
|
||||
exit main;
|
|
@ -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,19 +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);
|
||||
|
@ -52,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 --
|
||||
|
@ -65,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 --
|
||||
|
@ -88,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();
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ sub get_vguides {
|
|||
$i=0;
|
||||
my @vguides;
|
||||
while ($i=$img->find_next_guide($i)) {
|
||||
if ($img->get_guide_orientation($i) == &Gimp::VERTICAL){
|
||||
if ($img->get_guide_orientation($i) == ORIENTATION_VERTICAL){
|
||||
$keyval = sprintf("%4d", $img->get_guide_position($i));
|
||||
$vkeys{$keyval} = $i;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ sub get_hguides {
|
|||
$i=0;
|
||||
my @hguides;
|
||||
while ($i=$img->find_next_guide($i)) {
|
||||
if ($img->get_guide_orientation($i) == &Gimp::HORIZONTAL){
|
||||
if ($img->get_guide_orientation($i) == ORIENTATION_HORIZONTAL){
|
||||
$keyval = sprintf("%4d", $img->get_guide_position($i));
|
||||
$hkeys{$keyval} = $i;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
@ -101,10 +101,10 @@ register "seth_spin",
|
|||
$maxhigh = ($src->height > $dest->height) ? $src->height: $dest->height;
|
||||
$img = gimp_image_new($maxwide, $maxhigh, RGB);
|
||||
|
||||
|
||||
$tmpimglayer = $img->add_new_layer(0,3,1);
|
||||
$img->display_new;
|
||||
Gimp->progress_init("Seth Spin...",-1);
|
||||
|
||||
$tmpimglayer = $img->add_new_layer(0,3,1);
|
||||
|
||||
$oldbackground = gimp_palette_get_background();
|
||||
gimp_palette_set_background($color);
|
||||
$src->edit_copy();
|
||||
|
@ -130,34 +130,33 @@ 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();
|
||||
|
|
|
@ -32,27 +32,28 @@ 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. ".
|
||||
"Otherwise, it overwrites the current layer and uses a solid noise",
|
||||
"Seth Burgess",
|
||||
"Seth Burgess <sjburges\@gimp.org>",
|
||||
"1999-05-11",
|
||||
"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, "font", "Font Name"],
|
||||
[ 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]],
|
||||
],
|
||||
],
|
||||
[],
|
||||
sub {
|
||||
($img, $pattern, $solidnoise, $font, $text, $blur) = @_;
|
||||
$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);
|
||||
}
|
||||
|
@ -61,8 +62,8 @@ sub {
|
|||
# about before blindly apply a type of layer. Oh well. Call it RGBA
|
||||
# for now.
|
||||
|
||||
# FIXED: Hello, Seth.. look at this:
|
||||
|
||||
# Hello, Seth.. look at this:
|
||||
|
||||
$textlayer = $img->layer_new($img->width, $img->height, $img->layertype(1),
|
||||
"TextLayer", 100, 0);
|
||||
$img->add_layer($textlayer,1);
|
||||
|
@ -72,14 +73,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);
|
||||
|
||||
|
@ -87,12 +88,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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,23 +43,23 @@ 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(ADD_WHITE_MASK);
|
||||
$checkmask = $shadowlayer->create_mask(WHITE_MASK);
|
||||
$img->add_layer_mask($shadowlayer, $checkmask);
|
||||
plug_in_checkerboard ($img, $checkmask, 0, $blocksize);
|
||||
|
||||
$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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue