Available in the LEADTOOLS Imaging toolkit. |
CurveToBezier example for C++ 4.0 and later
m_Lead1.SetCurveClose(CURVE_CLOSE);
m_Lead1.SetCurveSize(4);
m_Lead1.SetCurveX(0, 220);
m_Lead1.SetCurveY(0, 10);
m_Lead1.SetCurveX(1, 10);
m_Lead1.SetCurveY(1, 30);
m_Lead1.SetCurveX(2, 20);
m_Lead1.SetCurveY(2, 240);
m_Lead1.SetCurveX(3, 250);
m_Lead1.SetCurveY(3, 260);
m_Lead1.SetCurveTension(0.35f);
m_Lead1.SetCurveType(CURVE_STANDAR);
m_Lead1.SetRgnCurve(L_POLY_WINDING, L_RGN_SET);
m_Lead1.SetRgnFrameType(RGNFRAME_ANIMATED);
m_Lead1.CurveToBezier();
POINT *p = new POINT[m_Lead1.GetBezierSize()];
int i;
for(i=0; i<m_Lead1.GetBezierSize(); ++i)
{
p[i].x = m_Lead1.GetBezierX(i);
p[i].y = m_Lead1.GetBezierY(i);
}
CDC *cdc = GetDC();
PolyBezier(cdc->GetSafeHdc(), p, m_Lead1.GetBezierSize());
ReleaseDC(cdc);