savez-vous comment on peut créer des formes arrondies avec la lib vector drawing ?
Une image pour expliquer ce que j'essaie d'obtenir :

J'ai toujours 2 points qui sont "pointus" (le points de départ de chaque courbe), je voudrais que tout soit lissé ^^.
Code : Tout sélectionner
Global Dim pt.point(10)
t$="217,7,244,91,147,162,51,75,51,10,140,66,"
u = 1
For i = 0 To 10
pt(i)\x = Val(StringField(t$,u,",")) : u+1
pt(i)\y = Val(StringField(t$,u,",")) : u+1
Next
Global color.i
Color = -12577347 ; RGBA(0, 0, 255, 255)
Procedure Drawcanvas()
If StartVectorDrawing(CanvasVectorOutput(0))
AddPathBox(0,0, GadgetWidth(0),GadgetHeight(0))
VectorSourceColor(RGBA(255,255,255,255))
FillPath()
a = 3
MovePathCursor(pt(a+2)\x,pt(a+2)\y)
AddPathCurve(pt(0)\x, pt(0)\y,pt(1)\x,pt(1)\y,pt(2)\x,pt(2)\y)
AddPathCurve(pt(a)\x, pt(a)\y,pt(a+1)\x,pt(a+1)\y,pt(a+2)\x,pt(a+2)\y)
; remplir le chemin
VectorSourceColor(color)
FillPath()
; les points d'encrage
For i =0 To 5
AddPathBox(pt(i)\x-5, pt(i)\y-5, 10, 10)
Next
VectorSourceColor(RGBA(250, 0, 0, 120))
FillPath()
StopVectorDrawing()
EndIf
EndProcedure
If OpenWindow(0, 0, 0, 400, 300, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 400, 300)
If CreateMenu(0,WindowID(0))
MenuTitle("Edit")
MenuItem(2,"Change color")
EndIf
Drawcanvas()
Repeat
Event = WaitWindowEvent()
If event = #PB_Event_Menu
Select EventMenu()
Case 2 ;color
col = ColorRequester(color)
Color=RGBA(Red(col),Green(col),Blue(col),255)
Drawcanvas()
EndSelect
ElseIf event = #PB_Event_Gadget
Select EventGadget()
Case 0
If EventType() = #PB_EventType_LeftButtonDown Or (EventType() = #PB_EventType_MouseMove And GetGadgetAttribute(0, #PB_Canvas_Buttons) & #PB_Canvas_LeftButton)
If StartVectorDrawing(CanvasVectorOutput(0))
x = GetGadgetAttribute(0, #PB_Canvas_MouseX)
y = GetGadgetAttribute(0, #PB_Canvas_MouseY)
If EventType() = #PB_EventType_LeftButtonDown
move = 0
For i=0 To 5
If x >= pt(i)\x-5 And x<=pt(i)\x-5+10 And y>=pt(i)\y-5 And y<=pt(i)\y-5+10
move = 1
Break
EndIf
Next
ElseIf EventType() = #PB_EventType_LeftButtonUp
move=0
EndIf
If move = 1
pt(i)\x = x
pt(i)\y = y
EndIf
StopVectorDrawing()
EndIf
If move = 1
Drawcanvas()
EndIf
EndIf
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
Autre question :
savez-vous s'il est possible d'agir sur les "points des courbes de béziers (créés avec AddPathCurve()) ?
J'ai l'impression que c'est automatique pour la courbe (je voudrais par exemple faire comme un soft de dessin vectoriel, pouvoir tirer sur des sortes d'ancres à droite et à gauche du point pour grossir ou réduire la courbe.)
Merci.