/usr/share/perl5/GD/Graph/points.pm is in libgd-graph-perl 1.48-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 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | #==========================================================================
# Copyright (c) 1995-1998 Martien Verbruggen
#--------------------------------------------------------------------------
#
# Name:
# GD::Graph::points.pm
#
# $Id: points.pm,v 1.13 2005/12/14 04:13:32 ben Exp $
#
#==========================================================================
package GD::Graph::points;
($GD::Graph::points::VERSION) = '$Revision: 1.13 $' =~ /\s([\d.]+)/;
use strict;
use GD::Graph::axestype;
use GD::Graph::utils qw(:all);
@GD::Graph::points::ISA = qw( GD::Graph::axestype );
# PRIVATE
sub draw_data_set
{
my $self = shift;
my $ds = shift;
my @values = $self->{_data}->y_values($ds) or
return $self->_set_error("Impossible illegal data set: $ds",
$self->{_data}->error);
# Pick a colour
my $dsci = $self->set_clr($self->pick_data_clr($ds));
my $type = $self->pick_marker($ds);
for (my $i = 0; $i < @values; $i++)
{
next unless defined $values[$i];
my ($xp, $yp);
if (defined($self->{x_min_value}) && defined($self->{x_max_value}))
{
($xp, $yp) = $self->val_to_pixel(
$self->{_data}->get_x($i), $values[$i], $ds);
}
else
{
($xp, $yp) = $self->val_to_pixel($i+1, $values[$i], $ds);
}
$self->marker($xp, $yp, $type, $dsci );
$self->{_hotspots}->[$ds]->[$i] =
['rect', $self->marker_coordinates($xp, $yp)];
}
return $ds;
}
# Pick a marker type
sub pick_marker # number
{
my $self = shift;
my $num = shift;
ref $self->{markers} ?
$self->{markers}[ $num % (1 + $#{$self->{markers}}) - 1 ] :
($num % 8) || 8;
}
# Draw a marker
sub marker_coordinates
{
my $self = shift;
my ($xp, $yp) = @_;
return (
$xp - $self->{marker_size},
$xp + $self->{marker_size},
$yp + $self->{marker_size},
$yp - $self->{marker_size},
);
}
sub marker # $xp, $yp, $type, $colourindex
{
my $self = shift;
my ($xp, $yp, $mtype, $mclr) = @_;
return unless defined $mclr;
my ($l, $r, $b, $t) = $self->marker_coordinates($xp, $yp);
MARKER: {
($mtype == 1) && do
{ # Square, filled
$self->{graph}->filledRectangle($l, $t, $r, $b, $mclr);
last MARKER;
};
($mtype == 2) && do
{ # Square, open
$self->{graph}->rectangle($l, $t, $r, $b, $mclr);
last MARKER;
};
($mtype == 3) && do
{ # Cross, horizontal
$self->{graph}->line($l, $yp, $r, $yp, $mclr);
$self->{graph}->line($xp, $t, $xp, $b, $mclr);
last MARKER;
};
($mtype == 4) && do
{ # Cross, diagonal
$self->{graph}->line($l, $b, $r, $t, $mclr);
$self->{graph}->line($l, $t, $r, $b, $mclr);
last MARKER;
};
($mtype == 5) && do
{ # Diamond, filled
$self->{graph}->line($l, $yp, $xp, $t, $mclr);
$self->{graph}->line($xp, $t, $r, $yp, $mclr);
$self->{graph}->line($r, $yp, $xp, $b, $mclr);
$self->{graph}->line($xp, $b, $l, $yp, $mclr);
$self->{graph}->fillToBorder($xp, $yp, $mclr, $mclr);
last MARKER;
};
($mtype == 6) && do
{ # Diamond, open
$self->{graph}->line($l, $yp, $xp, $t, $mclr);
$self->{graph}->line($xp, $t, $r, $yp, $mclr);
$self->{graph}->line($r, $yp, $xp, $b, $mclr);
$self->{graph}->line($xp, $b, $l, $yp, $mclr);
last MARKER;
};
($mtype == 7) && do
{ # Circle, filled
$self->{graph}->arc($xp, $yp, 2 * $self->{marker_size},
2 * $self->{marker_size}, 0, 360, $mclr);
$self->{graph}->fillToBorder($xp, $yp, $mclr, $mclr);
last MARKER;
};
($mtype == 8) && do
{ # Circle, open
$self->{graph}->arc($xp, $yp, 2 * $self->{marker_size},
2 * $self->{marker_size}, 0, 360, $mclr);
last MARKER;
};
($mtype == 9) && do
{ # Horizontal line
$self->{graph}->line($l, $yp, $r, $yp, $mclr);
last MARKER;
};
($mtype == 10) && do
{ # vertical line
$self->{graph}->line($xp, $t, $xp, $b, $mclr);
last MARKER;
};
}
}
sub draw_legend_marker
{
my $self = shift;
my $n = shift;
my $x = shift;
my $y = shift;
my $ci = $self->set_clr($self->pick_data_clr($n));
my $old_ms = $self->{marker_size};
my $ms = _min($self->{legend_marker_height}, $self->{legend_marker_width});
($self->{marker_size} > $ms/2) and $self->{marker_size} = $ms/2;
$x += int($self->{legend_marker_width}/2);
$y += int($self->{lg_el_height}/2);
$n = $self->pick_marker($n);
$self->marker($x, $y, $n, $ci);
$self->{marker_size} = $old_ms;
}
"Just another true value";
|