1 Attribute VB_Name
= "Bezier"
2 Declare Function CreateCompatibleDC
Lib "gdi32" (ByVal hdc
As Long) As Long
3 Declare Function LoadImage
Lib "user32" Alias "LoadImageA" (ByVal hInst
As Long, ByVal lpsz
As String, ByVal un1
As Long, ByVal n1
As Long, ByVal n2
As Long, ByVal un2
As Long) As Long
4 Declare Function SelectObject
Lib "gdi32" (ByVal hdc
As Long, ByVal hObject
As Long) As Long
6 Declare Function BitBlt
Lib "gdi32" (ByVal hDestDC
As Long, ByVal x
As Long, ByVal y
As Long, ByVal nWidth
As Long, ByVal nHeight
As Long, ByVal hSrcDC
As Long, ByVal xSrc
As Long, ByVal ySrc
As Long, ByVal dwRop
As Long) As Long
7 Public Const SRCCOPY
= &HCC0020
15 Global ft(30) As Single
19 Sub bezier_draw(nb
As Long, OffX
As Long, OffY
As Long)
20 Dim i
As Long, pas
As Single, t
As Single, oldx
As Single, oldy
As Single, x
As Single, y
As Single
27 For t
= pas
To 1 Step pas
30 ppal
.Line (OffX
+ oldx
, OffY
+ oldy
)-(OffX
+ x
, OffY
+ y
), QBColor(ppal
.Color
.Value
)
35 ppal
.PSet (OffX
+ Pt(i
).x
, OffY
+ Pt(i
).y
), QBColor(ppal
.Color
.Value
)
40 Function bezier_pty(t
As Single) As Single
41 Dim k
As Long, i
As Long
44 bezier_pty
= bezier_pty
+ Pt(i
).y
* melange(k
, MaxPt
, t
)
49 Function bezier_ptx(t
As Single) As Single
50 Dim k
As Long, i
As Long
53 bezier_ptx
= bezier_ptx
+ Pt(i
).x
* melange(k
, MaxPt
, t
)
59 Sub ini_factorielles()
62 ft(i
&) = ft(i
& - 1) * i
&
67 Sub make_pt(i
As Long, x
As Long, y
As Long)
73 Function melange(i
As Long, n
As Long, t
As Single) As Single
74 melange
= CSng(ft(n
) / ft(i
) / ft(n
- i
)) * t ^ i
* (1 - t
) ^
(n
- i
)