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:
Włodzimierz Skiba 2006-11-10 19:58:43 +00:00
parent d036261c45
commit 320bf9ceec
4 changed files with 35 additions and 9 deletions

View File

@ -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}
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
{\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},
@ -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}.
You can use this to test the iterator object as if it were of type bool.

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: region.h
// Name: wx/mgl/region.h
// Purpose: wxRegion class
// Author: Vaclav Slavik
// Created: 2001/03/12
@ -23,12 +23,13 @@ public:
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
wxRegion(const wxRect& rect);
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);
}
wxRegion( const wxBitmap& bmp,
const wxColour& transColour, int tolerance = 0)
wxRegion(const wxBitmap& bmp,
const wxColour& transColour, int tolerance = 0)
{
Union(bmp, transColour, tolerance);
}

View File

@ -408,11 +408,11 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
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
#if !defined(__WXMGL__) && !defined(__WXDFB__)
#if !defined(__WXDFB__)
// set the clipping region for the tab --
wxRegion clipping_region(WXSIZEOF(clip_points), clip_points);
dc.SetClippingRegion(clipping_region);
#endif // !wxMGL && !wxDFB
#endif // !wxDFB
wxPoint border_points[6];
border_points[0] = wxPoint(tab_x, tab_y+tab_height-4);

View File

@ -102,6 +102,24 @@ wxRegion::wxRegion(const MGLRegion& 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()
{
// m_refData unrefed in ~wxObject