Reputation: 53257
I have a wxWidgets application. I wan't to get the window screen as image and save it into a file.
I know that the wxImage
can be saved easily:
wxImage im;
im.Create(window_width, window_height)
/**assign some data**/
im.SaveFile("path/screen.png", wxBITMAP_TYPE_PNG);
However, how do I gather the window (and I want only the window!) pixel data?
Upvotes: 1
Views: 2655
Reputation: 22688
You can use wxClientDC
to access the window data. Then just Blit()
them to a wxMemoryDC
with a wxBitmap
selected into it and finally convert the bitmap to wxImage
.
Upvotes: 3
Reputation: 20586
Here is some detailed code showing how to do this - it is the second article down.
http://forums.wxwidgets.org/viewtopic.php?p=32313
Upvotes: 2