Page 1 sur 3

Besoin d'aide VectorDrawing

Publié : sam. 18/juil./2020 6:35
par Shadow
Bonjour,

Je ne maîtrise pas le VecteurDrawing et pour moi c'est très compliqué.
En plus quand ont doit aussi gérer épaisseur c'est encore pire.

Le problème avec le VecteurDrawing est qu'il faut faire des calcule suivant l'épaisseur du trait.
Personnellement je galère beaucoup.

Mon GridMaker V2 est buger et j'aime pas, je dois le refaire en mieux !

Voici quelque chose que je voudrais faire pour un projet.
Je ne sais pas faire ça:

Image

Est ce que vous pourriez me dire comment faire svp, me faire voir un code.

Le point jaune représente le début du traçage, et la point bleu la fin.
J'ai mis des icône de surligneur pour vous faire voir comment je vois les choses.

Moi j'y arrive pas :(

Code : Tout sélectionner

 
If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CanvasGadget(0, 0, 0, 400, 200)
    
    If StartVectorDrawing(CanvasVectorOutput(0))
      
      AddPathBox(50.5, 50.5, 200, 50)
      VectorSourceColor(RGBA(0, 0, 0, 255))
      StrokePath(1)
      
      Thickness.d = 10
      
      X.d = 51
      Y.d = 51
      
      ....
      
      StopVectorDrawing()
      
    EndIf
    
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
  EndIf

Re: Besoin d'aide VectorDrawing

Publié : sam. 18/juil./2020 9:57
par Shadow
Après un bon casse tête j'ai fini par y arriver:

Code : Tout sélectionner

X1.d = 51
Y1.d = 51

Thickness.d = 10

X2.d = 61
Y2.d = 51

If Y1.d = Y2.d
  MovePathCursor(X1.d, Y1.d + (Thickness.d / 2))
  AddPathLine(X1.d + (X2.d - X1.d), Y2.d + (Thickness.d / 2))
  
ElseIf X1.d = X2.d
  MovePathCursor(X1.d + (Thickness.d / 2), Y1.d)
  AddPathLine(X1.d + (X2.d - X1.d) + (Thickness.d / 2), Y2.d)
  
Else
  MovePathCursor(X1.d, Y1.d)
  AddPathLine(X2.d, Y2.d)
  
EndIf
Avec ce code ont peut dessiner dans la direction que l'ont veux et de l'épaisseur voulue !

Mais ça ne prends pas en compte les options:
#PB_Path_RoundEnd : Trace la ligne avec des extrémités arrondies
#PB_Path_SquareEnd : Trace la ligne avec un carré aux extrémités

J'y travail mais c'est un véritable casse tête ce truc, c'est très dur :(

Re: Besoin d'aide VectorDrawing

Publié : sam. 18/juil./2020 17:13
par Philippe_GEORGES
Bonjour

Ne te prends pas la tête, moi, j'utilise les procédures de Thorsten qui facilitent grandement l'utilisation du dessin vectoriel.

Il y a aussi d'autres procédures pour faire du PDF....etc.

Tu peux y aller, c'est vraiment un grand programmeur !!

Thorsten.Hoeppner@gmx.de

https://app.box.com/s/skfdlqee1ozu3bnto ... veh?page=1

Phil

Re: Besoin d'aide VectorDrawing

Publié : sam. 18/juil./2020 21:56
par Shadow
Salut Philippe_GEORGES,

Je te remercie mais ça m'aide pas, je peux pas faire se que je veux avec.

Re: Besoin d'aide VectorDrawing

Publié : dim. 19/juil./2020 19:42
par Itsy Bitsy
Bonjour,

