Use native methods to draw some geometric figures using GDI+ renderer

Use native methods provided by GDI+ renderer to draw circles and ellipses.

Closes #17554
This commit is contained in:
Artur Wieczorek
2016-05-31 21:02:34 +02:00
parent a5d4a99bb0
commit d81fb0be63

View File

@@ -155,15 +155,18 @@ public :
// //
// appends a rectangle as a new closed subpath // appends a rectangle as a new closed subpath
virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) ; virtual void AddRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h) wxOVERRIDE;
// appends a circle as a new closed subpath
virtual void AddCircle(wxDouble x, wxDouble y, wxDouble r) wxOVERRIDE;
// appends an ellipse as a new closed subpath fitting the passed rectangle
virtual void AddEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h) wxOVERRIDE;
/* /*
// appends an ellipsis as a new closed subpath fitting the passed rectangle
virtual void AddEllipsis( wxDouble x, wxDouble y, wxDouble w , wxDouble h ) ;
// draws a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) // draws a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ;
*/ */
// returns the native path // returns the native path
virtual void * GetNativePath() const { return m_path; } virtual void * GetNativePath() const { return m_path; }
@@ -1324,6 +1327,16 @@ void wxGDIPlusPathData::AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDoub
MoveToPoint(x, y); MoveToPoint(x, y);
} }
void wxGDIPlusPathData::AddCircle(wxDouble x, wxDouble y, wxDouble r)
{
m_path->AddEllipse((REAL)(x-r), (REAL)(y-r), (REAL)(2.0*r), (REAL)(2.0*r));
}
void wxGDIPlusPathData::AddEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h)
{
m_path->AddEllipse((REAL)x, (REAL)y, (REAL)w, (REAL)h);
}
void wxGDIPlusPathData::AddPath( const wxGraphicsPathData* path ) void wxGDIPlusPathData::AddPath( const wxGraphicsPathData* path )
{ {
const wxGDIPlusPathData* pathData = static_cast<const wxGDIPlusPathData*>(path); const wxGDIPlusPathData* pathData = static_cast<const wxGDIPlusPathData*>(path);