/usr/share/perl5/GD/SecurityImage/Styles.pm is in libgd-securityimage-perl 1.72-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | package GD::SecurityImage::Styles;
use strict;
use warnings;
use vars qw[$VERSION];
use constant ARC_END_DEGREES => 360;
$VERSION = '1.72';
sub style_default {
return shift->_drcommon(' \\ lines will be drawn ');
}
sub style_rect {
return shift->_drcommon;
}
sub style_box {
my $self = shift;
my $n = $self->{lines};
my $ct = $self->{_COLOR_}{text};
my $cl = $self->{_COLOR_}{lines};
my $w = $self->{width};
my $h = $self->{height};
$self->filledRectangle( 0, 0, $w , $h , $ct );
$self->filledRectangle( $n, $n, $w - $n - 1, $h - $n - 1, $cl );
return;
}
sub style_circle {
my $self = shift;
my $cx = $self->{width} / 2;
my $cy = $self->{height} / 2;
my $n = $self->{lines};
my $cl = $self->{_COLOR_}{lines};
my $max = int $self->{width} / $n;
$max++;
for my $i ( 1..$n ) {
my $mi = $max * $i;
$self->arc( $cx, $cy, $mi, $mi, 0, ARC_END_DEGREES, $cl );
}
return;
}
sub style_ellipse {
my $self = shift;
return $self->style_default if $self->{DISABLED}{ellipse}; # GD < 2.07
my $cx = $self->{width} / 2;
my $cy = $self->{height} / 2;
my $n = $self->{lines};
my $cl = $self->{_COLOR_}{lines};
my $max = int $self->{width} / $n;
$max++;
for my $i ( 1..$n ) {
my $mi = $max * $i;
$self->ellipse( $cx, $cy, $mi * 2, $mi, $cl );
}
return;
}
sub style_ec {
my($self, @args) = @_;
$self->style_ellipse(@args) if ! $self->{DISABLED}{ellipse}; # GD < 2.07
$self->style_circle(@args);
return;
}
sub style_blank {}
sub _drcommon {
my $self = shift;
my $drawx = shift || 0;
my $w = $self->{width};
my $h = $self->{height};
my $max = $self->{lines};
my $fx = $w / $max;
my $fy = $h / $max;
my $cl = $self->{_COLOR_}{lines};
my( $ifx );
for my $i ( 0..$max ) {
$ifx = $i * $fx;
$self->line( $ifx, 0, $ifx , $h, $cl ); # | line
next if not $drawx;
$self->line( $ifx, 0, $ifx + $fx, $h, $cl ); # \ line
}
my( $ify );
for my $i ( 1..$max ) {
$ify = $i * $fy;
$self->line( 0, $ify, $w, $ify, $cl ); # - line
}
return;
}
1;
__END__
=head1 NAME
GD::SecurityImage::Styles - Drawing styles for GD::SecurityImage.
=head1 SYNOPSIS
See L<GD::SecurityImage>.
=head1 DESCRIPTION
This document describes version C<1.72> of C<GD::SecurityImage::Styles>
released on C<27 August 2012>.
This module contains the styles used in the security image.
Used internally by L<GD::SecurityImage>. Nothing public here.
=head1 METHODS
=head2 style_blank
=head2 style_box
=head2 style_circle
=head2 style_default
=head2 style_ec
=head2 style_ellipse
=head2 style_rect
=head1 SEE ALSO
L<GD::SecurityImage>.
=head1 AUTHOR
Burak Gursoy <burak@cpan.org>.
=head1 COPYRIGHT
Copyright 2004 - 2012 Burak Gursoy. All rights reserved.
=head1 LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.10.1 or,
at your option, any later version of Perl 5 you may have available.
=cut
|