There seems to be a bad result with RotateCoordinates and PathPointX, …
Could you check, please ?
Thanks.
Code: Select all
; PureBasic 6.00 LTS (Windows - x64) WIN 10
IF OpenWindow(0,0,0,600,600, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)=0
End
Endif
CanvasGadget(0,0,0,600,600)
If StartVectorDrawing(CanvasVectorOutput(0))
x_start=200
y_start=200
MovePathCursor(x_start,y_start)
distance.d=PathLength()
Debug StrD(PathCursorX())+" "+StrD(PathCursorY()) ; 200 200
Debug StrD(distance)+" : ("+StrD(PathPointX(distance))+" "+StrD(PathPointY(distance))+") "+StrD(PathPointAngle(distance)) ; 0 : (0 0) 0
; *** DRAW LINE RIGHT ***
AddPathLine(100,0,#PB_Path_Relative)
distance.d=PathLength()
Debug StrD(PathCursorX())+" "+StrD(PathCursorY()) ; 300 200
Debug StrD(distance)+" : ("+StrD(PathPointX(distance))+" "+StrD(PathPointY(distance))+") "+StrD(PathPointAngle(distance)) ; 100 : (300 200) 0
; *** DRAW LINE DOWN ***
AddPathLine(0,100,#PB_Path_Relative)
distance.d=PathLength()
Debug StrD(PathCursorX())+" "+StrD(PathCursorY()) ; 300 300
Debug StrD(distance)+" : ("+StrD(PathPointX(distance))+" "+StrD(PathPointY(distance))+") "+StrD(PathPointAngle(distance)) ; 200 : (300 300) 90
; *** DRAW LINE LEFT AFTER ROTATE BY DRAW LINE UP ***
RotateCoordinates(0,0,90) ; BUG AFTER RotateCoordinates
; ***
distance.d=PathLength()
Debug StrD(PathCursorX())+" "+StrD(PathCursorY()) ; (BUG ? -> ) 299.9999694824 -300
Debug StrD(distance)+" : ("+StrD(PathPointX(distance))+" "+StrD(PathPointY(distance))+") "+StrD(PathPointAngle(distance)) ; (BUG ? -> ) 199.9999694824 : (299.9999694824 -300) 0
AddPathLine(0,100,#PB_Path_Relative)
Debug StrD(PathCursorX())+" "+StrD(PathCursorY()) ; (BUG ? -> ) 299.9999694824 -200
Debug StrD(distance)+" : ("+StrD(PathPointX(distance))+" "+StrD(PathPointY(distance))+") "+StrD(PathPointAngle(distance)) ; (BUG ? -> ) 199.9999694824 : (299.9999694824 -300) 0
; ***
VectorSourceColor(RGBA(255, 0, 0, 255)) ; VECTOR DRAW IS GOOD
StrokePath(1)
StopVectorDrawing()
; *** REDRAW BY COORDINATES BUGGEES
offset_x=200
offset_y=0
If StartDrawing(CanvasOutput(0))
LINEXY(offset_x+200,offset_y+200,offset_x+300,offset_y+200,$FF0000)
LINEXY(offset_x+300,offset_y+200,offset_x+300,offset_y+300,$00FF00)
LINEXY(offset_x+300,offset_y+300,offset_x+200,offset_y+(-300),$0000FF) ; NO GOOD
StopDrawing()
Endif
; *** REDRAW BY COORDINATES WITH GOOD COORDINATES
offset_x=200
offset_y=200
If StartDrawing(CanvasOutput(0))
LINEXY(offset_x+200,offset_y+200,offset_x+300,offset_y+200,$FF0000)
LINEXY(offset_x+300,offset_y+200,offset_x+300,offset_y+300,$00FF00)
LINEXY(offset_x+300,offset_y+300,offset_x+200,offset_y+300,$0000FF)
StopDrawing()
Endif
Endif
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
// @Itsy Bitsy: Please read this before reporting errors in the future.