Practice with SMcNeill's SaveImage v2.3b package by creating 5 random drawings using mouse to select a screen section to save and then showing slide show of 5 saved screen sections:
_TITLE "mouse down at top left corner of image section, release down and to right for section to save image section." 'Test Saveimage v2.3b by Steve McNeill BI 2020-6-11, BM 2020-6-27
'$INCLUDE:'SaveImage.BI'
CONST SaveTextAs256Color
= 0 'Flag to Save as 256 color file or 32-bit color file, when converting SCREEN 0 to an image ' Set to TRUE (any non-zero value) to save text screens in 256 color mode.
' Set to FALSE (zero) to save text screens in 32-bit color mode.
yCP 7, "*** SaveImage Section *** b+ 2020-09-06"
yCP 10, "Testing SaveImage v2.3 by saving 5 screen sections of randomly drawn boxes."
yCP 12, "Mouse down at the top, left corner of your selection, drag mouse down and left to"
yCP 14, "bottom, right of your selection. As soon as you release button this app should "
yCP 16, "show the section you selected centered in the middle of the screen."
yCP 18, "we will do this 5 times and then show a little slide show of our selections :)"
yCP 21, "press any to continue..."
'draw some junk to save an image section
saveImageFile$
= "Test Save Image(" + _TRIM$(STR$(i&
)) + ").png" sx = mx: sy = my 'start mouse
LINE (sx
, sy
)-(mx
, my
), , B
LINE (sx
- 1, sy
- 1)-(mx
+ 1, my
+ 1), &HFF000000, B
fx = mx - 1: fy = my 'finish mouse
'Result = SaveImage(exportimage(i), l&, 0, 0, _WIDTH(l&) - 1, _HEIGHT(l&) - 1)
Result = SaveImage(saveImageFile$, 0, sx + 1, sy + 1, fx - 1, fy - 1)
IF Result
= -1 THEN 'file already found on drive PRINT "Image Section Saved to " + saveImageFile$
+ ", we will load it in 4 secs." PRINT "Error #" + _TRIM$(STR$(Result
)) + " occurred image not saved, goodbye." PRINT "Sorry, "; saveImageFile$;
" failed to load." saveImageFile$
= "Test Save Image(" + _TRIM$(STR$(i&
)) + ").png" PRINT "Sorry, "; saveImageFile$;
" failed to load."
SUB yCP
(y
, s$
) 'for xmax pixel wide graphics screen Center Print at pixel y row
'$INCLUDE:'SaveImage.BM'
Zip with BI and massive BM