Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
| Show First 20 Lines • Show All 318 Lines • ▼ Show 20 Lines | static unsigned int *screenshot(ScrArea *curarea, int *dumpsx, int *dumpsy) | ||||
| } | } | ||||
| return dumprect; | return dumprect; | ||||
| } | } | ||||
| void KX_BlenderCanvas::MakeScreenShot(const char *filename) | void KX_BlenderCanvas::MakeScreenShot(const char *filename) | ||||
| { | { | ||||
| ScrArea area_dummy= {0}; | ScrArea area_dummy= {0}; | ||||
| bScreen *screen = m_win->screen; | |||||
| unsigned int *dumprect; | unsigned int *dumprect; | ||||
| int dumpsx, dumpsy; | int dumpsx, dumpsy; | ||||
| area_dummy.totrct.xmin = m_frame_rect.GetLeft(); | area_dummy.totrct.xmin = m_frame_rect.GetLeft(); | ||||
| area_dummy.totrct.xmax = m_frame_rect.GetRight(); | area_dummy.totrct.xmax = m_frame_rect.GetRight(); | ||||
| area_dummy.totrct.ymin = m_frame_rect.GetBottom(); | area_dummy.totrct.ymin = m_frame_rect.GetBottom(); | ||||
| area_dummy.totrct.ymax = m_frame_rect.GetTop(); | area_dummy.totrct.ymax = m_frame_rect.GetTop(); | ||||
| dumprect = screenshot(&area_dummy, &dumpsx, &dumpsy); | dumprect = screenshot(&area_dummy, &dumpsx, &dumpsy); | ||||
| if (!dumprect) { | if (!dumprect) { | ||||
| std::cerr << "KX_BlenderCanvas: Unable to take screenshot!" << std::endl; | std::cerr << "KX_BlenderCanvas: Unable to take screenshot!" << std::endl; | ||||
| return; | return; | ||||
| } | } | ||||
| /* initialize image file format data */ | /* initialize image file format data */ | ||||
| Scene *scene = (screen)? screen->scene: NULL; | Scene *scene = WM_window_get_active_scene(m_win); | ||||
| ImageFormatData *im_format = (ImageFormatData *)MEM_mallocN(sizeof(ImageFormatData), "im_format"); | ImageFormatData *im_format = (ImageFormatData *)MEM_mallocN(sizeof(ImageFormatData), "im_format"); | ||||
| if (scene) | if (scene) | ||||
| *im_format = scene->r.im_format; | *im_format = scene->r.im_format; | ||||
| else | else | ||||
| BKE_imformat_defaults(im_format); | BKE_imformat_defaults(im_format); | ||||
| /* save_screenshot() frees dumprect and im_format */ | /* save_screenshot() frees dumprect and im_format */ | ||||
| save_screenshot(filename, dumpsx, dumpsy, dumprect, im_format); | save_screenshot(filename, dumpsx, dumpsy, dumprect, im_format); | ||||
| } | } | ||||