NAME
Tickit::Rect
- a lightweight data structure representing a rectangle
SYNOPSIS
use Tickit::Rect;
my $rect = Tickit::Rect->new(
top => 0, left => 5, lines => 3, cols => 10
);
DESCRIPTION
Objects in this class represent a rectangle, by storing the top left corner coordinate and the size in lines and columns. This data structure is purely abstract and not tied to a particular window or coordinate system. It exists simply as a convenient data store containing some useful utility methods.
CONSTRUCTORS
$rect = Tickit::Rect->new( %args )
Construct a new rectangle of the given geometry, given by top
, left
and either lines
and cols
, or bottom
and right
.
$rect = $existing_rect->intersect( $other_rect )
If there is an intersection between the given rectangles, return it. If not, return undef
.
$rect = $existing_rect->translate( $rightward, $downward )
Returns a new rectangle of the same size as the given one, moved right and down by the given argmuents (which may be negative)
ACCESSORS
$top = $rect->top
$left = $rect->left
$bottom = $rect->bottom
$right = $rect->right
Return the edge boundaries of the rectangle.
$lines = $rect->lines
$cols = $rect->cols
Return the size of the rectangle.
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>