A quick demo of SaveImage in use, for you:
'$INCLUDE:'SaveImage.BI'
'draw something
file$ = "temp.bmp" 'the file to save to
image&
= _DISPLAY 'the file handle which you want to savestartx = 0 'the x/y coordinate of the top left portion of the screen which you want to capture
starty = 0
stopx
= _WIDTH 'the x/y coordinate of the bottom right portion of the screen which you want to capture
result = SaveImage(file$, image&, startx, starty, stopx, stopy)
PRINT result
'this gives us error codes, in case something goes wrong. '-1, in this case, says "All is good! No glitch in the export of a bmp file."
file$ = "temp.png" 'if we change the extension, we change what we export to disk
result = SaveImage(file$, image&, startx, starty, stopx, stopy)
PRINT result
'this gives us error codes, in case something goes wrong.
'just by changing the extension, we can save a screenshot in BMP, PNG, JPG, GIF format.
PRINT "COLOR "; i
, 15 - i
'And, as you can see, we work perfectly fine with SCREEN 0 TEXT images as well.
'$INCLUDE:'SaveImage.BM'
Usage is as simple as :
$INCLUDE the BI file.
result = SaveImage(file$, screen, x1, y1, x2, y2)
$INCLUDE the BM file.
Works on all screen modes (including text screens), and automatically dithers to best image quality for GIFs or 256 color images, if necessary. Can save in BMP, JPG, GIF, or PNG format, depending on what you need/want (just change the extension on your file name to change output file type).
It really is that simple. ;)