region from polygon added
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28518 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -44,6 +44,7 @@ public:
|
||||
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||
wxRegion(const wxRect& rect);
|
||||
wxRegion( WXHRGN hRegion );
|
||||
wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
|
||||
wxRegion();
|
||||
wxRegion(const wxBitmap& bmp)
|
||||
{
|
||||
|
@@ -85,6 +85,31 @@ wxRegion::wxRegion(const wxRect& rect)
|
||||
SetRectRgn( (RgnHandle) M_REGION , rect.x , rect.y , rect.x+rect.width , rect.y+rect.height ) ;
|
||||
}
|
||||
|
||||
wxRegion::wxRegion(size_t n, const wxPoint *points, int WXUNUSED(fillStyle))
|
||||
{
|
||||
m_refData = new wxRegionRefData;
|
||||
|
||||
OpenRgn();
|
||||
|
||||
wxCoord x1, x2 , y1 , y2 ;
|
||||
x2 = x1 = points[0].x ;
|
||||
y2 = y1 = points[0].y ;
|
||||
::MoveTo(x1,y1);
|
||||
for (int i = 1; i < n; i++)
|
||||
{
|
||||
x2 = points[i].x ;
|
||||
y2 = points[i].y ;
|
||||
::LineTo(x2, y2);
|
||||
}
|
||||
// close the polyline if necessary
|
||||
if ( x1 != x2 || y1 != y2 )
|
||||
{
|
||||
::LineTo(x1,y1 ) ;
|
||||
}
|
||||
ClosePoly();
|
||||
CloseRgn( M_REGION ) ;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Destroy the region.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user