# Perl interface for the Geometry objects. The function get_bounds()
# Called by all the Geometry objects. Parameters passed are the
my ( $self, @args ) = @_;
my ( $max_x, $max_y, $min_x, $min_y ); # Hold the maximum and
# the minimum coordinates
for ( my $i = 0 ; $i < @args ; $i += 2 ) { #Pick even number X values
if ( $args[$i] > $max_x ) {
elsif ( $args[$i] < $min_x ) {
for ( my $i = 1 ; $i < @args ; $i += 2 ) { #Pick odd number Y values
if ( $args[$i] > $max_y ) {
elsif ( $args[$i] < $min_y ) {
my $bb = Pastel
::Geometry
::Rectangle
->new(
$self->{stroke_color
} = $_[0];
if ( $self->{stroke_color
} ) {
return $self->{stroke_color
};
$self->{stroke
} = $stroke;
# First check whether fill is set
# "Fill" is set by the fill method of Pastel::Graphics
if ( defined( $self->{fill
} ) ) {
my $fill = $self->{fill
};
#If fill is a "color" object
if ( $fill->isa("Pastel::Color") ) {
# $string .= "fill:".$self->get_fill()->to_hex().';';
# $string .= "fill-opacity:".$self->get_fill()->get_alpha().';';
$string .= $self->get_fill()->to_svg_fill() . ';';
#If fill is a Gradient object
if ( $fill->isa("Pastel::GradientI") ) {
$string .= "fill:url(" . $self->get_fill()->get_ref() . ");";
$graphics->add_to_defs($fill);
if ( $self->get_fill_rule() ) {
$string .= "fill-rule:" . $self->get_fill_rule() . ';';
if ( $graphics->get_stroke() ) {
if ( $self->get_stroke_color() ) {
$paint = $self->get_stroke_color();
$paint = $graphics->get_paint();
if ( $paint->isa("Pastel::Color") ) {
$string .= $paint->to_svg();
if ( $paint->isa("Pastel::GradientI") ) {
$string .= "stroke:url(" . $paint->get_ref() . ');';
$graphics->add_to_defs($paint);
my $stroke = $graphics->get_stroke();
$string .= $stroke->to_svg();
$self->{fill_rule
} = $rule;
if ( $self->{fill_rule
} ) {
return $self->{fill_rule
};