adding Robert Lang's native CG-Bezier patch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35502 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -54,6 +54,8 @@ public :
|
|||||||
|
|
||||||
virtual void AddLineToPoint( wxCoord x1 , wxCoord y1 ) = 0 ;
|
virtual void AddLineToPoint( wxCoord x1 , wxCoord y1 ) = 0 ;
|
||||||
|
|
||||||
|
virtual void AddQuadCurveToPoint( wxCoord cx1, wxCoord cy1, wxCoord x1, wxCoord y1 ) = 0 ;
|
||||||
|
|
||||||
virtual void AddRectangle( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) = 0 ;
|
virtual void AddRectangle( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) = 0 ;
|
||||||
|
|
||||||
virtual void AddCircle( wxCoord x, wxCoord y , wxCoord r ) = 0 ;
|
virtual void AddCircle( wxCoord x, wxCoord y , wxCoord r ) = 0 ;
|
||||||
@@ -237,6 +239,9 @@ protected:
|
|||||||
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
|
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
|
||||||
|
|
||||||
virtual void DoDrawPoint(wxCoord x, wxCoord y);
|
virtual void DoDrawPoint(wxCoord x, wxCoord y);
|
||||||
|
#if wxMAC_USE_CORE_GRAPHICS && wxUSE_SPLINES
|
||||||
|
virtual void DoDrawSpline(wxList *points);
|
||||||
|
#endif
|
||||||
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
|
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
|
||||||
|
|
||||||
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
|
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
|
||||||
|
@@ -157,6 +157,11 @@ void wxMacCGPath::AddLineToPoint( wxCoord x1 , wxCoord y1 )
|
|||||||
CGPathAddLineToPoint( m_path , NULL , x1 , y1 ) ;
|
CGPathAddLineToPoint( m_path , NULL , x1 , y1 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxMacCGPath::AddQuadCurveToPoint( wxCoord cx1, wxCoord cy1, wxCoord x1, wxCoord y1 )
|
||||||
|
{
|
||||||
|
CGPathAddQuadCurveToPoint( m_path , NULL , cx1 , cy1 , x1 , y1 );
|
||||||
|
}
|
||||||
|
|
||||||
void wxMacCGPath::AddRectangle( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
|
void wxMacCGPath::AddRectangle( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
|
||||||
{
|
{
|
||||||
CGRect cgRect = { { x , y } , { w , h } } ;
|
CGRect cgRect = { { x , y } , { w , h } } ;
|
||||||
@@ -1421,6 +1426,65 @@ void wxDC::DoDrawLines(int n, wxPoint points[],
|
|||||||
delete path ;
|
delete path ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_SPLINES
|
||||||
|
void wxDC::DoDrawSpline(wxList *points)
|
||||||
|
{
|
||||||
|
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
||||||
|
|
||||||
|
if ( m_logicalFunction != wxCOPY )
|
||||||
|
return ;
|
||||||
|
|
||||||
|
wxGraphicPath* path = m_graphicContext->CreatePath() ;
|
||||||
|
|
||||||
|
wxList::compatibility_iterator node = points->GetFirst();
|
||||||
|
if (node == wxList::compatibility_iterator())
|
||||||
|
// empty list
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxPoint *p = (wxPoint *)node->GetData();
|
||||||
|
|
||||||
|
wxCoord x1 = p->x;
|
||||||
|
wxCoord y1 = p->y;
|
||||||
|
|
||||||
|
node = node->GetNext();
|
||||||
|
p = (wxPoint *)node->GetData();
|
||||||
|
|
||||||
|
wxCoord x2 = p->x;
|
||||||
|
wxCoord y2 = p->y;
|
||||||
|
wxCoord cx1 = ( x1 + x2 ) / 2;
|
||||||
|
wxCoord cy1 = ( y1 + y2 ) / 2;
|
||||||
|
|
||||||
|
path->MoveToPoint( XLOG2DEVMAC( x1 ) , XLOG2DEVMAC( y1 ) ) ;
|
||||||
|
path->AddLineToPoint( XLOG2DEVMAC( cx1 ) , XLOG2DEVMAC( cy1 ) ) ;
|
||||||
|
|
||||||
|
#if !wxUSE_STL
|
||||||
|
while ((node = node->GetNext()) != NULL)
|
||||||
|
#else
|
||||||
|
while ((node = node->GetNext()))
|
||||||
|
#endif // !wxUSE_STL
|
||||||
|
{
|
||||||
|
p = (wxPoint *)node->GetData();
|
||||||
|
x1 = x2;
|
||||||
|
y1 = y2;
|
||||||
|
x2 = p->x;
|
||||||
|
y2 = p->y;
|
||||||
|
wxCoord cx4 = (x1 + x2) / 2;
|
||||||
|
wxCoord cy4 = (y1 + y2) / 2;
|
||||||
|
|
||||||
|
path->AddQuadCurveToPoint( XLOG2DEVMAC( x1 ) , XLOG2DEVMAC( y1 ) ,
|
||||||
|
XLOG2DEVMAC( cx4 ) , XLOG2DEVMAC( cy4 ) ) ;
|
||||||
|
|
||||||
|
cx1 = cx4;
|
||||||
|
cy1 = cy4;
|
||||||
|
}
|
||||||
|
|
||||||
|
path->AddLineToPoint( XLOG2DEVMAC( x2 ) , XLOG2DEVMAC( y2 ) ) ;
|
||||||
|
|
||||||
|
m_graphicContext->StrokePath( path ) ;
|
||||||
|
delete path ;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void wxDC::DoDrawPolygon(int n, wxPoint points[],
|
void wxDC::DoDrawPolygon(int n, wxPoint points[],
|
||||||
wxCoord xoffset, wxCoord yoffset,
|
wxCoord xoffset, wxCoord yoffset,
|
||||||
int fillStyle )
|
int fillStyle )
|
||||||
|
Reference in New Issue
Block a user