Hasty Badger
Small UI library (a branch of Turbo Badger)
|
TBRegion does calculations on regions represented by a list of rectangles. More...
#include <tb_geometry.h>
Public Member Functions | |
void | RemoveRect (int index) |
Remove the rect at the given index. More... | |
void | RemoveRectFast (int index) |
Remove the rect at the given index. More... | |
void | RemoveAll (bool free_memory=true) |
Remove all rectangles so the region becomes empty. More... | |
bool | Set (const TBRect &rect) |
Set the region to the given rect. More... | |
bool | AddRect (const TBRect &rect, bool coalesce) |
Add the rect without doing any overlap check. More... | |
bool | IncludeRect (const TBRect &include_rect) |
Include the rect in the region. More... | |
bool | ExcludeRect (const TBRect &exclude_rect) |
Exclude the rect from the region. More... | |
bool | AddExcludingRects (const TBRect &rect, const TBRect &exclude_rect, bool coalesce) |
Add the rectangles that's left of rect after excluding exclude_rect. More... | |
bool | IsEmpty () const |
int | GetNumRects () const |
const TBRect & | GetRect (int index) const |
TBRegion does calculations on regions represented by a list of rectangles.
bool tb::TBRegion::AddExcludingRects | ( | const TBRect & | rect, |
const TBRect & | exclude_rect, | ||
bool | coalesce | ||
) |
Add the rectangles that's left of rect after excluding exclude_rect.
bool tb::TBRegion::AddRect | ( | const TBRect & | rect, |
bool | coalesce | ||
) |
Add the rect without doing any overlap check.
If coalesce is true, it will coalesce the rectangle with existing rectangles if possible (until there's nothing more to coalesce it with).
bool tb::TBRegion::ExcludeRect | ( | const TBRect & | exclude_rect | ) |
Exclude the rect from the region.
bool tb::TBRegion::IncludeRect | ( | const TBRect & | include_rect | ) |
Include the rect in the region.
This will add only the parts that's not already in the region so the result doesn't contain overlap parts. This assumes there's no overlap in the region already!
void tb::TBRegion::RemoveAll | ( | bool | free_memory = true | ) |
Remove all rectangles so the region becomes empty.
If free_memory is false, the internal buffers will be reused if more rectangles are added again under its life time.
void tb::TBRegion::RemoveRect | ( | int | index | ) |
Remove the rect at the given index.
void tb::TBRegion::RemoveRectFast | ( | int | index | ) |
Remove the rect at the given index.
This method will change the order of rectangles after index.
bool tb::TBRegion::Set | ( | const TBRect & | rect | ) |
Set the region to the given rect.