A brief explaination of the functions.
If you grab the attachment from the first post, just include it in your program, at the bottom of the code, and you're all set to make use of everything.
'Your code goes first
'and then down at the end:
'$INCLUDE:'SaveBMP.BM'
***************************************
To save the full screen to a BMP file on your disk, it's as simple as:
SaveFullBMP filename$Screen mode doesn't matter; the routine automatically detects what screen you're in, and it handles everything itself. Text screens work just fine (SCREEN 0), as well as 256 color and 32 bit color screens.
****************************************
To save a portion of a screen, or an inactive screen, all you do is:
SaveBMP filename$, image&, x1%, y1%, x2%, y2%filename% is the name of the file you want to save it to.
image& is the image handle you want to save. (0 for the active desktop.)
And the other 4 are the X/Y coordinates of the screen section you want to save.
For example, to save a section of the screen from 100,100 to 400,400, it'd be:
SaveBMP "whatever.BMP", 0, 100, 100, 400, 400
****************************************
If you look, there's also 2 more functions in this little package:
FUNCTION TextScreenToImage256& (image&)
FUNCTION TextScreenToImage32& (image&)These allow you to take an existing text screen and convert it over to either a 256 color screen, or a 32-bit color screen.
newscreen = TextScreenToImage32& (0) would be all it'd normally take to convert a SCREEN 0 to a 32-bit color screen.
****************************************
And, if you look, there *IS* one variable/CONST which you can set, to change the behavior of the routines:
SaveTextAs256ColorSince QB64 currently doesn't load 256 color images, you may not want to save a text screen as a 256 color screen. (Or, then again, you might, if you're going to use it for something externally and want to reduce overall size of the file.) This variable lets you change the mode which SaveBMP uses to convert a text screen into.
SaveTextAs256Color = 0 <-- Then you use 32-bit colors when converting and saving.
SaveTextAs256Color = (anything but 0) <-- Then you use 256 colors when converting and saving.
****************************************
****************************************
And that's the whole thing in a nutshell. :D