Je ne vois pas ce qui ne marche pas, avec StrokePath(Thickness,#PB_Path_RoundEnd) ?

J’ai bien un arrondi à l'écran sur mac.

Code : Tout sélectionner

If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CanvasGadget(0, 0, 0, 400, 200)
   
    If StartVectorDrawing(CanvasVectorOutput(0))
     
      AddPathBox(50.5, 50.5, 200, 50)
      VectorSourceColor(RGBA(0, 0, 0, 255))
      StrokePath(1)
     
      Thickness.d = 10
           
      X1.d = 51
      Y1.d = 51
      
      If Y1.d = Y2.d
        MovePathCursor(X1.d, Y1.d + (Thickness.d / 2))
        AddPathLine(X1.d + (X2.d - X1.d), Y2.d + (Thickness.d / 2))
       
      ElseIf X1.d = X2.d
        MovePathCursor(X1.d + (Thickness.d / 2), Y1.d)
        AddPathLine(X1.d + (X2.d - X1.d) + (Thickness.d / 2), Y2.d)
       
      Else
        MovePathCursor(X1.d, Y1.d)
        AddPathLine(X2.d, Y2.d)
       
      EndIf
      
      StrokePath(Thickness,#PB_Path_RoundEnd)
      
      ;StrokePath(Thickness,#PB_Path_SquareEnd)
      ;StrokePath(Thickness)
      
      StopVectorDrawing()
     
    EndIf
   
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
EndIf

Re: Besoin d'aide VectorDrawing

Publié : lun. 20/juil./2020 0:14
par Shadow
Pour te donner une petite idée de la difficulté de la chose, un véritable
casse tête en vraie, voici une image non exhaustive de la chose:

https://drive.google.com/file/d/1DAELBe ... sp=sharing

Essais de faire ça, je te garantie que c'est pas si facile que ça en à l'air ;)
Et si tu y arrive, fais ça dans le sens inverse (droite à gauche).

Ce machin est un enfer, jme suis défoncé les neurones à le faire mais j'ai réussi.
Voici ce qui faut gérer:

Ligne normale par défaut
Ligne carré aux extrémités
Ligne arrondis aux extrémités

Ligne tiret normale par défaut
Ligne tiret carré aux extrémités
Ligne tiret arrondis aux extrémités

Ligne pointillé normale par défaut
Ligne pointillé carré aux extrémités
Ligne pointillé arrondis aux extrémités

Comme si c'était pas assez, rajoute encore la position
X1, X2, Y1 et Y2 à prendre en compte.

Je ne comprends pas que se soit pas fait par défaut se genre de calcule fastidieux, pourquoi ? 8O
Et je suis pas certain que ma routine soit 100% ok.

Alors, tu pense que tu va pouvoir le faire ?

Re: Besoin d'aide VectorDrawing

Publié : mar. 21/juil./2020 8:35
par Naheulf
Je ne vois pas pourquoi tu t'emmerde à calculer les positions de début et de fin des tirets...

Code : Tout sélectionner

If OpenWindow(0, 0, 0, 688, 629, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
	CanvasGadget(0, 0, 0, 688, 629)
	LoadFont(0, "Arial", 12)
	
	; 	Dim dashes.d(1)
	; 	dashes(0) = 20
	; 	dashes(1) = 10   ; dessine espace d'un pixel
	; 	dashes(1) = 1	 ; dessine espace d'un pixel
	; 	
	
	If StartVectorDrawing(CanvasVectorOutput(0))
		VectorFont(FontID(0), 12)
		largeur = 200
		hauteur = 50
		
		;- Affichage des titres
		px = 30+205*0+largeur/2
		Text$ = "Ligne continue, Defaut"
		MovePathCursor(px - VectorTextWidth(Text$)/2, 20 - VectorTextHeight(Text$)/2)
		DrawVectorText(Text$)
		
		px = 30+205*1+largeur/2
		Text$ = "Ligne continue, SquareEnd"
		MovePathCursor(px - VectorTextWidth(Text$)/2, 20 - VectorTextHeight(Text$)/2)
		DrawVectorText(Text$)
		
		px = 30+205*2+largeur/2
		Text$ = "Ligne continue, RoundEnd"
		MovePathCursor(px - VectorTextWidth(Text$)/2, 20 - VectorTextHeight(Text$)/2)
		DrawVectorText(Text$)
		
		;- Dessin des rectangles
		VectorSourceColor(RGBA(0, 0, 0, 255))
		For g = 0 To 2
			For y = 0 To 2
				For x = 0 To 2
					AddPathBox(205*x+30, 185*g+55*y+60, largeur,hauteur)
					StrokePath(1)
				Next
			Next
		Next
		
		;- Dessin des ligne
		VectorSourceColor(RGBA(255, 0, 0, 255))
		ep.f = 10.0
		dx = largeur-2*1-ep
		dy = hauteur-2*1-ep
		Dim dashes.d(3)
		dashes(0) = 30
		dashes(1) = 10
		dashes(2) = 0  ; Dessine juste un point
		dashes(3) = 10
		
		
		g = 0 : y = 0
		MovePathCursor(205*0+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, 0, #PB_Path_Relative):StrokePath(ep,#PB_Path_Default)
		MovePathCursor(205*1+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, 0, #PB_Path_Relative):StrokePath(ep,#PB_Path_SquareEnd)
		MovePathCursor(205*2+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, 0, #PB_Path_Relative):StrokePath(ep,#PB_Path_RoundEnd)
		
		g = 0 : y = 1
		MovePathCursor(205*0+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, 0, #PB_Path_Relative):DashPath(ep,15,#PB_Path_Default)
		MovePathCursor(205*1+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, 0, #PB_Path_Relative):DashPath(ep,15,#PB_Path_SquareEnd)
		MovePathCursor(205*2+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, 0, #PB_Path_Relative):DashPath(ep,15,#PB_Path_RoundEnd)
		
		g = 0 : y = 2
		MovePathCursor(205*0+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, 0, #PB_Path_Relative):CustomDashPath(ep,dashes(),#PB_Path_Default)
		MovePathCursor(205*1+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, 0, #PB_Path_Relative):CustomDashPath(ep,dashes(),#PB_Path_SquareEnd)
		MovePathCursor(205*2+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, 0, #PB_Path_Relative):CustomDashPath(ep,dashes(),#PB_Path_RoundEnd)
		
		
		g = 1 : y = 0
		MovePathCursor(205*0+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, dy, #PB_Path_Relative):StrokePath(ep,#PB_Path_Default)
		MovePathCursor(205*1+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, dy, #PB_Path_Relative):StrokePath(ep,#PB_Path_SquareEnd)
		MovePathCursor(205*2+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, dy, #PB_Path_Relative):StrokePath(ep,#PB_Path_RoundEnd)
		
		g = 1 : y = 1
		MovePathCursor(205*0+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, dy, #PB_Path_Relative):DashPath(ep,15,#PB_Path_Default)
		MovePathCursor(205*1+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, dy, #PB_Path_Relative):DashPath(ep,15,#PB_Path_SquareEnd)
		MovePathCursor(205*2+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, dy, #PB_Path_Relative):DashPath(ep,15,#PB_Path_RoundEnd)
		
		g = 1 : y = 2
		MovePathCursor(205*0+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, dy, #PB_Path_Relative):CustomDashPath(ep,dashes(),#PB_Path_Default)
		MovePathCursor(205*1+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, dy, #PB_Path_Relative):CustomDashPath(ep,dashes(),#PB_Path_SquareEnd)
		MovePathCursor(205*2+30+1+ep/2, 185*g+55*y+60+1+ep/2):AddPathLine(dx, dy, #PB_Path_Relative):CustomDashPath(ep,dashes(),#PB_Path_RoundEnd)
		
		
		g = 2 : y = 0
		MovePathCursor(205*0+30+1+ep/2, 185*g+55*y+60+1+ep/2+dy):AddPathLine(dx, -dy, #PB_Path_Relative):StrokePath(ep,#PB_Path_Default)
		MovePathCursor(205*1+30+1+ep/2, 185*g+55*y+60+1+ep/2+dy):AddPathLine(dx, -dy, #PB_Path_Relative):StrokePath(ep,#PB_Path_SquareEnd)
		MovePathCursor(205*2+30+1+ep/2, 185*g+55*y+60+1+ep/2+dy):AddPathLine(dx, -dy, #PB_Path_Relative):StrokePath(ep,#PB_Path_RoundEnd)
		
		g = 2 : y = 1
		MovePathCursor(205*0+30+1+ep/2, 185*g+55*y+60+1+ep/2+dy):AddPathLine(dx, -dy, #PB_Path_Relative):DashPath(ep,15,#PB_Path_Default)
		MovePathCursor(205*1+30+1+ep/2, 185*g+55*y+60+1+ep/2+dy):AddPathLine(dx, -dy, #PB_Path_Relative):DashPath(ep,15,#PB_Path_SquareEnd)
		MovePathCursor(205*2+30+1+ep/2, 185*g+55*y+60+1+ep/2+dy):AddPathLine(dx, -dy, #PB_Path_Relative):DashPath(ep,15,#PB_Path_RoundEnd)
		
		g = 2 : y = 2
		MovePathCursor(205*0+30+1+ep/2, 185*g+55*y+60+1+ep/2+dy):AddPathLine(dx, -dy, #PB_Path_Relative):CustomDashPath(ep,dashes(),#PB_Path_Default)
		MovePathCursor(205*1+30+1+ep/2, 185*g+55*y+60+1+ep/2+dy):AddPathLine(dx, -dy, #PB_Path_Relative):CustomDashPath(ep,dashes(),#PB_Path_SquareEnd)
		MovePathCursor(205*2+30+1+ep/2, 185*g+55*y+60+1+ep/2+dy):AddPathLine(dx, -dy, #PB_Path_Relative):CustomDashPath(ep,dashes(),#PB_Path_RoundEnd)
		
		;- Mise ne évidence des points de départ et d'arrivée
		
		For y = 0 To 2
			For x = 0 To 2
				VectorSourceColor(RGBA(0, 0, 255, 255))
				g = 0
				AddPathCircle(205*x+30+1+ep/2, 185*g+55*y+60+1+ep/2, 1)
				AddPathCircle(205*x+30+1+ep/2+dx, 185*g+55*y+60+1+ep/2+0, 1)
				
				g = 1
				AddPathCircle(205*x+30+1+ep/2, 185*g+55*y+60+1+ep/2, 1)
				AddPathCircle(205*x+30+1+ep/2+dx, 185*g+55*y+60+1+ep/2+dy, 1)
				
				g = 2
				AddPathCircle(205*x+30+1+ep/2, 185*g+55*y+60+1+ep/2+dy, 1)
				AddPathCircle(205*x+30+1+ep/2+dx, 185*g+55*y+60+1+ep/2, 1)
				StrokePath(1)
			Next
		Next
		StopVectorDrawing()
	EndIf
	
	Repeat
		Event = WaitWindowEvent()
	Until Event = #PB_Event_CloseWindow
EndIf

Re: Besoin d'aide VectorDrawing

Publié : mar. 21/juil./2020 9:33
par Shadow
Salut Naheulf,
Merci pour ton code, tu gère :)

En faite je veux rendre plus simple l'utilisation des vecteur.
Quand tu dessine une ligne ou autre, pleins de calcule ne sont pas fait.
Regarde mon code, si tu le peu, peut tu corriger ma routine ?

Code : Tout sélectionner

#SV_TypeLine = 1   ; Ligne
#SV_TypeDash = 2   ; Tirets
#SV_TypeDot = 3    ; Points

#SV_StyleDefaut = #PB_Path_Default                 ; Pas de comportement spécial (Par défaut).
#SV_StyleRoundEnd = #PB_Path_RoundEnd              ; Trace la ligne avec des extrémités arrondies.
#SV_StyleSquareEnd = #PB_Path_SquareEnd            ; Trace la ligne avec un carré aux extrémités.
#SV_StyleRoundCorner = #PB_Path_RoundCorner        ; Trace la ligne avec des coins arrondis.
#SV_StyleDiagonalCorner = #PB_Path_DiagonalCorner  ; Trace la ligne avec les coins coupés en diagonal.

;{ Draw a line at the indicated position and of the desired size.
; VectorImage.i = Image.
; X1.d = Start X position.
; Y1.d = Starting Y position.
; X2.d = End X position.
; Y2.d = End X position.
; Color.q = Line color.
; Thickness.d = Thickness of the line, the position of the patterns will be automatically centered on this line in relation To their Width (Length.d) If the type chosen is #SV_TypeDash Or #SV_TypeDoth.
; 
; Type: #SV_TypeLine : Draws a continuous line.
; #SV_TypeDash: Draws a discontinuous line with Dashes.
; #SV_TypeDot: Draws a discontinuous line with Dots.
; 
; Style: #SV_StyleRoundEnd: Draws a line With rounded ends.
; #SV_StyleSquareEnd: Draws the line with a square at the ends.
;
; Length: Length (If Style <> #SV_StyleDefault) Or Width (If Style = #SV_StyleDefault) of the Pattern Traits (Square, Round) If Type = #SV_TypeDash Or #SV_TypeDot, otherwise no effect.
; Distance: Distance between patterns (Square, Round) If Type = #SV_TypeDash Or #SV_TypeDot, otherwise no effect.
;
; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
; 
; Trace une ligne à la position indiqué et de la taille désiré.
; VectorImage.i = Image.
; X1.d = Position X de départ.
; Y1.d = Position Y de départ.
; X2.d = Position X de fin.
; Y2.d = Position X de fin.
; Color.q = Couleur de la ligne.
; Thickness.d = Epaisseur de la ligne, la position des motifs sera automatiquement centré sur cette ligne par apport à leur Largeur (Length.d) si le type choisie est #SV_TypeDash ou #SV_TypeDoth.
; 
; Type: #SV_TypeLine              : Trace une ligne continue.
;       #SV_TypeDash              : Trace une ligne discontinue avec des Tirets.
;       #SV_TypeDot               : Trace une ligne discontinue avec des Points.
; 
; Style: #SV_StyleRoundEnd        : Trace la ligne avec des extrémités arrondies.
;        #SV_StyleSquareEnd       : Trace la ligne avec un carré aux extrémités.
;
; Length: Longueur (Si Style <> #SV_StyleDefaut) ou Largeur (Si Style = #SV_StyleDefaut) des Traits des motifs (Carré, Rond) si Type = #SV_TypeDash ou #SV_TypeDot, sinon pas d'effet.
; Distance: Distance entre les motifs (Carré, Rond) si Type = #SV_TypeDash ou #SV_TypeDot, sinon pas d'effet.
;}
Procedure.b SimplyVector_DrawLine(X1.d, Y1.d, X2.d, Y2.d, Color.q = 18446744073692774400, Thickness.d = 1, Type.i = #SV_TypeLine, Style.i = #SV_StyleSquareEnd, Length.d = 10, Distance.d = 10)
  
  If Type.i = #SV_TypeLine
    
    Select Style.i
        
      Case #SV_StyleSquareEnd, #SV_StyleRoundEnd
        
        If Y1.d = Y2.d
          MovePathCursor(X1.d + (Thickness.d / 2), Y1.d + (Thickness.d / 2))
        ElseIf X1.d = X2.d
          MovePathCursor(X1.d + (Thickness.d / 2), Y1.d)
        ElseIf X1.d < X2.d And Y1.d < Y2.d
          MovePathCursor(X1.d + (Thickness.d / 2), Y1.d + (Thickness.d / 8))
        ElseIf X1.d > X2.d And Y1.d > Y2.d
          MovePathCursor(X1.d - (Thickness.d / 2), Y1.d - (Thickness.d / 8))
        ElseIf X1.d < X2.d And Y1.d > Y2.d
          MovePathCursor(X1.d + (Thickness.d / 2), Y1.d - (Thickness.d / 8))
        ElseIf X1.d > X2.d And Y1.d < Y2.d
          MovePathCursor(X1.d - (Thickness.d / 2), Y1.d + (Thickness.d / 8))
        Else
          MovePathCursor(X1.d + (Thickness.d / 2), Y1.d)
        EndIf
        
      Default
        
        If Y1.d = Y2.d
          MovePathCursor(X1.d, Y1.d + (Thickness.d / 2))
        ElseIf X1.d = X2.d
          MovePathCursor(X1.d + (Thickness.d / 2), Y1.d)
        Else
          MovePathCursor(X1.d, Y1.d)
        EndIf
        
    EndSelect
    
  Else
    
    Select Style.i
        
      Case #SV_StyleSquareEnd, #SV_StyleRoundEnd
        
        If Y1.d = Y2.d
          MovePathCursor(X1.d + (Length.d / 2), Y1.d + (Length.d / 2))
        ElseIf X1.d = X2.d
          MovePathCursor(X1.d + (Length.d / 2), Y1.d)
        ElseIf X1.d < X2.d And Y1.d < Y2.d
          MovePathCursor(X1.d + (Length.d / 2), Y1.d + (Length.d / 8))
        ElseIf X1.d > X2.d And Y1.d > Y2.d
          MovePathCursor(X1.d - (Length.d / 2), Y1.d - (Length.d / 8))
        ElseIf X1.d < X2.d And Y1.d > Y2.d
          MovePathCursor(X1.d + (Length.d / 2), Y1.d - (Length.d / 8))
        ElseIf X1.d > X2.d And Y1.d < Y2.d
          MovePathCursor(X1.d - (Length.d / 2), Y1.d + (Length.d / 8))
        Else
          MovePathCursor(X1.d + (Length.d / 2), Y1.d)
        EndIf
        
      Default
        
        If Y1.d = Y2.d
          MovePathCursor(X1.d, Y1.d + (Length.d / 2))
        ElseIf X1.d = X2.d
          MovePathCursor(X1.d + (Length.d / 2), Y1.d)
        Else
          MovePathCursor(X1.d, Y1.d)
        EndIf
        
    EndSelect
    
  EndIf
  
  If Type.i = #SV_TypeLine
    
    Select Style.i
        
      Case #SV_StyleSquareEnd, #SV_StyleRoundEnd
        
        If Y1.d = Y2.d
          AddPathLine(X1.d + (X2.d - X1.d) - (Thickness.d / 2), Y2.d + (Thickness.d / 2))
        ElseIf X1.d = X2.d
          AddPathLine(X1.d + (X2.d - X1.d) + (Thickness.d / 2), Y2.d)
        ElseIf X1.d < X2.d And Y1.d < Y2.d
          AddPathLine(X2.d - (Thickness.d / 2), Y2.d - (Thickness.d / 8))
        ElseIf X1.d > X2.d And Y1.d > Y2.d
          AddPathLine(X2.d + (Thickness.d / 2), Y2.d + (Thickness.d / 8))
        ElseIf X1.d < X2.d And Y1.d > Y2.d
          AddPathLine(X2.d - (Thickness.d / 2), Y2.d + (Thickness.d / 8))
        ElseIf X1.d > X2.d And Y1.d < Y2.d
          AddPathLine(X2.d + (Thickness.d / 2), Y2.d - (Thickness.d / 8))
        Else
          AddPathLine(X2.d - (Thickness.d / 2), Y2.d)
        EndIf
        
      Default
        
        If Y1.d = Y2.d
          AddPathLine(X1.d + (X2.d - X1.d), Y2.d + (Thickness.d / 2))
        ElseIf X1.d = X2.d
          AddPathLine(X1.d + (X2.d - X1.d) + (Thickness.d / 2), Y2.d)
        Else
          AddPathLine(X2.d, Y2.d)
        EndIf
        
    EndSelect
    
  Else
    
    Select Style.i
        
      Case #SV_StyleSquareEnd, #SV_StyleRoundEnd
        
        If Y1.d = Y2.d
          AddPathLine(X1.d + (X2.d - X1.d) - (Length.d / 2), Y2.d + (Length.d / 2))
        ElseIf X1.d = X2.d
          AddPathLine(X1.d + (X2.d - X1.d) + (Length.d / 2), Y2.d)
        ElseIf X1.d < X2.d And Y1.d < Y2.d
          AddPathLine(X2.d - (Length.d / 2), Y2.d - (Length.d / 8))
        ElseIf X1.d > X2.d And Y1.d > Y2.d
          AddPathLine(X2.d + (Length.d / 2), Y2.d + (Length.d / 8))
        ElseIf X1.d < X2.d And Y1.d > Y2.d
          AddPathLine(X2.d - (Length.d / 2), Y2.d + (Length.d / 8))
        ElseIf X1.d > X2.d And Y1.d < Y2.d
          AddPathLine(X2.d + (Length.d / 2), Y2.d - (Length.d / 8))
        Else
          AddPathLine(X2.d - (Length.d / 2), Y2.d)
        EndIf
        
      Default
        
        If Y1.d = Y2.d
          AddPathLine(X1.d + (X2.d - X1.d), Y2.d + (Length.d / 2))
        ElseIf X1.d = X2.d
          AddPathLine(X1.d + (X2.d - X1.d) + (Length.d / 2), Y2.d)
        Else
          AddPathLine(X2.d, Y2.d)
        EndIf
        
    EndSelect
    
  EndIf
  
  VectorSourceColor(Color.q)
  
  Select Type.i
      
    Case #SV_TypeLine ; 1
      StrokePath(Thickness.d, Style.i)
      
    Case #SV_TypeDash ; 2
      DashPath(Length.d, Distance.d, Style.i)
      
    Case #SV_TypeDot ; 3
      DotPath(Length.d, Distance.d, Style.i)
      
    Default ; 1
      StrokePath(Thickness.d, Style.i)
      
  EndSelect
  
  ProcedureReturn 1
  
EndProcedure

If OpenWindow(0, 0, 0, 800, 600, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CanvasGadget(0, 0, 0, 800, 600)
  
  If StartVectorDrawing(CanvasVectorOutput(0))
    
    BoxX.d = 50.5
    BoxY.d = 25.5
    BoxWidth.d = 201
    BoxHeight.d = 50
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeLine, #SV_StyleDefaut, 10, 12)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeLine, #SV_StyleSquareEnd, 10, 12)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeLine, #SV_StyleRoundEnd, 10, 12)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d = 50.5
    BoxY.d + BoxHeight.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDash, #SV_StyleDefaut, 10, 2)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDash, #SV_StyleSquareEnd, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDash, #SV_StyleRoundEnd, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    BoxX.d = 50.5
    BoxY.d + BoxHeight.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDot, #SV_StyleDefaut, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDot, #SV_StyleSquareEnd, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDot, #SV_StyleRoundEnd, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d = 50.5
    BoxY.d + BoxHeight.d + 25
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5 + BoxHeight.d
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeLine, #SV_StyleDefaut, 10, 12)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5 + BoxHeight.d
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeLine, #SV_StyleSquareEnd, 10, 12)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5 + BoxHeight.d
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeLine, #SV_StyleRoundEnd, 10, 12)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d = 50.5
    BoxY.d + BoxHeight.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5 + BoxHeight.d
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDash, #SV_StyleDefaut, 10, 2)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5 + BoxHeight.d
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDash, #SV_StyleSquareEnd, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5 + BoxHeight.d
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDash, #SV_StyleRoundEnd, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    BoxX.d = 50.5
    BoxY.d + BoxHeight.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5 + BoxHeight.d
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDot, #SV_StyleDefaut, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5 + BoxHeight.d
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDot, #SV_StyleSquareEnd, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5 + BoxHeight.d
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDot, #SV_StyleRoundEnd, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    
    BoxX.d = 50.5
    BoxY.d + BoxHeight.d + 25
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5 + BoxHeight.d
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeLine, #SV_StyleDefaut, 10, 12)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5 + BoxHeight.d
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeLine, #SV_StyleSquareEnd, 10, 12)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5 + BoxHeight.d
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeLine, #SV_StyleRoundEnd, 10, 12)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d = 50.5
    BoxY.d + BoxHeight.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5 + BoxHeight.d
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDash, #SV_StyleDefaut, 10, 2)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5 + BoxHeight.d
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDash, #SV_StyleSquareEnd, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5 + BoxHeight.d
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDash, #SV_StyleRoundEnd, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    BoxX.d = 50.5
    BoxY.d + BoxHeight.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5 + BoxHeight.d
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDot, #SV_StyleDefaut, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5 + BoxHeight.d
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDot, #SV_StyleSquareEnd, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    BoxX.d + BoxWidth.d + 5
    
    AddPathBox(BoxX.d, BoxY.d, BoxWidth.d, BoxHeight.d)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    StrokePath(1)
    
    LineX1.d = BoxX.d + 0.5
    LineY1.d = BoxY.d + 0.5 + BoxHeight.d
    
    LineX2.d = LineX1.d + BoxWidth.d - 1
    LineY2.d = BoxY.d + 0.5
    
    Thickness.d = 10
    
    SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeDot, #SV_StyleRoundEnd, 10, 11)
    
    ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    StopVectorDrawing()
    
  EndIf
  
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf

Re: Besoin d'aide VectorDrawing

Publié : mar. 21/juil./2020 9:54
par falsam
Heu là je suis 8O

Shadow ton code affiche la même chose que celui de Naheulf.

Je rester factuel.

Code de Naheulf 127 Lignes.
Code de Shadow 723 Lignes.
Shadow a écrit :Regarde mon code, si tu le peu, peut tu corriger ma routine ?
Récupère le code de Naheulf tu as la correction :mrgreen:

Re: Besoin d'aide VectorDrawing

Publié : mar. 21/juil./2020 10:08
par Mindphazer
falsam a écrit : Je rester factuel.

Code de Naheulf 127 Lignes.
Code de Shadow 723 Lignes.
Tu vas encore nous l'énerver et il va se (re)mettre à insulter tout le monde...

Re: Besoin d'aide VectorDrawing

Publié : mar. 21/juil./2020 10:14
par SPH
"MicroSoft" porte mal son nom de soft micro.
Mais la, on a un "MaxiSoft" qui aime les codes gonflés a l'hélium...

Le prend pas mal shadow, mais voila un type d'incomprehension !!

Re: Besoin d'aide VectorDrawing

Publié : mar. 21/juil./2020 10:38
par case
Shadow a écrit :je ne sais pas piloter un avion mais je veux rendre plus simple le pilotage des avions.

Re: Besoin d'aide VectorDrawing

Publié : mar. 21/juil./2020 10:57
par Shadow
Mindphazer a écrit :
falsam a écrit : Je rester factuel.

Code de Naheulf 127 Lignes.
Code de Shadow 723 Lignes.
Tu vas encore nous l'énerver et il va se (re)mettre à insulter tout le monde...
T'as raison Lol :lol:
Que veux tu, je suis un incompris :? 8O
Je comprends pas pourtant j'essais d'être simple :?

Ma routine permet de calculer la position de la ligne en fonction des option et de la position indiqué !
Bon puisque personne comprends rien je vais faire un autre exemple....

Re: Besoin d'aide VectorDrawing

Publié : mar. 21/juil./2020 12:21
par Naheulf
Ça part d'une bonne idée mais tu ne peut juste PAS empaqueter les calculs d'offset dans une fonction. Tout simplement car ces calculs changent selon la situation.

Exemple tout bête : Si je veut tracer un trait horizontal en bas des rectangles. Je serait tenté d'écrire (à la ligne 238 de ton code):

Code : Tout sélectionner

		
LineX1.d = BoxX.d + 0.5
LineY1.d = BoxY.d + BoxHeight - 0.5

LineX2.d = LineX1.d + BoxWidth.d - 1
LineY2.d = BoxY.d + BoxHeight - 0.5

Thickness.d = 10

SimplyVector_DrawLine(LineX1.d, LineY1.d, LineX2.d, LineY2.d, RGBA(255, 0, 0, 255), Thickness.d, #SV_TypeLine, #SV_StyleDefaut, 10, 12)
...sauf que ça marche pas. Et la raison est toute simple : Selon le contexte les calculs d'offsets diffèrent. Dans ce cas précis, au lieu de faire "Y1.d + (Thickness.d / 2)" il faut faire "Y1.d + (Thickness.d / 2)". Mais, si j'avais voulu faire le trait horizontal entre deux coins d'un losange voir d'un polygone quelconque, la formule serait encode différente, faisant intervenir des racines carrés voir de la trigonométrie.

On pourrait penser s'en sortir en calculant l'angle de la direction dans laquelle on doit décaler les extrémités de notre segment sauf qu'il faudra en plus passer en paramètre l'épaisseur des lignes qui forment l'angle concerné. Et puis, même en faisant comme ça, ça ne fonctionnera pas si notre contrainte est une tangente voir une intersection entre une courbe et autre chose.

Édit :
diverses personnes a écrit :
falsam a écrit : Je rester factuel.

Code de Naheulf 127 Lignes.
Code de Shadow 723 Lignes.
127 lignes mais j'ai utilité le symbole ":" pour mettre plusieurs instructions par lignes ce que n'est pas le cas de Shadow (qui a aussi un peut plus aére).
Il faut donc me compter 190 lignes (127 + 63 fois ":") voir plus si l'on tente de transposer l'aération du code.

Re: Besoin d'aide VectorDrawing

Publié : mar. 21/juil./2020 12:27
par Shadow
Dans ce cas précis, au lieu de faire "Y1.d + (Thickness.d / 2)" il faut faire "Y1.d + (Thickness.d / 2)"
Aucune différence !
As tu tester et compris mon code ?
Je recalcule tous suivant les position, type de trait, option du trait.
Ensuite montre moi en quoi ma routine n'est pas bonne, que je comprenne !