PROGRAM TestBlockSavRes
?
?   Program Demonstrates F-Basic BLOCK Functions For
?   Capturing Image Data And Moving It To Different Locations
?   In The Current Output Window.
?
?   In Between, It Saves Them To An Array Using BLOCK_SAVE
?   And Restores Them To A Block Using BLOCK_RESTORE
?
?   Draws And Replicates Three Different Objects
?
INTEGER I,J,K,L
INTEGER AA(126),BB(127),CC(66)

I=WINDOW #1(0,0,640,200,0,0,0,0,-1,-1,31,@"WINDOW1",-1)
CURS_INV

? Create And Capture First Image

COLOR_BOXFILL #3 (0,30,30,70,70)
COLOR_BOX #2 (0,30,30,70,70)
COLOR_LINE #2 (3,0,0,40,40)
COLOR_LINE #2 (0,70,30,30,70)
I=BLOCK_GET #1 (0,30,30,70,70)
I=BLOCK_SAVE #1 (@AA)

? Redisplay First Image From Array AA

I=BLOCK_RESTORE #10 (@AA)
FOR K=0 TO 2
   FOR I=0 TO 5
      J=BLOCK_PUT #10 (30+I*100,30+K*50,C0'16)
   NEXT I
NEXT K

? Create And Capture Second Image

COLOR_ELLIPSE #1 (100,75,10,10)
COLOR_BOX #3 (0,85,60,115,90)
I=BLOCK_GET #2 (0,85,60,115,90)
I=BLOCK_SAVE #2 (@BB)

? Redisplay Second Image From Array BB

I=BLOCK_RESTORE #18 (@BB)
FOR K=0 TO 3
   FOR I=0 TO 4
      J=BLOCK_PUT #18 (85+I*100,10+K*50,C0'16)
   NEXT I
NEXT K

? Create And Capture Third Image

COLOR_BOXFILL #2 (0,95,45,105,55)
I=BLOCK_GET #20 (0,95,45,105,55)
I=BLOCK_SAVE #20 (@CC)

? Redisplay Third Image From Array CC

I=BLOCK_RESTORE #13 (@CC)
FOR K=0 TO 2
   FOR I=0 TO 4
      J=BLOCK_PUT #13 (95+I*100,45+K*50,C0'16)
   NEXT I
NEXT K

DELAY(100)

? As always, the closes are optional

WINDOW_CLOSE #1
BLOCK_CLOSE #1
BLOCK_CLOSE #2
BLOCK_CLOSE #10
BLOCK_CLOSE #13
BLOCK_CLOSE #18
BLOCK_CLOSE #20
END
