DashPath() does not scale correctly

Post bugreports for the Windows version here
Lebostein
Addict
Addict
Posts: 848
Joined: Fri Jun 11, 2004 7:07 am

DashPath() does not scale correctly

Post by Lebostein »

for smaller scale factors I get a difference:

Image

Code: Select all

OpenWindow(0, 0, 0, 1200, 800, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 1200, 800)

#dist_y = 50

StartVectorDrawing(CanvasVectorOutput(0, #PB_Unit_Millimeter))
  For copy = 1 To 10
    ResetCoordinates()
    ScaleCoordinates(copy / 25, copy / 25)
    For i = 0 To 10
      MovePathCursor(copy * 70, 25 + i * #dist_y)
      AddPathLine(100, 0, #PB_Path_Relative)
      StrokePath(1)
    Next i
    MovePathCursor(copy * 70, 25)
    AddPathLine(0, 10 * #dist_y, #PB_Path_Relative)
    DashPath(1, #dist_y / 2)
  Next copy
StopVectorDrawing()

Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Lebostein
Addict
Addict
Posts: 848
Joined: Fri Jun 11, 2004 7:07 am

Re: DashPath() does not scale correctly

Post by Lebostein »

Strange! It depends on the line thickness! If I double the line width, I get this result. Now the error only occurs with smaller scaling factors!

Image

Code: Select all

OpenWindow(0, 0, 0, 1200, 800, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 1200, 800)

#dist_y = 50

StartVectorDrawing(CanvasVectorOutput(0, #PB_Unit_Millimeter))
  For copy = 1 To 10
    ResetCoordinates()
    ScaleCoordinates(copy / 25, copy / 25)
    For i = 0 To 10
      MovePathCursor(copy * 70, 25 + i * #dist_y)
      AddPathLine(100, 0, #PB_Path_Relative)
      StrokePath(1)
    Next i
    MovePathCursor(copy * 70, 25)
    AddPathLine(0, 10 * #dist_y, #PB_Path_Relative)
    DashPath(2, #dist_y / 2)
  Next copy
StopVectorDrawing()

Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Lebostein
Addict
Addict
Posts: 848
Joined: Fri Jun 11, 2004 7:07 am

Re: DashPath() does not scale correctly

Post by Lebostein »

Seems the problem is Windows-only. On macOS, both examples work as expected.
freak
PureBasic Team
PureBasic Team
Posts: 5950
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: DashPath() does not scale correctly

Post by freak »

Lebostein wrote: Thu Oct 30, 2025 7:24 am Seems the problem is Windows-only. On macOS, both examples work as expected.
Yes. This is a GDI+ bug that I could not find a workaround for that works in all cases. The problem is also the cause of this bug report: viewtopic.php?p=515364
quidquid Latine dictum sit altum videtur
Post Reply