File: centerguide

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 (50 lines) | stat: -rwxr-xr-x 1,120 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
#!/opt/bin/perl

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

# 7/15/03 <sjburges@gimp.org>
# Changed spot that its registered from <Image>/Guides to <Image>/Image/Guides
# to reduce horizontal clutter on menubar

use Gimp qw(:auto __ N_);
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",
		N_"<Image>/Image/Guides/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;
=head1 LICENSE

Copyright Claes G Lindblad.
Distrubuted under the terms of the GNU Public License. 

=cut