package Pastel
::Geometry
::Rectangle
;
@ISA = qw
(Pastel
::Mixin
::Mixin Pastel
::Shape
);
use constant OUT_BOTTOM
=> 8;
use constant OUT_LEFT
=> 1;
use constant OUT_RIGHT
=> 4;
use constant OUT_TOP
=> 2;
bless $self, ref($class) || $class;
my ($x, $y, $width, $height)=
$self->_rearrange(["X", "Y", "WIDTH", "HEIGHT"], @args);
$self->{x
} = defined($x) ?
$x : 0;
$self->{y
} = defined($y) ?
$y : 0;
$self->{w
} = defined($width) ?
$width : 0;
$self->{h
} = defined($height)?
$height : 0;
return ref($self)." Location:[".$self->{x
}.",".$self->{y
}."] Width:".$self->{w
}." Height:".$self->{h
};
my $style = $self->get_style($graphics);
my $data = "<rect x=\"".$self->get_x()."\" y=\"".$self->get_y()."\" width=\"".$self->get_width()."\" height=\"".$self->get_height()."\" style=\"".$style."\" \/>";
return ($self->get_width() <= 0) || ($self->get_height() <= 0);
#If argument is a Pastel::Geometry::Rectangle
if ($args[0]->isa("Pastel::Geometry::Rectangle") ){
$self->set_x($args[0]->get_x());
$self->set_y($args[0]->get_y());
$self->set_width($args[0]->get_width());
$self->set_height($args[0]->get_height());
$self->set_width($args[2]);
$self->set_height($args[3]);
if($self->get_width() <= 0){
$out |= $self->OUT_LEFT | $self->OUT_RIGHT;
}elsif ( $x < $self->{x
}){
}elsif ( $x > ($self->{x
} + $self->{w
})){
$out |= $self->OUT_RIGHT;
if($self->get_height() <=0 ){
$out |= $self->OUT_TOP | $self->OUT_BOTTOM;
} elsif ($y < $self->{y
}){
} elsif ($y > ( $self->{y
} + $self->{h
})){
$out |= $self->OUT_BOTTOM;
# print "Inside outcode\n";