From 564cb9de6150b7de9fbbce5b4f8de24792922277 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 27 Jul 2004 11:28:20 +0000 Subject: [PATCH] region from polygon added git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28518 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/carbon/region.h | 1 + src/mac/carbon/region.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/wx/mac/carbon/region.h b/include/wx/mac/carbon/region.h index 24c060337f..923a0014ad 100644 --- a/include/wx/mac/carbon/region.h +++ b/include/wx/mac/carbon/region.h @@ -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) { diff --git a/src/mac/carbon/region.cpp b/src/mac/carbon/region.cpp index a3cf8cef7b..a03e1515ba 100644 --- a/src/mac/carbon/region.cpp +++ b/src/mac/carbon/region.cpp @@ -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. */ -- 2.47.2