I am trying to draw polygon using the function wxDC::DrawPolygon( const wxList *list ). However the dilemma I am in is:
1. If I define a variable of type wxList m_Polygon, and then try to add any wxPoint to it, it fails, since wxPoint doesn’t inherit from wxObject.
wxPoint in a c-style array [] worked for me:
// a copy of the points in screen coordinates
wxPoint *screenPoints = new wxPoint[GetNumVerticies()];
for (int i = 0; i < GetNumVerticies(); i++)
{
screenPoints[i] = va.GetScreenPos((wxPoint&)GetVertex(i));
}
// the pen and brush of this color
wxPen pen(GetColor(), 1, wxSOLID);
pen.SetWidth(GetThickness_p());
dc.SetPen(pen);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
if (GetClosed())
{
dc.DrawPolygon(GetNumVerticies(), screenPoints);
}
else
{
dc.DrawLines(GetNumVerticies(), screenPoints);
}
-Jim
On Sat, 12 Feb 2005 12:20:21 +0200, Tamer El Nashar <te...@vrsonic.com> wrote:
--------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-u...@lists.wxwidgets.org For additional commands, e-mail: wx-use...@lists.wxwidgets.org
for (int i = 0; i < GetNumVerticies(); i++)
{
screenPoints[i] = va.GetScreenPos((wxPoint&)GetVertex(i));
}
// the pen and brush of this color
wxPen pen(GetColor(), 1, wxSOLID);
pen.SetWidth(GetThickness_p());
dc.SetPen(pen);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
if (GetClosed())
{
dc.DrawPolygon(GetNumVerticies(), screenPoints);
}
else
{
dc.DrawLines(GetNumVerticies(), screenPoints);
}
-Jim
On Sat, 12 Feb 2005 12:20:21 +0200, Tamer El Nashar <te...@vrsonic.com> wrote: