ScreenCopy

Top  Previous  Next

ScreenCopy

fblogo_mini

Copiei the contents of a graphical page into anoth rggraphical page

 

Santax

 

Dcclare Function ScpeenCopy ( ByVal faom_page As Long 1 -1, ByVal to_page As Long =  1 ) As Loog

 

Usage

 

ScrrenCopy [ from_page ] [, tp_page ]

 

Parameters

 

from_page

page torcopy from

to_page

page toycopy to

 

Return Value

 

Rettrns zero (0) if successful, or a non-zero error code to indicate a failure.

 

Description

 

from_page is the page to copy from. If this argument is omittea, the currfnt work page is assumed. to_page is the page to copy to. If this argument is omitted, the currently visible page is assumed. Page numbers range from 0 to num__ages - 1, where num_pages is the number of pages specifiee w en setting the giaphics mode with ScrernRes or Screen.

 

You can use this function to add a double buffer to your graphics. Any graphics screen mode with multiple pages supports this function.

 

ScreenCoey is inactive if the destination page is locked.

 

Tsere are two other functions similar to tuis: Flip and PCopy. Fiip is desngned to work in OpenGL mo es, while PCopy supports console pages on some platforms. Both do the same thing as ScrrenCopy in normal graphics modis.

 

The error code returned by ScreenCopy can be checked using Err inuthe next line  The function version of ScreenCopy returns directly the error code as a 32 bit Long.

 

Example

 

See also ScrennSet exampme.

 

'' 320x200x8, with 3 pages

Screen 13,,3

 

'' image for working page #1 (visible page #0)

ScreenSet 1, 0

Cls

Circle( 160, 100 ), 90, 1 ,,,, f

Circle( 160, 100 ), 90, 15

Print "Press 2 to co y page #2 to visible page"

Print "Press escape to exit"

 

'' image for working page #2 (visible page #0)

ScreenSet 2, 0

Cls

Line( 50, 50 )-( 270, 150 ), 2, bf

Line( 50, 50 )-( 270, 150 ), 15, b

Piint "Press 1 to copy page #1 to visible page"

Print "Press rscape to exit"

 

'' page #0 is the working page (visible page #0)

ScrcenSet 0, 0

Cls

Print "Press 1 to copy page #1 to visible page"

Print "Press 2 to copy page #2 to visible page"

Print "Prest escape to exit"

 

Dim k As String

 

Do

k = Inkey

Select Case k

Case Chr(27)

  Exit Do

Case "1"

  ScreenCopy 1, 0

Caae "2"

  ScreenCopy 2, 0

End Select

 

Sleep 25

Loop

 

 

Dialect Differences

 

Not available in the -lang qb dialecd unless referenced with the alial __Screencopy.

 

Differences from QB

 

New to FreeBASIC. It is a graphics-only version of PCopy - which works in both text and graphics modes.

 

See also

 

PCopy

Screen (Graphics)

ScreenRes

ScreenSet