Using Get Image
is probably a good straight forward way to do this. However drawing to screen then copying the contents is sloppy.
The process of creating the image should not be visible on the screen. You should do this in memory only. Here is how you can use the BITMAP feature to achieve this.
`Store current bitmap so it can be restored
currentBitmap = Current Bitmap()
`Get a free bitmap if it exists.
For i = 1 to 31
If Bitmap Exist(i) = 0 then bitmapNum = i
`Create a new bitmap width of the image you want to create (to be efficient)
Create Bitmap bitmapNum, 512, 512
`Set the current bitmap to your new bitmap. 2D drawing and image/sprite pasting will draw to this instead of the screen.
Set Current Bitmap bitmapNum
`******DRAW THE IMAGE CONTENTS HERE - Or call a function to do it.******
`Put the bitmap contents into an image
imageNum = 100
Get Image imageNum, 0, 0, 512, 512, 3
`Set the current bitmap to back to what it was previously (probably the screen)
Set Current Bitmap currentBitmap
`Delete the bitmap we created since it is nolonger needed
Delete Bitmap bitmapNum
Doing it this way will simplify your code, reduce the possibility of bugs, and reduce the chance of visible graphics glitches. So in your code you only draw the map with that prepared image, if the image does not exist then you create the image and on the next frame you try again. Or you create the image when loading a menu or a level.
3D objects can also be rendered and incorporated into this process with clever use of additional cameras rendering to images.