File: triangle

package info (click to toggle)
libgimp-perl 2.0.dfsg-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,112 kB
  • ctags: 462
  • sloc: perl: 10,026; sh: 207; ansic: 207; makefile: 70
file content (52 lines) | stat: -rwxr-xr-x 1,190 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/opt/bin/perl

eval 'exec /opt/bin/perl  -S $0 ${1+"$@"}'
    if 0; # not running under some shell

use Gimp qw(:auto __ N_);
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",
		N_"<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;

=head1 LICENSE

Copyright Claes G. Lindblad.
Distrubuted under the terms of the GNU Public License, v2 or higher.

=cut