|
Take screenshot with allegro |
Bingocat
Member #15,424
December 2013
|
Is there any way to take a screenshot and then save it as an allegro bitmap to be able to display it? |
SiegeLord
Member #7,827
October 2006
|
al_save_bitmap("screenshot.bmp", al_get_backbuffer(display)) might work. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Bingocat
Member #15,424
December 2013
|
I don't mean take a screenshot of the program and save it. I mean take a screenshot of the whole screen and have it as a bitmap. Something like this. ALLEGRO_BITMAP *screenshot = al_take_screenshot(); |
SiegeLord
Member #7,827
October 2006
|
Ah... that can't be done with Allegro. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Edgar Reynaldo
Major Reynaldo
May 2007
|
You have to get the HDC of the desktop on Windows and then blit the screenDC into a compatible memoryDC and then you should be able to access the specific pixels and write to a bitmap. http://stackoverflow.com/questions/18858638/how-to-get-a-screen-image-into-a-memory-buffer My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Gideon Weems
Member #3,925
October 2003
|
jmasterx
Member #11,410
October 2009
|
How about al_save_bitmap("screenshot.bmp", al_get_backbuffer(display)); ALLEGRO_BITMAP* screen = al_load_bitmap("screenshot.bmp");
But really what you probably should do is triple buffer. https://wiki.allegro.cc/index.php?title=Triple_buffering Keep a bitmap the size of the screen and draw into that, https://www.allegro.cc/manual/5/al_set_target_bitmap then draw that to the screen. You now have a copy of what is on the screen and you can redraw that at a later time. Agui GUI API -> https://github.com/jmasterx/Agui |
Bingocat
Member #15,424
December 2013
|
Ok I figured out how to do it from here http://www.cplusplus.com/forum/windows/105644/ . I saved it as a jpg and loaded it with allegro. |
|