Add wxRegion ctor from array of points to wxMGL.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43286 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -1,3 +1,13 @@
 | 
				
			|||||||
 | 
					%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
				
			||||||
 | 
					%% Name:        region.tex
 | 
				
			||||||
 | 
					%% Purpose:     wxRegion documentation
 | 
				
			||||||
 | 
					%% Author:      wxTeam
 | 
				
			||||||
 | 
					%% Created:
 | 
				
			||||||
 | 
					%% RCS-ID:      $Id$
 | 
				
			||||||
 | 
					%% Copyright:   (c) wxTeam
 | 
				
			||||||
 | 
					%% License:     wxWindows license
 | 
				
			||||||
 | 
					%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
				
			||||||
 | 
					
 | 
				
			||||||
\section{\class{wxRegion}}\label{wxregion}
 | 
					\section{\class{wxRegion}}\label{wxregion}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A wxRegion represents a simple or complex region on a device context or window. It uses
 | 
					A wxRegion represents a simple or complex region on a device context or window. It uses
 | 
				
			||||||
@@ -47,8 +57,6 @@ Constructs a region corresponding to the polygon made of {\it n} points in the
 | 
				
			|||||||
provided array. {\it fillStyle} parameter may have values
 | 
					provided array. {\it fillStyle} parameter may have values
 | 
				
			||||||
{\tt wxWINDING\_RULE} or {\tt wxODDEVEN\_RULE}.
 | 
					{\tt wxWINDING\_RULE} or {\tt wxODDEVEN\_RULE}.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{\bf NB:} This constructor is only implemented for Win32 and GTK+ wxWidgets ports.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
\func{}{wxRegion}{\param{const wxBitmap\&}{ bmp}}
 | 
					\func{}{wxRegion}{\param{const wxBitmap\&}{ bmp}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
\func{}{wxRegion}{\param{const wxBitmap\&}{ bmp},
 | 
					\func{}{wxRegion}{\param{const wxBitmap\&}{ bmp},
 | 
				
			||||||
@@ -384,4 +392,3 @@ Increment operator. Increments the iterator to the next region.
 | 
				
			|||||||
Returns {\tt true} if there are still some rectangles; otherwise returns {\tt false}.
 | 
					Returns {\tt true} if there are still some rectangles; otherwise returns {\tt false}.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You can use this to test the iterator object as if it were of type bool.
 | 
					You can use this to test the iterator object as if it were of type bool.
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/////////////////////////////////////////////////////////////////////////////
 | 
					/////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
// Name:        region.h
 | 
					// Name:        wx/mgl/region.h
 | 
				
			||||||
// Purpose:     wxRegion class
 | 
					// Purpose:     wxRegion class
 | 
				
			||||||
// Author:      Vaclav Slavik
 | 
					// Author:      Vaclav Slavik
 | 
				
			||||||
// Created:     2001/03/12
 | 
					// Created:     2001/03/12
 | 
				
			||||||
@@ -23,11 +23,12 @@ public:
 | 
				
			|||||||
    wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
 | 
					    wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
 | 
				
			||||||
    wxRegion(const wxRect& rect);
 | 
					    wxRegion(const wxRect& rect);
 | 
				
			||||||
    wxRegion(const MGLRegion& region);
 | 
					    wxRegion(const MGLRegion& region);
 | 
				
			||||||
    wxRegion( const wxBitmap& bmp)
 | 
					    wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
 | 
				
			||||||
 | 
					    wxRegion(const wxBitmap& bmp)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Union(bmp);
 | 
					        Union(bmp);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    wxRegion( const wxBitmap& bmp,
 | 
					    wxRegion(const wxBitmap& bmp,
 | 
				
			||||||
             const wxColour& transColour, int tolerance = 0)
 | 
					             const wxColour& transColour, int tolerance = 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Union(bmp, transColour, tolerance);
 | 
					        Union(bmp, transColour, tolerance);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -408,11 +408,11 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
 | 
				
			|||||||
    clip_points[5] = wxPoint(tab_x+clip_width+1, tab_y+tab_height-3);
 | 
					    clip_points[5] = wxPoint(tab_x+clip_width+1, tab_y+tab_height-3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // FIXME: these ports don't provide wxRegion ctor from array of points
 | 
					    // FIXME: these ports don't provide wxRegion ctor from array of points
 | 
				
			||||||
#if !defined(__WXMGL__) && !defined(__WXDFB__)
 | 
					#if !defined(__WXDFB__)
 | 
				
			||||||
    // set the clipping region for the tab --
 | 
					    // set the clipping region for the tab --
 | 
				
			||||||
    wxRegion clipping_region(WXSIZEOF(clip_points), clip_points);
 | 
					    wxRegion clipping_region(WXSIZEOF(clip_points), clip_points);
 | 
				
			||||||
    dc.SetClippingRegion(clipping_region);
 | 
					    dc.SetClippingRegion(clipping_region);
 | 
				
			||||||
#endif // !wxMGL && !wxDFB
 | 
					#endif // !wxDFB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wxPoint border_points[6];
 | 
					    wxPoint border_points[6];
 | 
				
			||||||
    border_points[0] = wxPoint(tab_x,             tab_y+tab_height-4);
 | 
					    border_points[0] = wxPoint(tab_x,             tab_y+tab_height-4);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -102,6 +102,24 @@ wxRegion::wxRegion(const MGLRegion& region)
 | 
				
			|||||||
    M_REGION = region;
 | 
					    M_REGION = region;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					wxRegion::wxRegion(size_t n, const wxPoint *points, int WXUNUSED(fillStyle))
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    m_refData = new wxRegionRefData;
 | 
				
			||||||
 | 
					    point_t *pts = new point_t[n];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (size_t i = 0; i < n; i++)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        pts[i].x = points[i].x;
 | 
				
			||||||
 | 
					        pts[i].y = points[i].y;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    region_t* rgn = MGL_rgnPolygon(n, pts, 1, 0, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    M_REGION = rgn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    delete [] pts;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxRegion::~wxRegion()
 | 
					wxRegion::~wxRegion()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // m_refData unrefed in ~wxObject
 | 
					    // m_refData unrefed in ~wxObject
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user