Is there a wxRegion::Intersects() or some way of doing it?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
maxinuruguay
I live to help wx-kind
I live to help wx-kind
Posts: 198
Joined: Sat Oct 28, 2006 3:36 am

Is there a wxRegion::Intersects() or some way of doing it?

Post by maxinuruguay »

I need to know if a region intersects a rectangle. There doesn't seem to be an intersects() function in wxRegion. I can do wxRegion().GetBox() but a box isn't fine grained enough. Anyone know how to know if a wxRect intersects a wxRegion?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Is there a wxRegion::Intersects() or some way of doing i

Post by PB »

wxRegion::Intersect(wxRect&) appears to be there in in wxWidgets 2.8 and wxWidgets 2.9?
maxinuruguay
I live to help wx-kind
I live to help wx-kind
Posts: 198
Joined: Sat Oct 28, 2006 3:36 am

Re: Is there a wxRegion::Intersects() or some way of doing i

Post by maxinuruguay »

PB wrote:wxRegion::Intersect(wxRect&) appears to be there in in wxWidgets 2.8 and wxWidgets 2.9?
That function creates a region that intersects both (or something). It doesn't actually tell you if region and rect intersect.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Is there a wxRegion::Intersects() or some way of doing i

Post by PB »

And is that not enough to get the information required - something like the code below doesn't work?

Code: Select all

bool RegionsIntersect(const wxRegion& region, const wxRect& rect)
{
  wxRegion r(region);
  return r.Intersect(rect) && !r.IsEmpty();
}
Post Reply