Haiku API Bindings
Region
Not logged in

Documentation | InterfaceKit | Region

SYNOPSIS

Perl

Python

use HaikuR1::Region;

my $region = HaikuR1::Alignment->new($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

Python

HaikuR1::Region->new($rect);
HaikuR1::Region->new($copy_from);
HaikuR1::Region->new();

copy

Copies the contents of another object into this object.

Perl

Python

$region->copy($copy_from);

Contains

Returns true if the given Point or coordinate pair lies within the Region.

Perl

Python

$region->Contains($point);
$region->Contains($x, $y);

Exclude

Removes the given rectangle or region from this Region.

Perl

Python

$region->Exclude($rect);
$region->Exclude($region);

ExclusiveInclude

Removes all parts of the Region that are in common with the given Region.

Perl

Python

$region->ExclusiveInclude($region);

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

Python

$region->Frame();
$region->FrameInt();

Include

Adds the given rectangle or region to this Region.

Perl

Python

$region->Include($rect);
$region->Include($region);

Intersects

Returns true if the Region intersects with the given rectangle.

Perl

Python

$region->Intersects($rect);

IntersectWith

Returns the parts of the Region that are in common with the given Region.

Perl

Python

$region->IntersectWith($region);

MakeEmpty

Clears the Region so it contains no rectangles.

Perl

Python

$region->MakeEmpty();

OffsetBy

Moves the Region by the given Point or coordinate pair.

Perl

Python

$region->OffsetBy($point);
$region->OffsetBy($x, $y);

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

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

Python

$region->RectAt($index);
$region->RectAtInt($index);

ScaleBy

Scales the Region by the given Size or pair of scaling factors.

Perl

Python

$region->ScaleBy($scale);
$region->ScaleBy($x, $y);

Set

Sets the contents of the Region.

Perl

Python

$region->Set($rect);

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.