zak
31-05-2010, 14:20
Hi
a phenomena !!
in the following code the speed of plot increased noticeably when we press the left mouse button on the title bar of the window
the purpose of "Canvas_Redraw" after "Canvas_SetPixel(x, y)" rather than after the whole loop is to give the impression of animation. why the speed is increased this way !.
Uses "UI"
Dim hWin As DWord = Canvas_Window("draw speed", 1, 1, 640, 480 )
Canvas_Attach(hWin, 0, %TRUE) ' <- double buffer
Canvas_Clear(%BLACK)
Dim x, y,i As Long
x=0:y=0
For i = 1 To 500
x = x + 1: y =y + 1
Canvas_Color( Rgb(255, 255, 255))
Canvas_SetPixel(x, y)
Canvas_Redraw
next
MsgBox hWin, "ok", %MB_APPLMODAL
Canvas_Window end
a phenomena !!
in the following code the speed of plot increased noticeably when we press the left mouse button on the title bar of the window
the purpose of "Canvas_Redraw" after "Canvas_SetPixel(x, y)" rather than after the whole loop is to give the impression of animation. why the speed is increased this way !.
Uses "UI"
Dim hWin As DWord = Canvas_Window("draw speed", 1, 1, 640, 480 )
Canvas_Attach(hWin, 0, %TRUE) ' <- double buffer
Canvas_Clear(%BLACK)
Dim x, y,i As Long
x=0:y=0
For i = 1 To 500
x = x + 1: y =y + 1
Canvas_Color( Rgb(255, 255, 255))
Canvas_SetPixel(x, y)
Canvas_Redraw
next
MsgBox hWin, "ok", %MB_APPLMODAL
Canvas_Window end