Anyone have a Screenshot Example?

BlitzMax Forums/BlitzMax Programming/Anyone have a Screenshot Example?

Charles(Posted 2005) [#1]
The search engine for the site isn't working, and I'm feeling tired and lazy today.. does anyone have some example code for taking screenshots? I'm trying to catalog my progress..

Thanks!


TartanTangerine (was Indiepath)(Posted 2005) [#2]
ALT + PRINTSCREEN

Works for me everytime.


Perturbatio(Posted 2005) [#3]
I'm thinking he wants a less labour intensive way to do it in his program.
unfortunately there are no official image savers yet, this page here might be of some help (along with CreateImage and GrabImage).


klepto2(Posted 2005) [#4]
There is an Imagesaver but it only saves Png format so far.
A screenshot function will look like this:


Function ScreenshotPNG:Byte(url:String)

Local Screen:Timage = CreateImage(GraphicsWidth(),GraphicsHeight())

GrabImage(Screen,0,0)

Screentemp:TPixmap = LockImage(Screen)

Return SavePixmapPNG(Screentemp,url)

End Function


Graphics 800,600,0,-1

For i = 1 To 1000

Plot Rnd(0,800),Rnd(0,600)

Next

FlushMem()
Flip

test:Byte = ScreenshotPNG("c:\test.png")
Print test

WaitKey()




Charles(Posted 2005) [#5]
I'm on a Mac, so ALT+PRINTSCR isn't an option.

Thanks Klepto, that's what I was looking for. Thanks Pert.


ImaginaryHuman(Posted 2005) [#6]
Apple-Shift-3 grabs the screen on a Mac, plus Apple-Shift-4 gives you a box you can draw around stuff. In os/X it saves as a PDF file. You can export from `Preview` to make PNG or other format.


Charles(Posted 2005) [#7]
Thanks! That helps as well.


LeisureSuitLurie(Posted 2005) [#8]
If you add control to those combos, it copies to the clipboard instead of a file.