package ONO::Lib::PDF::Elements::EduLine;
################################################################################
# COPYRIGHT / LICENSE #
################################################################################
#
# This file is part of the ONO Software Project.
#
# Copyright (C) 2000-2025 Jos KIRPS [ www.kirps.com | jos_AT_kirps_DOT_com ]
# and The Joopita Project [ www.joopita.org | contact_AT_joopita_DOT_com ]
#
# This file, as well as other parts of the ONO Software Project or related
# elements, are FREE SOFTWARE available under the ARTISTIC LICENSE 2.0.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# For the full license, see /ono/osr/license/LICENSE.txt, or write to
# jos_AT_kirps_DOT_com or contact_AT_joopita_DOT_com.
#
################################################################################
# END OF COPYRIGHT / LICENSE, HERE COMES THE CODE ... #
################################################################################
use strict;
use ONO::Lib::PDF::Draw;
use ONO::Lib::Image::Canvas::Draw;
#: This module generates specific PDF content.
sub eduline {
my (
$self,
$canvas,
$x1,
$y1,
$x2,
$height,
$weight,
$color,
$color_main,
) = @_;
#: This generates an writing line optimized for K12 education.
eval "use PDF::Reuse";
if (!$@) {
if (!$height) {
$height = 10;
}
if (!$weight) {
$weight = 0.2;
}
if ($color eq "" && $color_main eq "") {
$color = "0:150:150:150";
$color_main = "0:100:150:200";
}
if ($color ne "" && $color_main eq "") {
$color_main = $color;
}
ONO::Lib::PDF::Draw->rect($canvas,$x1,$y1, $x2,$y1+$height, $weight, $color);
ONO::Lib::PDF::Draw->line($canvas,$x1,$y1+$height/3, $x2,$y1+$height/3, $weight, $color);
ONO::Lib::PDF::Draw->line($canvas,$x1,$y1+$height/3*2, $x2,$y1+$height/3*2, $weight*5, $color_main);
}
}
###############################################################################
# end of script
###############################################################################
1;
__END__