No takers? No problem. I will usually ask a question but will not sit on my hands waiting to be spoon fed. After plowing further through the DBPro help system, command by command, I came to the Bitmap command set wich gave me the set of tools to do what I wanted. Observe the following example.
SYNC ON : SYNC RATE 0
SET TEXT FONT "arial" : SET TEXT SIZE 16
SET TEXT TO BOLD : SET TEXT TRANSPARENT
ptr AS DWORD
ptr2 AS DWORD
LOAD BITMAP "C:\Program Files\Dark Basic Software\Dark Basic Professional\Help\examples\display\backdrop.jpg"
bytesPerPixel=SCREEN DEPTH()/8
chunk=(SCREEN WIDTH()-40)*bytesPerPixel
LOCK BACKBUFFER
ptr=GET BACKBUFFER PTR()
pitch=GET BACKBUFFER PITCH()
width=GET BACKBUFFER WIDTH()
height=GET BACKBUFFER HEIGHT()
UNLOCK BACKBUFFER
CREATE BITMAP 1,width,height
COPY BITMAP 0,1
desc$="Direct Display Access"
REPEAT
x=MOUSEX()
y=MOUSEY()
SET CURRENT BITMAP 1
INK RGB(255,255,0),RGB(0,0,0)
CIRCLE x,y,20
MAKE MEMBLOCK FROM BITMAP 1,1
ptr2=GET MEMBLOCK PTR(1)+12
REM +12 TO SKIP THE 3 DWORDS = 12 BYTES FOR WIDTH, HEIGHT AND DEPTH
SET CURRENT BITMAP 0
INK RGB(0,0,0),0 : BOX 0,0,640,480
chunka#=WRAPVALUE(chunka#+1)
LOCK BACKBUFFER
FOR y=0 TO height STEP 1
chunkx=20+((COS(WRAPVALUE(chunka#+(y*1))))*20)
COPY MEMORY ptr+(y*pitch)+(chunkx*bytesPerPixel),ptr2+(y*pitch),chunk
NEXT y
UNLOCK BACKBUFFER
INK RGB(255,255,0),0
TEXT 20,SCREEN HEIGHT()-40,desc$
fps$="DBPro Fps: "+STR$(SCREEN FPS())
TEXT SCREEN WIDTH()-20-TEXT WIDTH(fps$),SCREEN HEIGHT()-40,fps$
exitFlag = Check_Key()
SYNC
DELETE MEMBLOCK 1
UNTIL exitFlag=1
DELETE MEMORY ptr2
FUNCTION Check_Key()
retVal=0
a$=UPPER$(INKEY$())
IF a$="P" THEN Pause()
IF a$=" " THEN retVal=1
ENDFUNCTION retVal
FUNCTION Pause()
REPEAT
UNTIL INKEY$()=""
REPEAT
UNTIL INKEY$()<>""
REPEAT
UNTIL INKEY$()=""
ENDFUNCTION
What the above example does, that is, the difference between the first example program I posted is that it creates a bitmap, copies the loaded JPG to that bitmap to act as a kind of a static clipboard from which to copy from. In the repeat loop it draws a circle to that bitmap and then creates a memblock from that bitmap, gets the pointer to that memblock and then the for loop 'waves' the window by copying memory from the temporarily created memblock to the backbuffer. Note that each time through the repeat loop, after a circle is drawn to the bitmap a memblock is created and it is deleted just before the until statement. When I run this on my machine I get only about 5FPS... extremely slow! But I do get the result I wanted, i.e. it's easy to send graphics functions like the circle command to the bitmap without much hassle. I expected this technique to be very slow even before I ran the program. Creating and deleting large memory blocks does take a fair chunk of the CPU's processing time.
Shortly after completing the above program I realized that there really shouldn't be a need to create a memblock from the created bitmap. Why not just copy graphics directly from the bitmap to the window? Compare the last example to this next one.
SET TEXT FONT "arial" : SET TEXT SIZE 16
SET TEXT TO BOLD : SET TEXT TRANSPARENT
LOAD BITMAP "C:\Program Files\Dark Basic Software\Dark Basic Professional\Help\examples\display\backdrop.jpg"
width=SCREEN WIDTH()
height=SCREEN HEIGHT()
CREATE BITMAP 1,width,height
COPY BITMAP 0,1
desc$="Screen Wave"
waveAmount=20
waveBlockLength=width-waveAmount*2
REPEAT
x=MOUSEX()
y=MOUSEY()
SET CURRENT BITMAP 1
INK RGB(255,255,0),RGB(0,0,0)
CIRCLE x,y,20
SET CURRENT BITMAP 0
INK RGB(0,0,0),0 : BOX 0,0,width,height
chunka#=WRAPVALUE(chunka#+1)
FOR y=0 TO height STEP 1
xPos=waveAmount+((COS(WRAPVALUE(chunka#+y)))*waveAmount)
COPY BITMAP 1,waveAmount,y,waveAmount+waveBlockLength,y+1,0,xPos,y,xPos+waveBlockLength,y+1
NEXT y
INK RGB(255,255,0),0
TEXT 20,SCREEN HEIGHT()-40,desc$
fps$="DBPro Fps: "+STR$(SCREEN FPS())
TEXT SCREEN WIDTH()-20-TEXT WIDTH(fps$),SCREEN HEIGHT()-40,fps$
exitFlag = Check_Key()
UNTIL exitFlag=1
FUNCTION Check_Key()
retVal=0
a$=UPPER$(INKEY$())
IF a$="P" THEN Pause()
IF a$=" " THEN retVal=1
ENDFUNCTION retVal
FUNCTION Pause()
REPEAT
UNTIL INKEY$()=""
REPEAT
UNTIL INKEY$()<>""
REPEAT
UNTIL INKEY$()=""
ENDFUNCTION
Note that the above example does not use the backbuffer, it copies graphics directly from the created bitmap to the window. Running the example in 640x480 windowed mode I get around 300FPS!
However further questions arise. Suppose that for some reason I wanted to copy the graphics from the bitmap to the backbuffer first, is there a way to obtain a pointer to the created bitmap without creating a memblock from the bitmap? I did not see any such commands in the Bitmap command set. And in this last example, is there an accurate way to control the FPS, mostly to slow down the rate, a way that would give you approximately equal frame rates on varying speed machines?