PROGRAM BlockTo2ndWindSavRes
?
?   Program Demonstrates F-Basic BLOCK Functions For
?   Capturing Image Data And Moving It To Different Locations
?   In A Different Output Window Residing In A Custom Screen.
?
?   In Between, It Saves Them To An Array Using BLOCK_SAVE
?   And Restores Them To An Image Block Using BLOCK_RESTORE
?
?   Draws And Replicates 3 Different Objects
?
INTEGER I,J,K,L,W1,W2,W3,S1,AA(126),BB(127),CC(66)

W1=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)
S1=SCREEN #1(0,200,3,2,@"Custom Screen #1-Pull Me Down!")
W2=WINDOW #18(50,20,540,160,0,0,0,0,-1,-1,31,@"WINDOW18",1)

FOR K=0 TO 1
   FOR I=0 TO 4
      J=BLOCK_PUT #10(30+I*100,30+K*50,C0'16)
   NEXT I
NEXT K

? Create And Capture Second Image

WINDOW_OUTPUT #1
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

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

? Create And Capture Third Image

WINDOW_OUTPUT #1
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

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

DELAY(100)

? As always, the closes are optional

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