Documentation | InterfaceKit | Region
SYNOPSIS
Perl
use HaikuR1::Region; my $region = HaikuR1::Alignment->new($rect); $region->SetTo($rect2);
Python
from HaikuR1.InterfaceKit import Region region = Alignment(rect) region.SetTo(rect2)
DESCRIPTION
Exposes the BRegion
object.
A Region is a set of rectangles. Although its interface works with both Rects (which contain floating point numbers) and clipping_rects (which contain integers), internally it stores the rectangles as clipping_rects.
For more information on Region, see the Be Book class description, the Be Book overview, and the Haiku Book class description.
METHODS
Constructor
Creates a Region.
Perl
HaikuR1::Region->new($rect); HaikuR1::Region->new($copy_from); HaikuR1::Region->new();
Python
Region(rect) Region(copy_from) Region()
rect
A Rect to use as the initial content of the Region.
copy_from
A Region to copy.
copy
Copies the contents of another object into this object.
Perl
$region->copy($copy_from);
Python
region.copy(copy_from)
copy_from
A Region to copy.
Contains
Returns true if the given Point or coordinate pair lies within the Region.
Perl
$region->Contains($point); $region->Contains($x, $y);
Python
region.Contains(point) region.Contains(x, y)
point
A Point to check.
x, y
Integers, a coordinate pair to check.
Exclude
Removes the given rectangle or region from this Region.
Perl
$region->Exclude($rect); $region->Exclude($region);
Python
region.Exclude(rect) region.Exclude(region)
rect
A Rect or clipping_rect to remove.
region
A Region to remove.
ExclusiveInclude
Removes all parts of the Region that are in common with the given Region.
Perl
$region->ExclusiveInclude($region);
Python
region.ExclusiveInclude(region)
region
A Region to exlude.
Frame
FrameInt
Returns the smallest rectangle that completely includes the Region. Frame
returns it as a Rect, FrameInt
returns it as a clipping_rect.
Perl
$region->Frame(); $region->FrameInt();
Python
region.Frame() region.FrameInt()
Include
Adds the given rectangle or region to this Region.
Perl
$region->Include($rect); $region->Include($region);
Python
region.Include(rect) region.Include(region)
rect
A Rect or clipping_rect to add.
region
A Region to add.
Intersects
Returns true if the Region intersects with the given rectangle.
Perl
$region->Intersects($rect);
Python
region.Intersects(rect)
rect
A Rect or clipping_rect to check.
IntersectWith
Returns the parts of the Region that are in common with the given Region.
Perl
$region->IntersectWith($region);
Python
region.IntersectWith(region)
region
A Region to intersect.
MakeEmpty
Clears the Region so it contains no rectangles.
Perl
$region->MakeEmpty();
Python
region.MakeEmpty()
OffsetBy
Moves the Region by the given Point or coordinate pair.
Perl
$region->OffsetBy($point); $region->OffsetBy($x, $y);
Python
region.OffsetBy(point) region.OffsetBy(x, y)
point
A Point to offset by.
x, y
Integers, a coordinate pair to offset by.
PrintToStream
Prints the contents to standard out as data[i] = BRect(left, top, right,
bottom)
; one such line is printed for each Rect in the Region's list of
Rects, and the Rect's values are constrained to integers.
Perl
$region->PrintToStream();
Python
region.PrintToStream()
Rectangles
CountRects
RectAt
RectAtInt
CountRects
returns the number of rectangles in the Region's list of
rectangles. RectAt
returns the rectagnle at the given index as a Rect,
while RectAtInt
returns it as a clipping_rect.
Perl
$region->RectAt($index); $region->RectAtInt($index);
Python
region.RectAt(index) region.RectAtInt(index)
index
An integer, the index of the desired rectangle.
ScaleBy
Scales the Region by the given Size or pair of scaling factors.
Perl
$region->ScaleBy($scale); $region->ScaleBy($x, $y);
Python
region.ScaleBy(scale) region.ScaleBy(x, y)
scale
A Size, the scaling factors.
x, y
Integer scaling factors.
Set
Sets the contents of the Region.
Perl
$region->Set($rect);
Python
region.Set(rect)
rect
A Rect or clipping_rect, the new contents of the Region.
OPERATORS
==
Returns true if the Region objects refer to the same region.
!=
Returns true if the Region objects do not refer to the same region.