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.
|
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
|
1.1 Fri Jul 30 07:37:30 CEST 1999
|
||||||
- one of the most successful releases, in terms of features & bugfixes.
|
- one of the most successful releases, in terms of features & bugfixes.
|
||||||
- it was also a long night. And expensive (irc).
|
- it was also a long night. And expensive (irc).
|
||||||
|
|
|
@ -791,16 +791,24 @@ Gimp::on_query {
|
||||||
die "menupath _must_ start with <Image>, <Toolbox>, <Load>, <Save> or <None>!";
|
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,
|
unshift(@$params,
|
||||||
[&Gimp::PARAM_INT32,"run_mode","Interactive, [non-interactive]"]);
|
[&Gimp::PARAM_INT32,"run_mode","Interactive, [non-interactive]"]);
|
||||||
Gimp->gimp_install_procedure($function,$blurb,$help,$author,$copyright,$date,
|
Gimp->gimp_install_procedure($function,$blurb,$help,$author,$copyright,$date,
|
||||||
$menupath,$imagetypes,$type,
|
$menupath,$imagetypes,$type,
|
||||||
[map {
|
[map {
|
||||||
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_TOGGLE;
|
$_->[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_FONT;
|
||||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_BRUSH;
|
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_BRUSH;
|
||||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_PATTERN;
|
$_->[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_CUSTOM;
|
||||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_FILE;
|
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_FILE;
|
||||||
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_TEXT;
|
$_->[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],
|
} @$params],
|
||||||
$results);
|
$results);
|
||||||
|
|
|
@ -108,3 +108,7 @@ examples/frame_filter
|
||||||
examples/gouge
|
examples/gouge
|
||||||
examples/logulator
|
examples/logulator
|
||||||
examples/miff
|
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
|
perlotine randomblends innerbevel fit-text guidegrid roundrectsel
|
||||||
repdup centerguide stampify goldenmean triangle billboard mirrorsplit
|
repdup centerguide stampify goldenmean triangle billboard mirrorsplit
|
||||||
oneliners randomart1 pixelmap glowing_steel frame_reshuffle frame_filter
|
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),
|
@shebang = (map("examples/$_",@examples),
|
||||||
qw(Perl-Server examples/example-net.pl examples/homepage-logo.pl
|
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
|
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
|
script-fu 4.9 vs. 3.3
|
||||||
|
|
||||||
bugs
|
bugs
|
||||||
|
@ -39,7 +42,8 @@ bugs
|
||||||
|
|
||||||
important issues
|
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)
|
* migrate BOOT: into INIT() (forgot why but important for B)
|
||||||
* gimp_progress_done, gimp_progress_close
|
* gimp_progress_done, gimp_progress_close
|
||||||
* maybe implement --enable-perl=runtime-only?
|
* maybe implement --enable-perl=runtime-only?
|
||||||
|
|
|
@ -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
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
|
||||||
|
if 0; # not running under some shell
|
||||||
# <sjburges@gimp.org>
|
# <sjburges@gimp.org>
|
||||||
# This is adrian and xachs idea - take a rectangluar selection, and select
|
# This is adrian and xachs idea - take a rectangluar selection, and select
|
||||||
# font type and string. Then fill it with whatever size is needed.
|
# 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;
|
||||||
use Gimp::Fu;
|
use Gimp::Fu;
|
||||||
use Gimp::Util;
|
use Gimp::Util;
|
||||||
|
@ -11,12 +21,17 @@ use Gimp::Util;
|
||||||
|
|
||||||
$defaultfont = "-*-blippo-heavy-r-normal-*-*-360-*-*-p-*-iso8859-1";
|
$defaultfont = "-*-blippo-heavy-r-normal-*-*-360-*-*-p-*-iso8859-1";
|
||||||
undef $defaultfont;
|
undef $defaultfont;
|
||||||
|
$calls = 0;
|
||||||
|
|
||||||
sub growfont {
|
sub growfont {
|
||||||
($fontname, $plussize) = @_;
|
($fontname, $plussize) = @_;
|
||||||
@fontdesc = split /-/, $fontname;
|
@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;
|
$outname = join "-", @fontdesc;
|
||||||
|
print ("!!!${fontdesc[8]}-${fondesc[9]}!!!\n");
|
||||||
|
$calls ++;
|
||||||
return $outname;
|
return $outname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +54,7 @@ register "fit_text",
|
||||||
$height = $y2-$y1;
|
$height = $y2-$y1;
|
||||||
|
|
||||||
@extents=gimp_text_get_extents_fontname($string,xlfd_size($xlfd),$xlfd);
|
@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 ) {
|
if ($growsize > 0 ) {
|
||||||
while ($extents[0]<$width && $extents[1]<$height) {
|
while ($extents[0]<$width && $extents[1]<$height) {
|
||||||
$xlfd = growfont($xlfd,$growsize);
|
$xlfd = growfont($xlfd,$growsize);
|
||||||
|
@ -55,15 +70,11 @@ register "fit_text",
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($extents[0]<$width && $extents[1]<$height) {
|
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);
|
@extents=gimp_text_get_extents_fontname($string,xlfd_size($xlfd),$xlfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($extents[0]>$width || $extents[1]>$height) {
|
$xlfd = growfont($xlfd, -144);
|
||||||
$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);
|
$tmplay = $layer->text_fontname($x1,$y1,$string,0,1,xlfd_size($xlfd), $xlfd);
|
||||||
$width2=$tmplay->width;
|
$width2=$tmplay->width;
|
||||||
|
@ -73,15 +84,31 @@ register "fit_text",
|
||||||
# print "$width2, $height2:$width, $height\n";
|
# print "$width2, $height2:$width, $height\n";
|
||||||
while ($width2<$width && $height2<$height) {
|
while ($width2<$width && $height2<$height) {
|
||||||
$tmplay->remove;
|
$tmplay->remove;
|
||||||
$xlfd = growfont($xlfd,4);
|
$xlfd = growfont($xlfd,288);
|
||||||
$tmplay=$layer->text_fontname($x1,$y1,$string,0,1,xlfd_size($xlfd), $xlfd);
|
$tmplay=$layer->text_fontname($x1,$y1,$string,0,1,xlfd_size($xlfd), $xlfd);
|
||||||
$width2=$tmplay->width;
|
$width2=$tmplay->width;
|
||||||
$height2=$tmplay->height;
|
$height2=$tmplay->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while ($width2>$width || $height2>$height) {
|
||||||
$tmplay->remove;
|
$tmplay->remove;
|
||||||
$xlfd = growfont($xlfd,-2);
|
$xlfd = growfont($xlfd,-72);
|
||||||
$tmplay=$layer->text_fontname($x1,$y1,$string,0,1,xlfd_size($xlfd), $xlfd);
|
$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();
|
return();
|
||||||
};
|
};
|
||||||
exit main;
|
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
|
#!/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;
|
||||||
use Gimp::Fu;
|
use Gimp::Fu;
|
||||||
use Gimp::Util;
|
use Gimp::Util;
|
||||||
|
@ -15,31 +24,61 @@ register "guide_grid",
|
||||||
"Seth Burgess",
|
"Seth Burgess",
|
||||||
"Seth Burgess <sjburges\@gimp.org>",
|
"Seth Burgess <sjburges\@gimp.org>",
|
||||||
"1999-03-20",
|
"1999-03-20",
|
||||||
"<Image>/GuideGrid",
|
"<Image>/Guides/Guide Grid",
|
||||||
"*",
|
"*",
|
||||||
[
|
[
|
||||||
[PF_SPINNER, "x_spacing", "How far to space grid horizontally", 24, [1,1000,1]],
|
[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, "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, "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_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'],
|
['gimp-1.1'],
|
||||||
sub {
|
sub {
|
||||||
my($img,$layer,$xspace, $yspace, $xoffset, $yoffset) =@_;
|
my($img,$layer,$xspace, $yspace, $xoffset, $yoffset, $remove_old_guides) =@_;
|
||||||
|
|
||||||
|
#
|
||||||
|
# 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Add vertical guides to the image
|
||||||
|
#
|
||||||
for ($i=$xoffset; $i<$img->width; $i+=$xspace) {
|
for ($i=$xoffset; $i<$img->width; $i+=$xspace) {
|
||||||
if ($i) {
|
if ($i) {
|
||||||
$img->add_vguide($i);
|
$img->add_vguide($i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Add horizontal guides to the image
|
||||||
|
#
|
||||||
for ($i=$yoffset; $i<$img->height; $i+=$yspace) {
|
for ($i=$yoffset; $i<$img->height; $i+=$yspace) {
|
||||||
if ($i) {
|
if ($i) {
|
||||||
$img->add_hguide($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();
|
return();
|
||||||
};
|
};
|
||||||
exit main;
|
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;
|
|
@ -39,6 +39,9 @@ register $regname, $shortdesc, $longdesc, $authorname, $author, $date, $path, $i
|
||||||
[PF_SLIDER, "shinyness", "How shiny the final image will be",30, [0,90,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_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_RADIO, "map", "The type of Map to use", 2, [Linear => 0, Spherical => 1, Sinusoidal => 2] ],
|
||||||
|
],[],
|
||||||
|
[
|
||||||
|
'gimp-1.1',
|
||||||
], sub {
|
], sub {
|
||||||
|
|
||||||
my ($font, $text, $color1, $color2, $azimuth, $elevation, $depth, $maptype) = @_;
|
my ($font, $text, $color1, $color2, $azimuth, $elevation, $depth, $maptype) = @_;
|
||||||
|
|
|
@ -28,7 +28,7 @@ sub get_vguides {
|
||||||
$i=0;
|
$i=0;
|
||||||
my @vguides;
|
my @vguides;
|
||||||
while ($i=$img->find_next_guide($i)) {
|
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));
|
$keyval = sprintf("%4d", $img->get_guide_position($i));
|
||||||
$vkeys{$keyval} = $i;
|
$vkeys{$keyval} = $i;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ sub get_hguides {
|
||||||
$i=0;
|
$i=0;
|
||||||
my @hguides;
|
my @hguides;
|
||||||
while ($i=$img->find_next_guide($i)) {
|
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));
|
$keyval = sprintf("%4d", $img->get_guide_position($i));
|
||||||
$hkeys{$keyval} = $i;
|
$hkeys{$keyval} = $i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,10 +101,10 @@ register "seth_spin",
|
||||||
$maxhigh = ($src->height > $dest->height) ? $src->height: $dest->height;
|
$maxhigh = ($src->height > $dest->height) ? $src->height: $dest->height;
|
||||||
$img = gimp_image_new($maxwide, $maxhigh, RGB);
|
$img = gimp_image_new($maxwide, $maxhigh, RGB);
|
||||||
|
|
||||||
Gimp->progress_init("Seth Spin...",-1);
|
|
||||||
|
|
||||||
$tmpimglayer = $img->add_new_layer(0,3,1);
|
$tmpimglayer = $img->add_new_layer(0,3,1);
|
||||||
|
$img->display_new;
|
||||||
|
Gimp->progress_init("Seth Spin...",-1);
|
||||||
$oldbackground = gimp_palette_get_background();
|
$oldbackground = gimp_palette_get_background();
|
||||||
gimp_palette_set_background($color);
|
gimp_palette_set_background($color);
|
||||||
$src->edit_copy();
|
$src->edit_copy();
|
||||||
|
@ -154,7 +154,6 @@ register "seth_spin",
|
||||||
}
|
}
|
||||||
else { $all_layers[0]->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
|
# indexed conversion wants a display for some reason
|
||||||
if ($indexed) { $img->convert_indexed(1,255); }
|
if ($indexed) { $img->convert_indexed(1,255); }
|
||||||
|
|
|
@ -39,15 +39,16 @@ register
|
||||||
"Otherwise, it overwrites the current layer and uses a solid noise",
|
"Otherwise, it overwrites the current layer and uses a solid noise",
|
||||||
"Seth Burgess",
|
"Seth Burgess",
|
||||||
"Seth Burgess <sjburges\@gimp.org>",
|
"Seth Burgess <sjburges\@gimp.org>",
|
||||||
"1999-05-11",
|
"1999-03-15",
|
||||||
"<Image>/Filters/Render/Terral Text",
|
"<Image>/Filters/Render/Terral Text",
|
||||||
"RGB*,GRAY*",
|
"RGB*,GRAY*",
|
||||||
[
|
[
|
||||||
[ PF_RADIO, "solid_noise", "The Texture Type", 0, ["solid noise" => 1, "current picture" => 0]],
|
[ 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_STRING, "text", "Enter your Text to be Terral-ified", "TerralText"],
|
||||||
[ PF_SLIDER, "blur_amount", "Blur Amount", 10, [0,26,1]],
|
[ PF_SLIDER, "blur_amount", "Blur Amount", 10, [0,26,1]],
|
||||||
],
|
],
|
||||||
|
[],
|
||||||
sub {
|
sub {
|
||||||
($img, $pattern, $solidnoise, $font, $text, $blur) = @_;
|
($img, $pattern, $solidnoise, $font, $text, $blur) = @_;
|
||||||
$oldbg = gimp_palette_get_background();
|
$oldbg = gimp_palette_get_background();
|
||||||
|
@ -61,7 +62,7 @@ sub {
|
||||||
# about before blindly apply a type of layer. Oh well. Call it RGBA
|
# about before blindly apply a type of layer. Oh well. Call it RGBA
|
||||||
# for now.
|
# 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 = $img->layer_new($img->width, $img->height, $img->layertype(1),
|
||||||
"TextLayer", 100, 0);
|
"TextLayer", 100, 0);
|
||||||
|
|
|
@ -52,7 +52,7 @@ register "xach_shadows",
|
||||||
$drawable->plug_in_pixelize($blocksize);
|
$drawable->plug_in_pixelize($blocksize);
|
||||||
$shadowlayer = $drawable->layer_copy(0);
|
$shadowlayer = $drawable->layer_copy(0);
|
||||||
$img->add_layer($shadowlayer,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);
|
$img->add_layer_mask($shadowlayer, $checkmask);
|
||||||
plug_in_checkerboard ($img, $checkmask, 0, $blocksize);
|
plug_in_checkerboard ($img, $checkmask, 0, $blocksize);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue