The GetSurface() function returns the index of current drawing surface. If the current drawing surface is the screen, GetSurface will return a Zero, anything else and it's an Image index.
FACTS:
* A surface index of Zero means the screen.
* You can use the RenderToIMage command to set or restore the a drawing surface not just Images, but the screen also.
Mini Tutorial:
This example uses the GetSurface commands to get some basic information about the current drawing surface
; Display the info about the default surface Display_Current_Surface_info_to_Screen(50,50) ; Create a new image CreateImage 1,200,100 ; Set this new image as the Current drawing surface RenderToImage 1 Display_Current_Surface_info_to_Screen(50,200) ; Show the screen to the user and wait for a key press Sync WaitKey Function Display_Current_Surface_info_to_Screen(Xpos,Ypos) ; Get the curret drawing surface index SurfaceIndex=GetSurface() ; get the current drawing surfaces width Width=GetSurfaceWidth() ; get the current drawing surfaces Height Height=GetSurfaceHeight() If SurfaceINdex=0 Name$="[Screen]" Else Name$="[Image]" EndIf ; Make the Screen the current drawing surface RenderToScreen ; Display the info at this position Text xpos,ypos, "Surface Name:"+name$ Text xpos,ypos+20,"====================" Text xpos,ypos+40," Surface:"+Str$(SurfaceIndex) Text xpos,ypos+60," Width:"+Str$(Width) Text xpos,ypos+80," Height:"+Str$(Width) ; Restore the original drawing surface RenderToImage SurfaceIndex EndFunction |
This example would output. Surface Name:[screen] ==================== Surface:0 Width:800 Height:600 Surface Name:[Image] ==================== Surface:1 Width:200 Height:100 |
|