2D Commands in Dark BASIC Professional use the Windows Canvas rather than Direct2D., this means that they will not automatically clear from the Draw Buffer (see: Bitmap) when you call Sync.
Sync Off
Load Image ".\Media\tank.png" , 1
ShowImage As Integer = 0
LastKey As Integer = 0
// Paste Image 1, 0, 0, 1
Do
//CLS
If Spacekey()
If LastKey <> 57
ShowImage = Not ShowImage
EndIf
LastKey = 57
Else
LastKey = 0
EndIf
If ShowImage
Paste Image 1, X, 0, 1
Inc X, 1
If X > Screen Width( ) Then X = 0
EndIf
Sync
Loop
This is a simple example., where you press the Spacebar to Hide / Show the Image
Whenever the Image is unhidden, it will move across the screen.
Look at what happens with CLS commented out., and then when you uncomment it.
You can also comment out everything except Sync, and uncomment the Paste Image outside of the loop
While it won't move., notice how it will always render regardless of how many times the App is syncing.
Now the one outside the Loop
IF you use Sync On and set a Sync Rate., will flicker because VSync Requires a Double Buffer; but we're only Drawing to a Single Buffer rather than the Active Buffer (out of 2)... thus one is blank and the other is filled.
Hopefully with the example code this all makes a bit more sense.
In any case you should just not paste the image rather than delete it... as Loading and Deleting are performance intensive tasks.