Available in the LEADTOOLS Imaging toolkit. |
CurveToBezier example for Visual Basic
Private Declare Function PolyBezier Lib "gdi32" (ByVal hdc As Long, lppt As POINTAPI, ByVal cPoints As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Bezier_Click()
LEAD2.CurveClose = CURVE_CLOSE
LEAD2.CurveSize = 4
LEAD2.CurveX(1) = 10
LEAD2.CurveY(1) = 30
LEAD2.CurveX(2) = 20
LEAD2.CurveY(2) = 240
LEAD2.CurveX(3) = 250
LEAD2.CurveY(3) = 260
LEAD2.CurveX(0) = 220
LEAD2.CurveY(0) = 10
LEAD2.CurveTension = 0.35
LEAD2.CurveType = CURVE_STANDAR
LEAD2.SetRgnCurve L_POLY_WINDING, L_RGN_SET
LEAD2.RgnFrameType = RGNFRAME_ANIMATED
LEAD2.CurveToBezier
ReDim p(LEAD2.BezierSize) As POINTAPI
Dim i
For i = 1 To LEAD2.BezierSize
p(i).x = LEAD2.BezierX(i - 1)
p(i).y = LEAD2.BezierY(i - 1)
Next
PolyBezier Form1.hdc, p(1), LEAD2.BezierSize
End Sub