Taking a screenshot - equivalent for SaveBuffer?
BlitzMax Forums/BlitzMax Beginners Area/Taking a screenshot - equivalent for SaveBuffer?
| ||
I'm just wondering, I want to have the ability to take screenshots. In Blitz2D you could say: SaveBuffer(FrontBuffer(), "screenshot.bmp") But in BlitzMax??? Thanks, Nicolas. |
| ||
Is there no one who has an idea? Maybe I make it more interesting if I also want to load the saved buffer :-). If I don't find a solution I'm forced to work for school and I can assure you, programming in BlitzMax is much more fun than working for school. Thanks, Nicolas. |
| ||
I managed to get a perfect screen shot by pressing "Print Screen". |
| ||
Yeah, and when you are on a Macintosh chose Services / Screen / Grab screen... but that's not what I want. What I want is an equivalent for SaveBuffer() and LoadBuffer(). It's a good attempt RexRhino but it's not it. Thanks, Nicolas. |
| ||
I haven't found a way to do it. In addition, with no imagebuffers its not possible to say.. savebuffer(imagebuffer(image),"file.bmp") and save composite images without additional space. |
| ||
Use glReadPixels to read the backbuffer. |
| ||
Antony, could you hive me an easy example how to do this? I don't have any knowledge of OpenGL. Thanks in advance, Nicolas. |
| ||
Try something like this, ScreenShot:Tbank = CreateBank( GraphicsWidth()*GraphicsHeight()*3 ) glReadPixels 0,0,GraphicsWidth(),GraphicsHeight(),GL_RGB,GL_UNSIGNED_BYTE,bankBuf( Screenshot ) Now in the bank you have the screen, byte 0 = red(0-255) byte 1 = green byte 2 = blue etc. |
| ||
Sorry for your effort but this really looks quite Chinese to me :-). I could just copy/paste your code into my program, but then I don't even know what it does (I suppose it makes a screenshot since that's what I asked for). Thanks, Nicolas. |
| ||
There is no direct way of doing this. I'm hoping that a saveimage or savepixmap command will be in one of the updates. |
| ||
This might help as well: http://www.blitzbasic.com/Community/posts.php?topic=41965 |
| ||
In order to save an image from BlitzMax you would need some commands that allow images or pixmaps to be saved. Currently in the default BlitzMax configuration there is no image saving ability, only loading. However, I am sure if you check in other areas of the forums - perhaps in the module updates section - there was a thread about someone who has release a module which allows you to save an image in various format. This is probably what you need. Hopefully they will add image saving to a future update to the official BlitzMax. |
| ||
http://www.blitzbasic.com/codearcs/codearcs.php?code=1571 |
| ||
I'd have hoped that after a year, he'd have figured it out :) |
| ||
' grabimage.bmx ' draws a small graphic then uses grabimage to make an image ' as mask color and cls color both default to black a mask is ' created for the grabbed where any pixels unset on the backbuffer ' become transparent in the grabbed image Graphics 640,480,32 Cls DrawLine 0,0,32,32 DrawLine 32,0,0,32 DrawOval 0,0,32,32 Local image=CreateImage(32,32,1,DYNAMICIMAGE|MASKEDIMAGE) GrabImage image,0,0 Cls For Local i=1 To 100 DrawImage image,Rnd(640),Rnd(480) Next Flip WaitKey |
| ||
I used to use grabimage and then saveimage... but it seems saveimage is not included in max2d module... but there must be some way to save that image... |
| ||
Try GrabPixmap, and then SavePixmapPNG. |