DarkBasic Professional Screenshot
if shiftkey()=1 && inkey()="s"
index = 0
while file exist("screen"+index) = 1
index = index + 1
endwhile
screenshot("screen"+index)
endif
`// screenshot function
`// exports the screen to bitmap
function screenshot(cBitmap as string)
`// declarations
type rgbclr
red as byte
green as byte
blue as byte
endtype
dim pBitmap(screen height(),screen width()) as rgbclr
`//
`// populate pixel array
for indexA = 0 to screen height()-1
for indexB = 0 to screen width()-1
`// get pixel point from screen
pxValue = point(indexA,indexB)
pBitmap(indexA,indexB).red = rgbr(pxValue) :`// save red
pBitmap(indexA,indexB).green = rgbg(pxValue) :`// save green
pBitmap(indexA,indexB).blue = rgbb(pxValue) :`// save blue
next indexB
next indexA
`// make sure the bitmap doesn't exist
if file exist(cBitmap+".bmp") = 0
open to write 1,cBitmap".bmp"
`// core header data
write word 1,ASC("BM")
write long 1,28 + (3*(screen height() * screen width()))
write word 1,0
write word 1,0
write word 1,28
`// extended header data
write long 1,14
write long 1,screen width()
write long 1,screen height()
write word 1,3 :`// perhaps change to 1?
`// write pixel data
for indexA = 0 to screen height()-1
for indexB = 0 to screen width()-1
write byte 1,pBitmap(indexA,indexB).red
write byte 1,pBitmap(indexA,indexB).green
write byte 1,pBitmap(indexA,indexB).blue
next indexB
next indexA
close file 1
else
Error = 1
endif
undim pBitmap(screen height(),screen width()) :`// release memory
endfunction Error
Happy now?
if you want i could even make this as a plugin which does all the wonderful formats you all so love
but you learn more from code like this
Anata aru kowagaru no watashi!