Calendar-Plugin-Renderer
view release on metacpan or search on metacpan
lib/Calendar/Plugin/Renderer/SVG.pm view on Meta::CPAN
-svg_version => '1.1',
-pubid => '-//W3C//DTD SVG 1.1//EN',
-sysid => 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
my $calendar = $svg->group(id => 'calendar', label => "Calendar");
my $month_label = $self->month_label;
$calendar->text('id' => "month",
'fill' => 'blue',
'x' => $month_label->x,
'y' => $month_label->y,
'style' => $month_label->style)->cdata($month_label->text);
my $year_label = $self->year_label;
$calendar->text('id' => "year",
'fill' => 'blue',
'x' => $year_label->x,
'y' => $year_label->y,
'style' => $year_label->style)->cdata($year_label->text);
my $boundary_box = $self->boundary_box;
$calendar->rect('id' => 'bounding_box',
'height' => $boundary_box->height - $self->adjust_height,
'width' => $boundary_box->width - 14,
'x' => $boundary_box->x + 7 + 7,
'y' => $boundary_box->y,
'style' => 'fill:none; stroke: blue; stroke-width: 0.5;');
my $wdays = $self->wdays;
lib/Calendar/Plugin/Renderer/SVG.pm view on Meta::CPAN
'height' => $wdays->[$_]->height,
'width' => $wdays->[$_]->width);
$day->text('id' => "text_row0_col$_",
'x' => $wdays->[$_]->text->x,
'y' => $wdays->[$_]->text->y,
'length' => $wdays->[$_]->text->length,
'adjust' => $wdays->[$_]->text->adjust,
'font-size' => $wdays->[$_]->text->font_size,
'text-anchor' => 'middle',
'stroke' => 'red')
->cdata($wdays->[$_]->text->value);
}
my $row = $self->_row;
my $days_box = $self->days_box;
foreach my $r (1..$row) {
foreach my $c (0..6) {
my $g_id = sprintf("row%d_col%d" , $r, $c);
my $r_id = sprintf("box_row%d_col%d" , $r, $c);
my $t_id = sprintf("text_row%d_col%d", $r, $c);
next unless defined $days_box->[$r]->[$c];
lib/Calendar/Plugin/Renderer/SVG.pm view on Meta::CPAN
$d->text('id' => "$t_id",
'x' => $days_box->[$r]->[$c]->text->x + 1,
'y' => $days_box->[$r]->[$c]->text->y + 5,
'length' => $days_box->[$r]->[$c]->text->length,
'adjust' => 'spacing',
'font-size' => $days_box->[$r]->[$c]->text->font_size,
'stroke' => 'green',
'text-anchor' => 'right',
'fill' => 'silver',
'fill-opacity' => '50%')
->cdata($text);
}
}
return $svg->to_xml;
}
=head1 AUTHOR
Mohammad S Anwar, C<< <mohammad.anwar at yahoo.com> >>
( run in 0.367 second using v1.01-cache-2.11-cpan-454fe037f31 )