Commit 51e59ae5 authored by Marc Lehmann's avatar Marc Lehmann
Browse files

see plug-ins/perl/Changes

parent 4a6dbd10
Revision history for Gimp-Perl extension.
- added guidegrid, git-text, roundrectsel.
- added guidegrid, git-text, roundrectsel, repdup, centerguide,
stampify, goldenmean, triangle.
1.072 Sat Mar 27 21:04:39 CET 1999
- scripts will now be correctly installed when IN_GIMP.
......
......@@ -60,6 +60,7 @@ expects pixel coordinates and will return the tile that pixel is in:
The C<data> method returns and sets the raw pixel data.
$piddle = $tile->data; # get the tile data as a piddle
$piddle *= 0.5; # do sth. with the pixels
$tile->data($piddle); # and modify the tile
=head1 PIXELREGIONS
......@@ -98,12 +99,10 @@ functions, each one corresponding to a get-function:
$region->set_pixel($piddle,45,60); # set pixel at (45|60)
$region->set_row($piddle,45,60); # set a row
$region->set_col($piddle,45,60); # set a column
$region->set_rect($piddle,45,60,10); # a 10 pixel wide rectangle
$region->set_rect($piddle,45,60); # set a whole rectangle
Please note that (different to the C functions they call), the last
parameter (width or height) is missing, it can be calculcated from the perl
string (if you use piddles, C<set_rect> can calculcate both dimensions from the
piddle).
Please note that (unlike the C functions they call), the size arguments
(width and/or height) are missing, they can be calculated from the piddle.
=head1 AUTHOR
......
......@@ -78,4 +78,8 @@ examples/innerbevel
examples/fit-text
examples/guidegrid
examples/roundrectsel
examples/repdup
examples/centerguide
examples/stampify
examples/goldenmean
examples/triangle
......@@ -11,6 +11,7 @@ $|=1;
scratches.pl blowinout.pl terral_text xachvision.pl gimpmagick perlcc
sethspin.pl animate_cells image_tile yinyang stamps font_table
perlotine randomblends innerbevel fit-text guidegrid roundrectsel
repdup centerguide stampify goldenmean triangle
);
@shebang = (map("examples/$_",@examples),
qw(Perl-Server examples/example-net.pl examples/homepage-logo.pl
......
#!/usr/bin/perl
use Gimp qw( :auto );
use Gimp::Fu;
register "center_guide",
"Creates h- & v-guides at the center of the image.",
"Physical center = width/2 and height/2; Optical center = the Golden Mean.",
"Claes G Lindblad <claesg\@algonet.se>",
"Claes G Lindblad",
"990323",
"<Image>/Center Guide",
"*",
[
[PF_RADIO,
"center",
"center",
0,
[Physical => 0, Optical => 1]
]
],
sub {
my ($img, $layer, $center) = @_;
$w = $img->width();
$h = $img->height();
$hc = int($h/2 + 0.5);
$vc = int($w/2 + 0.5);
if ($center == 1) {
$hc = int(($h / 2.6179) + 0.5);
};
$bit_bucket = $img->add_hguide($hc);
$bit_bucket = $img->add_vguide($vc);
gimp_drawable_update($layer, 0, 0, $w, $h);
};
exit main;
#!/usr/bin/perl
use Gimp qw( :auto );
use Gimp::Fu;
sub goldenmean {
my ($short, $type) = @_;
$long = int(($short * 1.618) + 0.5);
$width = $short;
$height = $long;
if ($type == 1) {
$width = $long;
$height = $short;
}
$img = gimp_image_new($width, $height, RGB);
$layer = gimp_layer_new($img, $width, $height, RGB, "Layer 1", 100, NORMAL_MODE);
gimp_image_add_layer($layer, -1);
gimp_palette_set_background([255, 255, 255]);
$layer->gimp_edit_fill;
return $img;
}
register "Golden Mean",
"Creates a new image with a ratio according to the Golden Mean",
"Select shortest side and orientation and I will automagically calculate the long side. As a plug-in companion, see <Image>/Center Guide.",
"Claes G Lindblad <claesg\@algonet.se>",
"Claes G Lindblad <claesg\@algonet.se>",
"990328",
"<Toolbox>/Xtns/Render/Golden Mean",
"*",
[
[PF_INT32, "short", "Shortest side", 233],
[PF_RADIO, "type", "Orientation", 0, [Portrait => 0, Landscape => 1]]
],
\&goldenmean;
exit main;
#!/usr/bin/perl
use Gimp qw( :auto );
use Gimp::Fu;
#Gimp::set_trace(TRACE_ALL);
register "RepDup",
"Repeats and duplicates a selection.",
"Hopefully self-explanatory...",
"Claes G Lindblad <claesg\@algonet.se>",
"Claes G Lindblad <claesg\@algonet.se>",
"990328",
"<Image>/Edit/Repeat & Duplicate",
"*",
[
[PF_SPINNER, "repeats", "Number of repetitions",
3, [1, 1000, 1] ],
[PF_SPINNER, "xoffset", "X-offset",
50, [-1000, 1000, 1] ],
[PF_SPINNER, "yoffset", "Y-offset",
50, [-1000, 1000, 1] ],
],
sub {
my ($img, $layer, $repeats, $xoffset, $yoffset) = @_;
eval { $img->undo_push_group_start };
@b = gimp_selection_bounds($img);
my $w = $b[3] - $b[1];
my $h = $b[4] - $b[2];
gimp_edit_copy($layer);
gimp_selection_none($img);
for ($i = 0; $i < $repeats; $i++) {
$b[1] = $b[1] + $xoffset;
$b[2] = $b[2] + $yoffset;
gimp_rect_select($img, $b[1], $b[2], $w, $h, REPLACE, 0, 0);
$bit_bucket = gimp_edit_paste($layer, 0);
gimp_floating_sel_anchor($bit_bucket);
gimp_selection_none($img);
}
eval { $img->undo_push_group_end };
return $img;
};
exit main;
......@@ -15,7 +15,7 @@ register "round_rect_sel",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1999-03-25",
"<Image>/Select/Generate/Rounded Rectangluar Selection",
"<Image>/Select/Round Rectangular Selection",
"*",
[
[PF_SPINNER, "x_rounding", "How much to round in the horizontal, in pixels", 16, [1,1000,1]],
......
#!/usr/bin/perl
use Gimp qw( :auto );
use Gimp::Fu;
#Gimp::set_trace(TRACE_ALL);
register "Stampify",
"Makes an image look like a postage stamp.",
"This plug-in works from the active layer. Depending on the size of the image, perforations may look strange. Test alternatives!",
"Claes G Lindblad <claesg\@algonet.se>",
"Claes G Lindblad <claesg\@algonet.se>",
"990328",
"<Image>/Filters/Decor/Stampify",
"*",
[
[PF_COLOR, "paper", "Paper colour", [242, 242, 242]],
[PF_COLOR, "hole", "Hole colour", [0, 0, 0]],
[PF_INT32, "diameter", "Diameter of perforation", 10],
[PF_INT32, "gap", "Gap between perforations", 5],
[PF_INT32, "marg", "Marginal between art and perforations", 7]
],
sub {
my ($img, $drawable, $paper, $hole, $diameter, $gap, $marg) = @_;
$nw = int(gimp_image_width($img) + 2 * $marg + $diameter);
$nh = int(gimp_image_height($img) + 2 * $marg + $diameter);
my $img2 = gimp_image_new($nw, $nh, RGB);
my $layer1 = gimp_layer_new($img2, $nw, $nh, RGBA, "Layer 1", 100, NORMAL_MODE);
gimp_image_add_layer($img2, $layer1, 0);
gimp_image_set_active_layer($img2, $layer1);
gimp_palette_set_background($paper);
gimp_drawable_fill($layer1, 1);
# create horisontal holes
gimp_selection_none($img2);
my $nholes = int (($nw + $gap) / ($diameter + $gap) + 0.5);
$pos = 0;
for ($i = 0; $i<$nholes; $i++) {
gimp_ellipse_select($img2,
$pos, 0,
$diameter, $diameter,
ADD, 1, 0, 0);
$pos = $pos + $diameter + $gap;
}
# create vertical holes
my $nholes = int (($nh + $gap) / ($diameter + $gap) + 0.5);
$pos = 0;
for ($i = 0; $i<$nholes; $i++) {
gimp_ellipse_select($img2,
0, $pos,
$diameter, $diameter,
ADD, 1, 0, 0);
$pos = $pos + $diameter + $gap;
}
gimp_palette_set_background($hole);
gimp_edit_fill($layer1);
gimp_selection_none($img2);
# here comes the clever part! :-)
# offset horis and vert holes by half the diameter
gimp_channel_ops_offset($layer1, 1, 0, -($diameter / 2), -($diameter / 2));
# insert $img into a new layer in $img2
# gimp_selection_all($img);
gimp_edit_copy($drawable);
my $float = gimp_edit_paste($layer1, 0);
gimp_floating_sel_anchor($float);
# and return command to The Gimp.
return $img2;
};
exit main;
#!/usr/bin/perl
use Gimp qw( :auto );
use Gimp::Fu;
register "Triangle",
"Creates a triangular selection with the diagonal as one of its sides.",
"Tick appropriate radio buttons.",
"Claes G Lindblad <claesg\@algonet.se>",
"Claes G Lindblad <claesg\@algonet.se>",
"990328",
"<Image>/Select/Triangle",
"*",
[
[PF_RADIO, "type", "Select position", 0,
[Upper_left => 0, Lower_left => 1, Upper_right => 2, Lower_right => 3]
],
[PF_RADIO, "mode", "Selection mode", 2,
[Add => 0, Subtract => 1, Replace => 2, Intersect => 3]
]
],
sub {
my ($img, $layer, $type, $mode) = @_;
$w = $img->width();
$h = $img->height();
if ($type == 0) {
@lista= [0, 0, $w, 0, 0, $h, 0, 0];
};
if ($type == 1) {
@lista= [0, 0, 0, $h, $w, $h, 0, 0];
};
if ($type == 2) {
@lista= [0, 0, $w, 0, $w, $h, 0, 0];
};
if ($type == 3) {
@lista= [$w, 0, $w, $h, 0, $h, $w, 0];
};
$img->free_select(8, @lista, $mode, 0, 0, 0);
};
exit main;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment